isi-vista / BusterNet

62 stars 19 forks source link

TypeError: a bytes-like object is required, not 'numpy.str_'` #5

Open elboudab opened 4 years ago

elboudab commented 4 years ago

Hey! I tried to run the code exactly how you did! I followed the steps and installed every library I have now ended up with this type cast error: `INFO: use random key COCO_train2014_000000321310-08-T0-X740139

TypeError Traceback (most recent call last)

in 1 for k in range(10) : ----> 2 rgb, gt, trans_mat = dataset.get_one_sample() 3 pred = simple_cmfd_decoder( busterNetModel, rgb ) 4 visualize_result( rgb, gt, pred ) ~\Desktop\BusterNet-master\Data\USCISI-CMFD-Small\api.py in get_one_sample(self, key) 152 sample = tuple of (image, cmd_mask, trans_mat) 153 ''' --> 154 return self.get_samples([key])[0] 155 def get_samples( self, key_list ) : 156 '''Get samples according to a given key list ~\Desktop\BusterNet-master\Data\USCISI-CMFD-Small\api.py in get_samples(self, key_list) 172 key = np.random.choice(self.sample_keys, 1)[0] 173 print("INFO: use random key", key) --> 174 lut_str = txn.get(key) 175 sample = self._decode_lut_str( lut_str ) 176 sample_list.append(sample) TypeError: a bytes-like object is required, not 'numpy.str_'` The current version I am using is python 3.6.8
emylincon commented 4 years ago

same error encountered. any fix yet?

kberci commented 4 years ago

Same error here, did anyone manage to solve it somehow?

kbmeena commented 4 years ago

same error encountered. any fix yet?

This is the error due to incompatible pyhton version. pthon 2.7 version was used to implement this model you might be using latest version... I could resolve this error by chaging lut_str = txn.get(key) as lut_str = txn.get( key.encode(encoding='utf-8', errors='strict') ) However now I am getting other error.

Tingting-Liu-star commented 3 years ago

same error encountered. who can help me?

170744039 commented 2 years ago

in the next line , there will be a error. the JSON object must be str, bytes or bytearray, not 'NoneType' so is right this code?

170744039 commented 2 years ago

the USCISI-CMFD-small have some error during decompression.so, the datest is mistake.after encode operation.

mmitchef commented 2 years ago

Hey! I tried to run the code exactly how you did! I followed the steps and installed every library I have now ended up with this type cast error:

`INFO: use random key COCO_train2014_000000321310-08-T0-X740139 TypeError Traceback (most recent call last) in 1 for k in range(10) : ----> 2 rgb, gt, trans_mat = dataset.get_one_sample() 3 pred = simple_cmfd_decoder( busterNetModel, rgb ) 4 visualize_result( rgb, gt, pred )

~\Desktop\BusterNet-master\Data\USCISI-CMFD-Small\api.py in get_one_sample(self, key) 152 sample = tuple of (image, cmd_mask, trans_mat) 153 ''' --> 154 return self.get_samples([key])[0] 155 def get_samples( self, key_list ) : 156 '''Get samples according to a given key list

~\Desktop\BusterNet-master\Data\USCISI-CMFD-Small\api.py in get_samples(self, key_list) 172 key = np.random.choice(self.sample_keys, 1)[0] 173 print("INFO: use random key", key) --> 174 lut_str = txn.get(key) 175 sample = self._decode_lut_str( lut_str ) 176 sample_list.append(sample)

TypeError: a bytes-like object is required, not 'numpy.str_'`

The current version I am using is python 3.6.8

The problem is with the small dataset, its corrupted and can't download it correctly.

170744039 commented 2 years ago

这个数据集是错的,我也在你的那个报错困扰了好长时间,于是之后我想单独提取这个小数据集中的文件发现什么也得不到,没有报错也没有结果,就好像一个空文件一样,所以我认为这个数据可能存在一些故障,那个128G的我还没有下载试过,应该可以用。其它的CASIA,和comomo都是没问题的,完全可以代替训练测试,没有必要纠结在一个可能有错的数据集上,毕竟原文代码没有问题。