BusterNet icon indicating copy to clipboard operation
BusterNet copied to clipboard

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

Open elboudab opened this issue 5 years ago • 8 comments

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

elboudab avatar Oct 14 '19 17:10 elboudab

same error encountered. any fix yet?

emylincon avatar Jan 17 '20 18:01 emylincon

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

kberci avatar Feb 08 '20 17:02 kberci

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.

kbmeena avatar May 13 '20 15:05 kbmeena

same error encountered. who can help me?

Tingting-Liu-star avatar May 26 '21 13:05 Tingting-Liu-star

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 avatar Oct 27 '21 09:10 170744039

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

170744039 avatar Oct 28 '21 03:10 170744039

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.

mmitchef avatar Nov 22 '21 15:11 mmitchef

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

170744039 avatar Nov 23 '21 07:11 170744039