码迷,mamicode.com
首页 > 其他好文 > 详细

KeyError: 'chair'

时间:2017-05-31 15:32:20      阅读:1005      评论:0      收藏:0      [点我收藏+]

标签:tool   mil   class   des   asc   ota   similar   file   name   

使用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'

标签:tool   mil   class   des   asc   ota   similar   file   name   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!