endernewton / tf-faster-rcnn

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

Error:run ./experiments/scripts/test_faster_rcnn.sh 0 pascal_voc vgg16 #261

Open WeishanLi opened 6 years ago

WeishanLi commented 6 years ago

when i run ./experiments/scripts/test_faster_rcnn.sh 0 pascal_voc vgg16, i encountered the following error

Reading annotation for 4901/4952 Saving cached annotations to /home/xupt/awesome-tensorflow/tf-faster-rcnn/data/VOCdevkit2007/VOC2007/ImageSets/Main/test.txt_annots.pkl Traceback (most recent call last): File "./tools/test_net.py", line 120, in <module> test_net(sess, net, imdb, filename, max_per_image=args.max_per_image) File "/home/xupt/awesome-tensorflow/tf-faster-rcnn/tools/../lib/model/test.py", line 192, in test_net imdb.evaluate_detections(all_boxes, output_dir) File "/home/xupt/awesome-tensorflow/tf-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 283, in evaluate_detections self._do_python_eval(output_dir) File "/home/xupt/awesome-tensorflow/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 "/home/xupt/awesome-tensorflow/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

engineer1109 commented 6 years ago

delete test.txt_annots.pkl

srb-cv commented 6 years ago

@lwslove911 did you find out any solution to this, I am facing the same issue here

chiru83 commented 6 years ago

please change r by 'rb' mode while reading that pckl file

tensor-flower commented 6 years ago

https://github.com/endernewton/tf-faster-rcnn/issues/171

basically edit tf-faster-rcnn/lib/datasets/voc_eval.py line121, change 'b' to 'wb' so it will become

with open(cachefile,'wb') as f

After you do that, it may throw you a new EOF ran out of input error. You then need to edit same file line 105. Change it to

cachefile = os.path.join(cachedir, '%s_annots.pkl' % imagesetfile.split("/")[-1].split(".")[0])
Alliance-DENG commented 6 years ago

Thanks @tensor-flower

Lj10086 commented 5 years ago

Hi, did you fix it by the following? basically edit tf-faster-rcnn/lib/datasets/voc_eval.py line121, change 'b' to 'wb' so it will become with open(cachefile,'wb') as f After you do that, it may throw you a new EOF ran out of input error.
You then need to edit same file line 105. Change it to cachefile = os.path.join(cachedir, '%s_annots.pkl' % imagesetfile.split("/")[-1].split(".")[0]) delete test.txt_annots.pkl