首页 > 其他 > 详细

KeyError: 'chair'

时间:2017-05-31 14:56:18      阅读:2577      评论:0      收藏:0      [点我收藏+]

使用py-faster-rcnn训练VOC2007数据集时遇到如下问题:

File "/home/sai/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 217, in _load_pascal_annotation
cls = self._class_to_ind[obj.find(‘name‘).text.lower().strip()]
KeyError: ‘chair‘

解决:

You probably need to write some line of codes to ignore any objects with classes except the classes you are looking for when you are loading the annotation _load_pascal_annotation.
Something like
cls_objs = [
obj for obj, clas in objs, self._classes if obj.find(‘name‘).text== clas]

when you are loading the annotation in _load_pascal_annotation method, look for something like
objs = diff_objs (or non_diff_objs)
After that line insert something similar to below code

cls_objs = [obj for obj in objs if obj.find(‘name‘).text in self._classes]
objs = cls_objs


https://github.com/rbgirshick/py-faster-rcnn/issues/316

KeyError: 'chair'

原文:http://www.cnblogs.com/JZ-Ser/p/6924156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!