coco.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:RON 作者: taokong 项目源码 文件源码
def __init__(self, image_set, year, devkit_path=None):
        datasets.imdb.__init__(self, 'coco_' + year + '_' + image_set)
        # COCO specific config options
        self.config = {'top_k' : 2000,
                       'use_salt' : True,
                       'cleanup' : True,
                       'crowd_thresh' : 0.7,
                       'min_size' : 2}
        # name, paths
        self._year = year
        self._image_set = image_set
        self._data_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        # load COCO API, classes, class <-> id mappings
        self._COCO = COCO(self._get_ann_file())
        cats = self._COCO.loadCats(self._COCO.getCatIds())
        self._classes = tuple(['__background__'] + [c['name'] for c in cats])
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._class_to_coco_cat_id = dict(zip([c['name'] for c in cats],
                                              self._COCO.getCatIds()))
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb

        self.competition_mode(False)

        self._data_name = image_set + year  # e.g., "val2014"

        if self._data_name == 'test-dev2015':
            self._data_name_path = 'test2015'
        else:
            self._data_name_path = self._data_name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号