13 Security Lab

[ERR] h5py.File TypeError: No conversion path for dtype: dtype('<U19') 본문

Computer Science/Programming

[ERR] h5py.File TypeError: No conversion path for dtype: dtype('<U19')

Maj0r Tom 2018. 6. 25. 23:08

h5py Error


Error Message:

TypeError: No conversion path for dtype: dtype('<U19')


Error Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---------------------------------------------------------------------------
TypeError    Traceback (most recent call last)
<ipython-input-41-67ebf7ff6a8d> in <module>()
      1 with h5py.File(''.join(['datasets/faces_dataset_new.h5']), 'w') as f:
      2     dset_face = f.create_dataset("images", data = images)
----> 3     dset_headers = f.create_dataset('headers', data = headers)
      4     dset_label_input = f.create_dataset('label_input', data = label_input)
 
C:\ProgramData\Anaconda3\lib\site-packages\h5py\_hl\group.py in create_dataset(self, name, shape, dtype, data, **kwds)
    104         
    105         with phil:
--> 106             dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
    107             dset = dataset.Dataset(dsid)
    108             if name is not None:
 
C:\ProgramData\Anaconda3\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)
     98         else:
     99             dtype = numpy.dtype(dtype)
--> 100         tid = h5t.py_create(dtype, logical=1)
    101 
    102     # Legacy
cs


Problem:

It stored NumPy Unicode type. and h5py can't handle it
(in my case, numpy object 'headers' has unicode strings)


Solution:

encode strings to utf8 format
like..


Similar fix issue:
(already comitted as same issue)

https://github.com/keras-team/keras/commit/9621bb5b8e645048ce6acd8548393cd95997f813


Not working by this:


Reference:

https://github.com/h5py/h5py/issues/289















Comments