Pendulibrium / ai-visual-storytelling-seq2seq

Implementation of seq2seq model for Visual Storytelling Challenge (VIST) http://visionandlanguage.net/VIST/index.html
58 stars 16 forks source link

Problem in feature extraction while running myalexnet_forward_newtf.py #48

Open priyanka-manogaran06 opened 3 years ago

priyanka-manogaran06 commented 3 years ago

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('
MeenatchiKV commented 3 years ago

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)