You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert the path names in image_ids to string in "ascii" format then create the dataset.
The error occured when trying to use strings of a different encoding when hdf5 supports ascii or utf-8.
data_file.create_dataset("embeddings", data = image_embeddings)
ascii_img_id = []
for img_path in image_ids:
ascii_img_ids.append(img_path.encode("ascii"))
data_file.create_dataset("image_ids", data = image_ids)
TypeError Traceback (most recent call last)
in
----> 1 import myalexnet_forward_newtf
~\Desktop\ai-visual-storytelling-seq2seq-master\dataset\models\alexnet\myalexnet_forward_newtf.py in
210
211 data_file.create_dataset("embeddings", data = image_embeddings)
--> 212 data_file.create_dataset("image_ids", data = image_ids)
213
214 print(time.time()-t)
c:\users\elcot\appdata\local\programs\python\python36\lib\site-packages\h5py_hl\group.py in create_dataset(self, name, shape, dtype, data, **kwds)
134
135 with phil:
--> 136 dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
137 dset = dataset.Dataset(dsid)
138 if name is not None:
c:\users\elcot\appdata\local\programs\python\python36\lib\site-packages\h5py_hl\dataset.py in make_new_dset(parent, shape, dtype, data, chunks, compression, shuffle, fletcher32, maxshape, compression_opts, fillvalue, scaleoffset, track_times, external, track_order, dcpl)
116 else:
117 dtype = numpy.dtype(dtype)
--> 118 tid = h5t.py_create(dtype, logical=1)
119
120 # Legacy
h5py\h5t.pyx in h5py.h5t.py_create()
h5py\h5t.pyx in h5py.h5t.py_create()
h5py\h5t.pyx in h5py.h5t.py_create()
TypeError: No conversion path for dtype: dtype('<U93')
code:
net_data = np.load(open("bvlc_alexnet.npy","rb"),encoding="latin1").item()
please help me to solve this issue!
The text was updated successfully, but these errors were encountered: