endernewton / tf-faster-rcnn

Tensorflow Faster RCNN for Object Detection
https://arxiv.org/pdf/1702.02138.pdf
MIT License
3.65k stars 1.57k forks source link

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

Open henbucuoshanghai opened 5 years ago

henbucuoshanghai commented 5 years ago

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 commented 5 years ago

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

TakedaHiroki commented 5 years ago

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 commented 5 years ago

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