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

COCO数据集使用super categories时出现IndexError: list index out of range

时间:2020-05-09 15:26:45      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:elf   ase   error:   使用   ati   数据集   parameter   ret   otool   

在文件xxx/site-packages/pycocotools-2.0-py3.7-linux-x86_64.egg/pycocotools/coco.py中找到约157行左右的函数

def getCatIds(self, catNms=[], supNms=[], catIds=[]):

改为:

 

    def getCatIds(self, catNms=[], supNms=[], catIds=[]):
        """
        filtering parameters. default skips that filter.
        :param catNms (str array)  : get cats for given cat names
        :param supNms (str array)  : get cats for given supercategory names
        :param catIds (int array)  : get cats for given cat ids
        :return: ids (int array)   : integer array of cat ids
        """
        #catNms = catNms if _isArrayLike(catNms) else [catNms]
        #supNms = supNms if _isArrayLike(supNms) else [supNms]
        #catIds = catIds if _isArrayLike(catIds) else [catIds]

        #if len(catNms) == len(supNms) == len(catIds) == 0:
        #    cats = self.dataset[‘categories‘]
        #else:
        #    cats = self.dataset[‘categories‘]
        #    cats = cats if len(catNms) == 0 else [cat for cat in cats if cat[‘name‘]          in catNms]
        #    cats = cats if len(supNms) == 0 else [cat for cat in cats if cat[‘supercategory‘] in supNms]
        #    cats = cats if len(catIds) == 0 else [cat for cat in cats if cat[‘id‘]            in catIds]
        #ids = [cat[‘id‘] for cat in cats]
        ids = [cat[id] for cat in self.dataset[categories]]
        #print(self.dataset[‘categories‘])
        #print(cats)
        return ids

 

COCO数据集使用super categories时出现IndexError: list index out of range

标签:elf   ase   error:   使用   ati   数据集   parameter   ret   otool   

原文地址:https://www.cnblogs.com/aimhabo/p/12857706.html

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