tf-faster-rcnn icon indicating copy to clipboard operation
tf-faster-rcnn copied to clipboard

TypeError: write() argument must be str, not bytes

Open henbucuoshanghai opened this issue 5 years ago • 4 comments

henbucuoshanghai avatar Jun 06 '19 09:06 henbucuoshanghai

File "/tf-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 246, in _do_python_eval use_07_metric=use_07_metric, use_diff=self.config['use_diff']) File "/tf-faster-rcnn/tools/../lib/datasets/voc_eval.py", line 122, in voc_eval pickle.dump(recs, f) TypeError: write() argument must be str, not bytes Command exited with non-zero status 1 2484.50user 101.77system 7:44.19elapsed 557%CPU (0avgtext+0avgdata 2846360maxresident)k 1296inputs+62952outputs (4major+7864686minor)pagefaults 0swaps

henbucuoshanghai avatar Jun 06 '19 09:06 henbucuoshanghai

./experiments/scripts/test_faster_rcnn.sh $GPU_ID pascal_voc_0712 res101

henbucuoshanghai avatar Jun 06 '19 09:06 henbucuoshanghai

Hi, @henbucuoshanghai

You can probably solve this error and another error coused by changing as follows:

Edit tf-faster-rcnn/lib/datasets/voc_eval.py

line121, change 'w' to 'wb' like this

with open(cachefile, 'wb') as f:

line105, change to

cachefile = os.path.join(cachedir, '%s_annots.pkl' % imagesetfile.split("/")[-1].split(".")[0])

TakedaHiroki avatar Jun 25 '19 11:06 TakedaHiroki

@henbucuoshanghai Is 'cachefile' defined correctly? Can you show me your code?

TakedaHiroki avatar Aug 30 '19 19:08 TakedaHiroki