Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in feature extraction while running myalexnet_forward_newtf.py #48

Open
priyanka-manogaran06 opened this issue Mar 1, 2021 · 1 comment

Comments

@priyanka-manogaran06
Copy link

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!

@MeenatchiKV
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants