Beispiel #1
0
  def __init__(self, image_set, devkit_path=None):
    imdb.__init__(self, 'gridsum_car_' + image_set)
    #self._year = year
    self._image_set = image_set
    self._devkit_path = self._get_default_path() if devkit_path is None \
      else devkit_path
    self._data_path = self._devkit_path
    self._classes = ('__background__',  # always index 0
                     'suzuki', 'mg', 'nissan', 'cadillac', 'honda', 'haval', 'porsche', 'benz', 'mazda', 'roewe',
                     'lincoln', 'chana', 'lexus', 'paojun', 'trumpchi', 'geely', 'kia', 'toyota', 'venucia',
                     'land rover', 'volkswagen', 'baic', 'skoda', 'bmw', 'chery', 'buick', 'jeep', 'ford', 'audi',
                     'renault')
    self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
    self._image_ext = '.jpg'
    self._image_index = self._load_image_set_index()
    # Default to roidb handler
    self._roidb_handler = self.gt_roidb
    self._salt = str(uuid.uuid4())
    self._comp_id = 'comp4'

    # PASCAL specific config options
    self.config = {'cleanup': True,
                   'use_salt': True,
                   'use_diff': False,
                   'matlab_eval': False,
                   'rpn_file': None}

    assert os.path.exists(self._devkit_path), \
      'VOCdevkit path does not exist: {}'.format(self._devkit_path)
    assert os.path.exists(self._data_path), \
      'Path does not exist: {}'.format(self._data_path)
Beispiel #2
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'kitti_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set   # trainval
        # self._devkit_path = self._get_default_path() if devkit_path is None \
        #     else devkit_path
        self._devkit_path ="E:\\"
        self._data_path = os.path.join(self._devkit_path, 'KITTI' + self._year)
        print("Duan:                                   ", self._data_path)
        self._classes = ('__background__',        # 这里开头字母全部小写
           'car', 'van', 'truck', 'boat',
           'pedestrian', 'person_sitting', 'cyclist', 'tram', 'misc',
           )
        self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.png'                                # CHANGE HERE LALALALALLALALALALA
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {'cleanup': True,
                       'use_salt': True,
                       'use_diff': False,
                       'matlab_eval': False,
                       'rpn_file': None}

        assert os.path.exists(self._devkit_path), \
            'KITTIdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #3
0
Datei: coco.py Projekt: fhlt/X-
    def __init__(self, image_set, year):
        imdb.__init__(self, 'coco_' + year + '_' + image_set)
        # COCO specific config options
        self.config = {'use_salt': True, 'cleanup': True}
        # name, paths
        self._year = year
        self._image_set = image_set
        self._data_path = osp.join(cfg.FLAGS2["data_dir"], 'coco')
        # 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(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._class_to_coco_cat_id = dict(
            list(zip([c['name'] for c in cats], self._COCO.getCatIds())))
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self.set_proposal_method('gt')
        self.competition_mode(False)

        # Some image sets are "views" (i.e. subsets) into others.
        # For example, minival2014 is a random 5000 image subset of val2014.
        # This mapping tells us where the view's images and proposals come from.
        self._view_map = {
            'minival2014': 'val2014',  # 5k val2014 subset
            'valminusminival2014': 'val2014',  # val2014 \setminus minival2014
            'test-dev2015': 'test2015',
        }
        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if coco_name in self._view_map else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')
Beispiel #4
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = ('__background__',  # always index 0
                         'aeroplane', 'bicycle', 'bird', 'boat',
                         'bottle', 'bus', 'car', 'cat', 'chair',
                         'cow', 'diningtable', 'dog', 'horse',
                         'motorbike', 'person', 'pottedplant',
                         'sheep', 'sofa', 'train', 'tvmonitor')
        self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'                                # CHANGE HERE LALALALALLALALALALA
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {'cleanup': True,
                       'use_salt': True,
                       'use_diff': False,
                       'matlab_eval': False,
                       'rpn_file': None}

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #5
0
    def __init__(self, image_set, year, devkit_path=None):
        #  父类初始化
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self._year = year  # 2007
        self._image_set = image_set  # ‘trainval’
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path     # 'data/VOCdevkit2007'
        self._data_path = os.path.join(
            self._devkit_path,
            'VOC' + self._year)  # 'data/VOCdevkit2007/VOC2007'
        self._classes = (
            '__background__',  # always index 0
            'aeroplane',
            'bicycle',
            'bird',
            'boat',
            'bottle',
            'bus',
            'car',
            'cat',
            'chair',
            'cow',
            'diningtable',
            'dog',
            'horse',
            'motorbike',
            'person',
            'pottedplant',
            'sheep',
            'sofa',
            'train',
            'tvmonitor')
        self._class_to_ind = dict(zip(self.classes,
                                      xrange(self.num_classes)))  # 将类名转换称下标的字典
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index(
        )  # ['000001','000003',……]_根据trainval.txt获取到的image索引_
        # Default to roidb handler
        # self._roidb_handler = self.selective_search_roidb

        # gt_roidb方法,调用_load_pascal_annotation方法读取Annotation
        # 返回[{boxes,gt_classes,ishards,overlaps,flipped,seg_areas}{boxes,gt_classes,ishards,overlaps,flipped,seg_areas}{}]形式
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #6
0
  def __init__(self, image_set, image_Type, data_Type='cervix', devkit_path=None, use_diff=False):
    name = data_Type + '_' + image_set + image_Type
    if use_diff:
      name += '_diff'
    imdb.__init__(self, name)
    self._image_set = image_set
    self._image_type = image_Type
    self._image_type_name = self._get_image_type_name()
    self._data_type = data_Type
    self._devkit_path = self._get_default_path() if devkit_path is None \
      else devkit_path
    self._data_path = os.path.join(self._devkit_path, data_Type)
    self._classes = cfg.CLASSES
    self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
    self._image_ext = '.jpg'
    self._image_index = self._load_image_set_index()
    # Default to roidb handler
    self._roidb_handler = self.gt_roidb
    self._salt = str(uuid.uuid4())
    self._comp_id = 'comp4'

    # PASCAL specific config options
    self.config = {'cleanup': True,
                   'use_salt': True,
                   'use_diff': use_diff,
                   'matlab_eval': False,
                   'rpn_file': None}

    assert os.path.exists(self._devkit_path), \
      'VOCdevkit path does not exist: {}'.format(self._devkit_path)
    assert os.path.exists(self._data_path), \
      'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set='jinnan', data_path=None):
        imdb.__init__(self, image_set)
        self._image_set = image_set
        self._data_path = os.path.join(cfg.FLAGS2["data_dir"], data_path)
        self._devkit_path = os.path.join(cfg.FLAGS2["data_dir"],
                                         str(data_path + '_devkit\\'))
        self._classes = (
            '__background__',  # always index 0
            "iron-lighter",
            "black-lighter",
            "knive",
            "battery",
            "scissor")
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }
Beispiel #8
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'GeetCode_' + year + '_' +
                      image_set)  #GeetCode_2019_train
        self._year = year
        self._image_set = image_set
        #os.path.join(cfg.FLAGS2["data_dir"], 'VOCdevkit' + self._year)
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'chineseimgcode2019')
        self._classes = ('__background__', 'chinese')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb  #Return the database of ground-truth regions of interest.
        self._salt = str(uuid.uuid4())  #uuid4 则是一个纯随机数,与机器无关, 相重的几率很小
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #9
0
    def __init__(self, image_set, devkit_path=None):
        imdb.__init__(self, 'siammask_data_' + image_set)
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'siammask_data')

        self._classes = ['__background__'] + cfg.SIAMSE.CLASSES
        self.defect = cfg.SIAMSE.CLASSES
        self._class_to_ind = dict(zip(self.classes, range(self.num_classes)))
        self._image_ext = '.bmp'
        self._image_index = self._load_image_set_index()

        self._roidb_handler = self.gt_roidb
        self.templatedb = self.get_templatedb()

        self._shuffle_inds()
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
                'ZLRMdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
                'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = (
            '__background__',  # always index 0
            'lb')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'vidor_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set + '_full'
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = get_vidor_classes()
        self._class_to_ind = dict(zip(self.classes, range(self.num_classes)))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        # self._roidb_handler = self.selective_search_roidb
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #12
0
    def __init__(self, image_set, year, directory,imdb_name,devkit_path=None):
        imdb.__init__(self,imdb_name+ '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._devkit_path = cfg.FLAGS2[directory]
        self._data_path = cfg.FLAGS2[directory]
        self._classes = cfg.FLAGS2["CLASSES"]
        self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {'cleanup': True,
                       'use_salt': True,
                       'use_diff': False,
                       'matlab_eval': False,
                       'rpn_file': None}

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, year, dist_path=None):
        imdb.__init__(self, image_set)
        self._year = year
        self._image_set = image_set.split('dist_')[1]
        self._dist_path = self._get_default_path() if dist_path is None \
                                else dist_path
        self._data_path = self._dist_path
        self._classes = (
            '__background__',  # always index 0
            'tamper',
            'authentic')
        self._classes = (
            'authentic',  # always index 0
            'tamper')
        #self.classes =('authentic',  # always index 0
        #'splicing','removal')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = {'.png', '.jpg', '.tif', '.bmp', '.JPG'}
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb

        assert os.path.exists(self._data_path), \
          'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'gene_2007_trainval')
        self._year = year  #2007
        self._image_set = image_set  #‘trainval’
        self._devkit_path = 'data/gene_2007_trainval'
        self._data_path = os.path.join(self._devkit_path, 'VOC' + '2007')
        self._classes = (
            '__background__',  # always index 0
            'tampered')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(
                self.num_classes)))))  #{'__background__': 0, 'tampered': 1}
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())  #基于随机数生成唯一ID
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self,
                 image_set,
                 year,
                 use_diff=False):  #构造函数 两个参数 一个是图片集,一个是划分年份
        print("pascal我被调用了")
        name = 'voc_' + year + '_' + image_set
        if use_diff:  #是否使用diff 这个字符 (表示难以识别的物体 有重叠 粘连的物体)
            name += '_diff'
        imdb.__init__(self, name)  #初始化 imdb类
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path()
        self._data_path = os.path.join(
            self._devkit_path, 'VOC' +
            self._year)  #获取数据库路径 E:\fasterwrite\data\VOCdevkit2007\VOC2007
        self._classes = (
            '__background__',  # always index 0
            'aeroplane',
            'bicycle',
            'bird',
            'boat',
            'bottle',
            'bus',
            'car',
            'cat',
            'chair',
            'cow',
            'diningtable',
            'dog',
            'horse',
            'motorbike',
            'person',
            'pottedplant',
            'sheep',
            'sofa',
            'train',
            'tvmonitor')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'  #图片格式
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': use_diff,
            'matlab_eval': False,
        }

        assert os.path.exists(self._devkit_path), \
          'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
          'Path does not exist: {}'.format(self._data_path)
Beispiel #16
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        # 2007
        self._year = year
        # trainval
        self._image_set = image_set
        # data/VOCdevkit2007
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        # data/VOCdevkit2007/VOC2007
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        # 类型元组
        self._classes = (
            '__background__',  # always index 0
            'aeroplane',
            'bicycle',
            'bird',
            'boat',
            'bottle',
            'bus',
            'car',
            'cat',
            'chair',
            'cow',
            'diningtable',
            'dog',
            'horse',
            'motorbike',
            'person',
            'pottedplant',
            'sheep',
            'sofa',
            'train',
            'tvmonitor')
        # 类型和index组成的字典集合
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        # 从/VOCdevkit2007/VOC2007/ImageSets/Main/val.txt获取训练集的序号
        self._image_index = self._load_image_set_index()
        # 获取到所有的gt信息,这里没有执行这个方法
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # 配置
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, version):
        imdb.__init__(self, 'vg_' + version + '_' + image_set)
        # image_set from ['train', 'val', 'test']
        self._image_set = image_set

        self._data_path = '%s/%s' % (DEFAULT_PATH, version)
        cfg.CACHE_DIR = self._data_path

        if cfg.LIMIT_RAM:
            # used for limit memory reading mode
            self._cache_path = '%s/%s_cache' % (DEFAULT_PATH, version)
            # return path of directory
            self.region_imset_path = os.path.join(self._data_path,
                                                  '%s_gt_regions' % image_set)
        else:
            # return path of the json file
            self.region_imset_path = os.path.join(
                self._data_path, '%s_gt_regions.json' % image_set)
            self._gt_regions = json.load(open(self.region_imset_path))

        self._image_ext = '.jpg'
        print('data_path: %s' % self._data_path)

        self._classes = ('__background__', '__foreground__')

        # TODO: delete testing option
        if image_set == 'pre':
            self._image_index = [1, 2]
        else:
            self._image_index = self._load_image_set_index()
        # test for overfitting a minibatch
        if cfg.ALL_TEST:
            if image_set == 'train':
                self._image_index = self._image_index[:cfg.ALL_TEST_NUM_TRAIN]
            elif image_set == 'val':
                self._image_index = self._image_index[:cfg.ALL_TEST_NUM_VAL]
            elif image_set == 'test':
                self._image_index = self._image_index[:cfg.ALL_TEST_NUM_TEST]
            else:
                raise ValueError('Please check the name of the image set.')

        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        vocab_path = os.path.join(self._data_path, 'vocabulary.txt')
        with open(vocab_path, 'r') as f:
            self._vocabulary_inverted = [line.strip() for line in f]

        self._vocabulary = dict([
            (w, i) for i, w in enumerate(self._vocabulary_inverted)
        ])

        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, devkit_path, data_path):
        imdb.__init__(self, image_set)
        self._image_set = image_set
        self._devkit_path = devkit_path
        self._data_path = data_path
        synsets_image = sio.loadmat(
            os.path.join(self._devkit_path, 'data', 'meta_det.mat'))
        synsets_video = sio.loadmat(
            os.path.join(self._devkit_path, 'data', 'meta_vid.mat'))
        self._classes_image = ('__background__', )
        self._wnid_image = (0, )

        self._classes = ('__background__', )
        self._wnid = (0, )

        for i in xrange(200):
            self._classes_image = self._classes_image + (
                synsets_image['synsets'][0][i][2][0], )
            self._wnid_image = self._wnid_image + (
                synsets_image['synsets'][0][i][1][0], )

        for i in xrange(30):
            self._classes = self._classes + (
                synsets_video['synsets'][0][i][2][0], )
            self._wnid = self._wnid + (synsets_video['synsets'][0][i][1][0], )

        self._wnid_to_ind_image = dict(zip(self._wnid_image, xrange(201)))
        self._class_to_ind_image = dict(zip(self._classes_image, xrange(201)))

        self._wnid_to_ind = dict(zip(self._wnid, xrange(31)))
        self._class_to_ind = dict(zip(self._classes, xrange(31)))

        #check for valid intersection between video and image classes
        self._valid_image_flag = [0] * 201

        for i in range(1, 201):
            if self._wnid_image[i] in self._wnid_to_ind:
                self._valid_image_flag[i] = 1

        self._image_ext = ['.JPEG']

        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb

        # Specific config options
        self.config = {'cleanup': True, 'use_salt': True, 'top_k': 2000}

        assert os.path.exists(
            self._devkit_path), 'Devkit path does not exist: {}'.format(
                self._devkit_path)
        assert os.path.exists(
            self._data_path), 'Path does not exist: {}'.format(self._data_path)
Beispiel #19
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self.count = 0
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        #self._data_path = r'F:\faster-rcnn-3.6-F\data\VOCdevkit2007-WCQzf\VOC2007'
        self.pclslist = ['__background__']
        self.path = r'D:\Faster-R-CNN\labels_13_BJOYYX.txt'
        #self.path = label_path
        with open(self.path, 'r') as frcls:
            for line in frcls:
                line = line.split()
                self.pclslist.append(line[0])
            #print(self.pclslist)
        self._classes = tuple(self.pclslist)
        #self._classes = ('__background__',  # always index 0
        #                 'aeroplane', 'bicycle', 'bird', 'boat',
        #                 'bottle', 'bus', 'car', 'cat', 'chair',
        #                 'cow', 'diningtable', 'dog', 'horse',
        #                 'motorbike', 'person', 'pottedplant',
        #                 'sheep', 'sofa', 'train', 'tvmonitor')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'

        self._image_index = self._load_image_set_index()
        for temp_img_index in self._image_index.copy():
            temp_dict = self._change_index(temp_img_index)
            if temp_dict != 0:
                self._image_index.remove(temp_dict)

        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self,
                 image_set,
                 data_path='/home/nico/Dataset/Fabric-Final/',
                 p_id=None,
                 exclude_id=None):
        imdb.__init__(self, 'fabric_binary_' + image_set)
        assert image_set in ['test', 'train_supervised', 'train_unsupervised']
        self._image_set = image_set
        self._data_path = data_path

        # check dataset mode
        if p_id:
            # mode: single pattern
            assert exclude_id is None
            assert isinstance(p_id, int)
        elif exclude_id:
            # mode: exclude single pattern
            assert p_id is None
            assert isinstance(exclude_id, int)
        else:
            # mode: all patterns
            assert p_id is None and exclude_id is None
        self.p_id = p_id
        self.exclude_id = exclude_id

        self._classes = (
            '__background__',  # always index 0
            'defect',
        )
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        # self._roidb_handler = self.selective_search_roidb
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'fabric_binary'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._data_path), \
            'Dataset path does not exist: {}'.format(self._data_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #21
0
    def __init__(self, image_set, devkit_path):
        imdb.__init__(self, image_set)
        self._image_set = image_set
        self._devkit_path = devkit_path
        self._data_path = os.path.join(self._devkit_path, 'data')
        self._classes = (
            '__background__',  # always index 0
            'angle_01',
            'angle_02',
            'angle_03',
            'angle_04',
            'angle_05',
            'angle_06',
            'angle_07',
            'angle_08',
            'angle_09',
            'angle_10',
            'angle_11',
            'angle_12',
            'angle_13',
            'angle_14',
            'angle_15',
            'angle_16',
            'angle_17',
            'angle_18',
            'angle_19')
        self._class_to_ind = dict(zip(self.classes, range(self.num_classes)))
        self._image_ext = ['.jpg', '.png']
        self._image_index = self._load_image_set_index()
        # Default to roidb handleri
        self._roidb_handler = self.selective_search_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # Specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
                'Devkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
                'Path does not exist: {}'.format(self._data_path)
Beispiel #22
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path(
        ) if devkit_path is None else devkit_path
        # self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        # self._classes = ('__background__',  # always index 0
        #                  'aeroplane', 'bicycle', 'bird', 'boat',
        #                  'bottle', 'bus', 'car', 'cat', 'chair',
        #                  'cow', 'diningtable', 'dog', 'horse',
        #                  'motorbike', 'person', 'pottedplant',
        #                  'sheep', 'sofa', 'train', 'tvmonitor')
        self._data_path = os.path.join(self._devkit_path, 'data', 'NEU-DET',
                                       self._image_set)
        self._classes = (
            '__background__',  # always index 0
            'crazing',
            'inclusion',
            'patches',
            'pitted_surface',
            'rolled-in_scale',
            'scratches')

        self._class_to_ind = dict(zip(self.classes, range(self.num_classes)))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        # self._roidb_handler = self.selective_search_roidb
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #23
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = [
            '__background__',  # always index 0
            'n02701002',
            'n02834778',
            'n02924116',
            'n02930766',
            'n03100240',
            'n03119396',
            'n03345487',
            'n03594945',
            'n03670208',
            'n03790512',
            'n03977966',
            'n04335435',
            'n04389033',
            'n04490091',
            'n04520170'
        ]
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
            'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #24
0
    def __init__(self, image_set):
        '''
        自定义的数据集,dataset_path必须是一个目录,里面必须有两个文件夹:
        'Images',里面放置最原始的图片,不能含有其他无关文件或损坏的图片文件
        'Labels',里面放置xml文件,注,首先用LabelImg工具标注,然后将标注框分割成宽16px的切分框,
        此xml里面保存的是这些小切分框的坐标
        :param dataset_path: 该目录的绝对路径
        '''
        imdb.__init__(self, self.__class__.__name__)  # 以本类名作为数据集名称
        self._data_path = cfg.DATA_DIR
        self._image_set = image_set
        assert os.path.exists(
            self._data_path), 'Path does not exist: {}'.format(self._data_path)
        self._classes = (  # 本数据集包含的类别:bg和文本,一共两个类别
            '__background__', 'text')

        self._class_to_ind = dict(
            list(zip(self._classes, list(range(self.num_classes)))))
        # self._class_to_ind = {'__background__':0,'text':1}
        self._image_ext = '.jpg'  # Images文件夹下所有图片都是这个后缀
        self._image_index = self._load_image_set_index()
        # 获取所有图片的名称组成的list,不带.jpg等后缀
        self._roidb_handler = self.gt_roidb  # 获取所有图片的xml文件中的信息,一个list,每个元素都是dict,包含xml中的信息
        self._salt = str(
            uuid.uuid4())  # 产生随机数:eg: 'f7dfd14b-f6c5-4f23-a51a-65bd49143588'
        self._comp_id = 'comp4'  # compare_id

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,  # compare id构建时是否要加入uuid产生的随机数
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }
Beispiel #25
0
    def __init__(self, image_set, year, use_diff=False):
        name = 'voc_' + year + '_' + image_set
        if use_diff:
            name += '_diff'
        imdb.__init__(self, name)
        self._year = year
        self._image_set = image_set
        self._devkit_path = self._get_default_path()
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        if year == "2013":
            self._classes = (
                '__background__',  # always index 0
                "北汽",
                "福特",
                "斯柯达",
                "启辰",
                "本田",
                "日产",
                "凯迪拉克",
                "铃木",
                "吉利",
                "保时捷",
                "jeep",
                "宝骏",
                "荣威",
                "林肯",
                "丰田",
                "别克",
                "奇瑞",
                "起亚",
                "哈弗",
                "奥迪",
                "路虎",
                "大众",
                "广汽传祺",
                "长安",
                "名爵",
                "雷诺",
                "雷克萨斯",
                "宝马",
                "马自达",
                "奔驰")
        if year == "2014":
            self._classes = (
                '__background__',  # always index 0
                'suzuki',
                'mg',
                'nissan',
                'cadillac',
                'honda',
                'haval',
                'porsche',
                'benz',
                'mazda',
                'roewe',
                'lincoln',
                'chana',
                'lexus',
                'paojun',
                'trumpchi',
                'geely',
                'kia',
                'toyota',
                'venucia',
                'land rover',
                'volkswagen',
                'baic',
                'skoda',
                'bmw',
                'chery',
                'buick',
                'jeep',
                'ford',
                'audi',
                'renault')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': use_diff,
            'matlab_eval': False,
            'rpn_file': None
        }

        assert os.path.exists(self._devkit_path), \
          'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
          'Path does not exist: {}'.format(self._data_path)
Beispiel #26
0
    def __init__(self, image_set):
        imdb.__init__(self, 'gtea-gaze-plus')
        self._data_path = cfg.FLAGS2["data_dir"]
        if image_set == "train":
            self._list_file = osp.join(self._data_path,
                                       "train_GTEA_GAZE_PLUS_voc.txt")
        elif image_set == "val":
            self._list_file = osp.join(self._data_path,
                                       "val_GTEA_GAZE_PLUS_voc.txt")
        elif image_set == "test":
            self._list_file = osp.join(self._data_path,
                                       "test_GTEA_GAZE_PLUS_voc.txt")
        elif image_set == "train-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "train_GTEA_GAZE_PLUS_voc_wholeBB.txt")
        elif image_set == "val-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "val_GTEA_GAZE_PLUS_voc_wholeBB.txt")
        elif image_set == "test-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "test_GTEA_GAZE_PLUS_voc_wholeBB.txt")
        else:
            assert False, "{} not found in GTEA Gaze+".format(image_set)

        self._classes = (
            'none',  # always index 0
            'bacon',
            'bottle',
            'bowl',
            'bread',
            'cabinet',
            'carrot',
            'cereal',
            'cheese',
            'cheese bag',
            'cream cheese',
            'cup',
            'egg',
            'egg box',
            'faucet',
            'frying pan',
            'glove',
            'honey',
            'jam',
            'juice',
            'ketchup',
            'kettle',
            'knife',
            'mayonnaise',
            'microwave',
            'milk',
            'mushroom',
            'oil',
            'onion',
            'paper towel',
            'pasta box',
            'patty',
            'peanut butter',
            'pepper grinder',
            'pizza',
            'pizza bag',
            'plastic bag',
            'plate',
            'pot',
            'pot cover',
            'refrigerator',
            'salad dressing',
            'salt',
            'sausage',
            'slice',
            'spoon',
            'stove',
            'tea bag',
            'tomato',
            'turkey',
            'vegetable',
            'vinaigrette')

        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_list, self._annot_list = self._load_images_and_annotations(
        )
        self._image_index = self._image_list
        # DEBUG
        #for img_path, annot_path in zip(self._image_list, self._annot_list):
        #    print(img_path, annot_path)
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        self._output_dir = "output"
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
    def __init__(self, image_set, use_diff=False):
        name = 'wider_face' + '_' + image_set
        if use_diff:
            name += '_diff'
        imdb.__init__(self, name)
        self._image_set = image_set
        self._data_path = self._get_default_path()
        # self._devkit_path = self._get_default_path()
        # self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = (
            '__background__',  # always index 0
            'face')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.jpg'

        self._fp_bbox_map = {}
        self._fp_kpoint_map = {}
        self._image_index = []
        image_set_file = os.path.join(
            self._data_path, 'Annotations',
            'wider_face_' + self._image_set + '_bbx_kp.txt')
        assert os.path.exists(image_set_file), \
            'Path does not exist: {}'.format(image_set_file)
        with open(image_set_file) as f:
            annotations = f.readlines()
        if self._image_set == 'train':
            count = 0
            while count < len(annotations):
                name = str(annotations[count]).rstrip()
                self._image_index.append(name)
                self._fp_bbox_map[name] = []
                self._fp_kpoint_map[name] = []
                # self._ind_kpoint_map[name] = []
                count += 1
                n_anno = int(annotations[count])
                for i in range(n_anno):
                    count += 1
                    bbox = annotations[count].split(' ')[0:4]
                    kpoint = annotations[count].split(' ')[4:]

                    bbox = [int(round(float(x))) for x in bbox]
                    kpoint = [int(round(float(x))) for x in kpoint]
                    x1 = max(0, bbox[0])
                    y1 = max(0, bbox[1])
                    bbox[0] = x1
                    bbox[1] = y1
                    self._fp_bbox_map[name].append(bbox)
                    self._fp_kpoint_map[name].append(kpoint)
                count += 1
        else:
            for annotation in annotations:
                annotation = annotation.strip().split(' ')
                name = annotation[0]
                self._image_index.append(name)
                self._fp_bbox_map[name] = []
                self._fp_kpoint_map[name] = []
                # image_index.append(annotation[0])
                bboxes = list(map(float, annotation[1:]))
                num_objs = int(len(bboxes) / 4)
                for idx in range(num_objs):
                    xmin = float(bboxes[4 * idx])
                    ymin = float(bboxes[4 * idx + 1])
                    xmax = float(bboxes[4 * idx + 2])
                    ymax = float(bboxes[4 * idx + 3])
                    bbox = [xmin, ymin, xmax, ymax]
                    bbox = [int(round(float(x))) for x in bbox]
                    self._fp_bbox_map[name].append(bbox)
        # Default to roidb handler
        # self._image_index = [key for key, _ in self._fp_bbox_map.items()]

        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': use_diff,
            'matlab_eval': False,
            'rpn_file': None
        }

        # assert os.path.exists(self._devkit_path), \
        #   'VOCdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #28
0
    def __init__(self, version, image_set, ):
        imdb.__init__(self, 'vg_' + version + '_' + image_set)
        self._version = version
        self._image_set = image_set
        self._data_path = os.path.join(cfg.DATA_DIR, 'genome')
        self._img_path = os.path.join(cfg.DATA_DIR, 'vg')
        # VG specific config options
        self.config = {'cleanup' : False}

        # Load classes
        self._classes = ['__background__']
        self._class_to_ind = {}
        self._class_to_ind[self._classes[0]] = 0
        with open(os.path.join(self._data_path, self._version, 'objects_vocab.txt')) as f:
          count = 1
          for object in f.readlines():
            names = [n.lower().strip() for n in object.split(',')]
            self._classes.append(names[0])
            for n in names:
              self._class_to_ind[n] = count
            count += 1

        # Load attributes
        self._attributes = ['__no_attribute__']
        self._attribute_to_ind = {}
        self._attribute_to_ind[self._attributes[0]] = 0
        with open(os.path.join(self._data_path, self._version, 'attributes_vocab.txt')) as f:
          count = 1
          for att in f.readlines():
            names = [n.lower().strip() for n in att.split(',')]
            self._attributes.append(names[0])
            for n in names:
              self._attribute_to_ind[n] = count
            count += 1

        # Load relations
        self._relations = ['__no_relation__']
        self._relation_to_ind = {}
        self._relation_to_ind[self._relations[0]] = 0
        with open(os.path.join(self._data_path, self._version, 'relations_vocab.txt')) as f:
          count = 1
          for rel in f.readlines():
            names = [n.lower().strip() for n in rel.split(',')]
            self._relations.append(names[0])
            for n in names:
              self._relation_to_ind[n] = count
            count += 1


        self._image_ext = '.jpg'
        load_index_from_file = False
        if os.path.exists(os.path.join(self._data_path, "vg_image_index_{}.p".format(self._image_set))):
            with open(os.path.join(self._data_path, "vg_image_index_{}.p".format(self._image_set)), 'rb') as fp:
                self._image_index = pickle.load(fp)
            load_index_from_file = True

        load_id_from_file = False
        if os.path.exists(os.path.join(self._data_path, "vg_id_to_dir_{}.p".format(self._image_set))):
            with open(os.path.join(self._data_path, "vg_id_to_dir_{}.p".format(self._image_set)), 'rb') as fp:
                self._id_to_dir = pickle.load(fp)
            load_id_from_file = True

        if not load_index_from_file or not load_id_from_file:
            self._image_index, self._id_to_dir = self._load_image_set_index()
            with open(os.path.join(self._data_path, "vg_image_index_{}.p".format(self._image_set)), 'wb') as fp:
                pickle.dump(self._image_index, fp)
            with open(os.path.join(self._data_path, "vg_id_to_dir_{}.p".format(self._image_set)), 'wb') as fp:
                pickle.dump(self._id_to_dir, fp)

        self._roidb_handler = self.gt_roidb
    def __init__(self, image_set):
        imdb.__init__(self, 'tor-feedback')
        self._data_path = cfg.FLAGS2["data_dir"]
        if image_set == "train":
            self._list_file = osp.join(self._data_path,
                                       "train_TOR_feedback_voc.txt")
        elif image_set == "val":
            self._list_file = osp.join(self._data_path,
                                       "val_TOR_feedback_voc.txt")
        elif image_set == "test":
            self._list_file = osp.join(self._data_path,
                                       "test_TOR_feedback_voc.txt")
        elif image_set == "train-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "train_TOR_feedback_voc_wholeBB.txt")
        elif image_set == "val-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "val_TOR_feedback_voc_wholeBB.txt")
        elif image_set == "test-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "test_TOR_feedback_voc_wholeBB.txt")
        else:
            assert False, "{} not found in TEgO".format(image_set)

        self._classes = (
            'none',  # always index 0
            'baking soda',
            'caramel coffee',
            'cheetos',
            'chewy bars',
            'chicken broth',
            'coca cola',
            'diced tomatoes',
            'diet coke',
            'dill',
            'fritos',
            'lacroix apricot',
            'lacroix mango',
            'lays',
            'oregano',
            'pike place roast')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_list, self._annot_list = self._load_images_and_annotations(
        )
        self._image_index = self._image_list
        # DEBUG
        #for img_path, annot_path in zip(self._image_list, self._annot_list):
        #    print(img_path, annot_path)
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        self._output_dir = "output"
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)
Beispiel #30
0
    def __init__(self, image_set):
        imdb.__init__(self, 'tego')
        self._data_path = cfg.FLAGS2["data_dir"]
        if image_set == "train":
            self._list_file = osp.join(self._data_path, "train_TEgO_voc.txt")
        elif image_set == "val":
            self._list_file = osp.join(self._data_path, "val_TEgO_voc.txt")
        elif image_set == "test":
            self._list_file = osp.join(self._data_path, "test_TEgO_voc.txt")
        elif image_set == "train-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "train_TEgO_voc_wholeBB.txt")
        elif image_set == "val-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "val_TEgO_voc_wholeBB.txt")
        elif image_set == "test-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "test_TEgO_voc_wholeBB.txt")
        elif image_set == "train-blind":
            self._list_file = osp.join(self._data_path,
                                       "train_TEgO_blind_voc.txt")
        elif image_set == "train-sighted":
            self._list_file = osp.join(self._data_path,
                                       "train_TEgO_sighted_voc.txt")
        elif image_set == "train-blind-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "train_TEgO_blind_voc_wholeBB.txt")
        elif image_set == "train-sighted-wholeBB":
            self._list_file = osp.join(self._data_path,
                                       "train_TEgO_sighted_voc_wholeBB.txt")
        else:
            assert False, "{} not found in TEgO".format(image_set)

        self._classes = (
            'none',  # always index 0
            'airborne gum',
            'baked cheetos',
            'cheerios cereal',
            'diet coke bottle',
            'extra dry skin moisturizer',
            'grill salt',
            'hand soap',
            'mountain dew can',
            'oregano',
            'regular coke bottle',
            'sprite bottle',
            'aspirin',
            'baked lays chips',
            'chicken soup can',
            'dr pepper can',
            'great grains cereal',
            'hand sanitizer',
            'mandarin can',
            'spf55 sunscreen')
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_list, self._annot_list = self._load_images_and_annotations(
        )
        self._image_index = self._image_list
        # DEBUG
        #for img_path, annot_path in zip(self._image_list, self._annot_list):
        #    print(img_path, annot_path)
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None
        }

        self._output_dir = "output"
        assert os.path.exists(self._data_path), \
            'Path does not exist: {}'.format(self._data_path)