Beispiel #1
0
  def __init__(self, image_set, year, use_diff=False):
    name = 'icpr_' + year + '_' + image_set
    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, 'image_10000')
    self._xml_path  = os.path.join(self._devkit_path, 'xml_10000')
    self._classes = ('__background__',  # always index 0
                     'text')
    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, devkit_path=None):
        imdb.__init__(self, image_set)
        self._image_set = image_set
        self._devkit_path = devkit_path
        self._data_path = os.path.join(self._devkit_path, 'total')
        self._classes = ('__background__', # always index 0
                         '_1', '_2', '_3', '_4',
                         '_5', '_6', '_7', '_8', '_9',
                         '_10', '_11', '_12')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.png'
        # self._image_index = self._load_image_set_index()
        # self._image_index = [x for x in range(1056)]
        self._image_index = self._load_image_set_index('ImageList_train.txt')
        # Default to roidb handler
        self._roidb_handler = self.selective_search_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 #3
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, sdha_cfg.stream_name)
        self._classes = ('__background__')

        if sdha_cfg.category == 2:
            self._classes = sdha_cfg.two_category
        elif sdha_cfg.category == 7:
            self._classes = sdha_cfg.seven_category
        else:
            pass
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = ['.npy']
        self._image_index = self._load_image_set_index()
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

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

        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 #4
0
    def __init__(self, image_set):
        imdb.__init__(self, 'imagenet')
        self._image_set = image_set
        self._data_path = os.path.join(cfg.DATA_DIR, "imagenet")
        
        self._class_wnids = [
            ('background', 'background'),
            ('cup', 'n03147509'),
            ('glasses', 'n04272054'),
            ('tool', 'n04451818'),
            ('laptop', 'n03642806'),
            ('chair', 'n03001627')
        ]
        self._classes = tuple([class_[0] for class_ in self._class_wnids])
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        print(self._class_to_ind)
        self._xml_path = os.path.join(self._data_path, "Annotations")
        self._image_ext = '.JPEG'
	# the xml file name and each one corresponding to image file name
        self._image_index = self._load_xml_filenames()
        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._data_path), \
                'Path does not exist: {}'.format(self._data_path)
Beispiel #5
0
    def __init__(self, image_set, year):
        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 = osp.join(cfg.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(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.set_proposal_method('selective_search')
        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'}
        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if self._view_map.has_key(coco_name)
                           else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')
Beispiel #6
0
    def __init__(self, image_set, devkit_path):
        imdb.__init__(self, 'pipa_' + image_set)
        #self._year = year
        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
                         'head')
        self._class_to_ind = dict(zip(self.classes, xrange(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._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)
    def __init__(self, image_set, year, config=None):
        imdb.__init__(self, 'caltech_ped_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        
        self._data_path = self._get_default_path()
        self._classes = ('__background__', # always index 0
                         'person', 'ignore')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.png'
        self._image_index = self._load_image_set_index()
        		
	# Default to roidb handler
        self._roidb_handler = self.rpn_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp1'		# usage?

        # Caltech specific config options: Reasonable (default) for training
	# pLoad={'lbls',{'person'},'ilbls',{'people'},'squarify',{3,.41}, ...
	#		'hRng',[50 inf], 'vRng',[1 1]};		
        self.config = {'labels'      : ['person'],
                       'ign_labels'  : ['people'],
                       'squarify'    : [3, 0.41],                       
                       'vRng'        : [1, 1],
		       'xRng'        : [0, 640],
		       'yRng'        : [0, 480],
		       'wRng' 	     : [-np.inf, np.inf],
		       'hRng'        : [50, np.inf],
                       'use_flip'    : True
		       'matlab_eval' : False}
		
		# To do: write config-merge code
        
        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
                         '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()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_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 #9
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'coco_ori_' + year + '_' + image_set)
        self._year = year
        self._devkit_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        self._data_path = self._devkit_path

        clasnum = 80
        classes = ['__background__']
        for i in range(clasnum):
          classes.append(str(i + 1))
        self._classes=tuple(classes)


        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_type = 'images';
        self._image_set = image_set;
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self.set_proposal_method('mcg')
        self._salt = str(uuid.uuid4())

        # PASCAL specific config options
        self.config = {'top_k' : 2000,
                       'use_salt' : True,
                       'cleanup' : True,
                       'crowd_thresh' : 0.7,
                       '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 #10
0
  def __init__(self, image_set):
    imdb.__init__(self, 'coco_text_' + image_set)
    self._image_set = image_set
    self._data_path = osp.join(cfg.DATA_DIR, 'coco_text', image_set)
    self._classes = ('__background__',  # always index 0
                     'frame')
    self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
    self._image_ext = '.jpg'
    if 'dragonball' in image_set:
      self._image_ext = '.png'
    self._image_index = self._load_image_name()
    # Default to roidb handler
    self._roidb_handler = self.selective_search_roidb
    self._salt = str(uuid.uuid4())

    # 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), \
      'Path does not exist: {}'.format(self._data_path)
Beispiel #11
0
    def __init__(self, image_set, devkit_path):
        imdb.__init__(self,"INRIA_Person_" + image_set)
        self._image_set = image_set
        self._devkit_path = devkit_path
        if image_set == 'train':
            self._data_path = os.path.join(self._devkit_path, 'data')
        else:
            self._data_path = os.path.join(self._devkit_path, 'testData')
        self._classes = ('__background__', # always index 0
                         'person')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = ['.jpg', '.png']
        self._image_index = self._load_image_set_index()
        self._list_of_output_detection_results = {}

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

        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 #12
0
    def __init__(self, image_set, version):
        imdb.__init__(self, 'vg_' + version+ '_' + image_set)
        self._image_set = image_set
        
        self._data_path  = '%s/%s' % (DEFAULT_PATH, version) 
        cfg.CACHE_DIR = self._data_path 
        self._image_ext = '.jpg'
        print 'data_path: %s' % self._data_path
        region_imset_path = os.path.join(self._data_path, '%s_gt_regions.json' % image_set)
        self._classes = ('__background__', '__foreground__')
        print 'loading from %s' % region_imset_path
        self._gt_regions = json.load(open(region_imset_path))
        #print self._gt_regions.items()[0]
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.rpn_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)
Beispiel #13
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'nyud2_images_' + year + '_' + image_set)
        self._year = 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, 'data')
        
        self._classes = ('__background__', # always index 0
            'bathtub', 'bed', 'bookshelf', 'box', 'chair', 'counter', 'desk',
            'door', 'dresser', 'garbage-bin', 'lamp', 'monitor', 'night-stand',
            'pillow', 'sink', 'sofa', 'table', 'television', 'toilet');

        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_type = 'images';
        self._image_set = image_set;
        self._image_ext = '.png'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.mcg_roidb
        self._salt = str(uuid.uuid4())

        # 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 #14
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)
        # Brent (2016/06/08) - read from file (rather than hard-coded here and in classification script)
        # FIXME: specify model (or labels file in cfg)
        self._classes = ['__background__'] + readLines('/opt/dev/proj/sony/research/py-faster-rcnn/lib/datasets/pascal_voc_labels.txt')
        self._class_to_ind = dict(zip(self.classes, xrange(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._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 #15
0
    def __init__(self, image_set, loc, devkit_path=None):
        imdb.__init__(self, 'joy_' + loc + '_' + image_set)
        self._loc = loc
        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, 'Joy' + self._loc)
        self._classes = ('__background__', # always index 0
                        "鸡蛋","玉米","茄子-长","茄子-圆","番茄","胡萝卜",
			"青椒-长","青椒-圆","冬瓜","黄瓜","苦瓜","丝瓜",
			"西葫芦","洋葱","蒜苔","青菜","菜花","西兰花",
			"菠菜","芹菜","生菜","莴笋","空心菜","苹果","梨",
			"葡萄","橙","金针菇","平菇","香菇","酸奶","豆腐")
        self._class_to_ind = dict(zip(self.classes, xrange(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._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 #16
0
    def __init__(self):
        imdb.__init__(self, 'wider')
        self._data_path = self._get_default_path()

        self.db = CuteReader(os.path.join(self._data_path, 'wider-imdb'))

        self._image_width = []
        self._image_height = []

        self._classes = ('__background__', # always index 0
                         'face')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        # max indexes not including flipped images
        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,
                       'min_size'    : 2}
    def __init__(self, devkit_path=None):
        # voc_2007_test
        imdb.__init__(self, 'person_head')
        self._devkit_path = '/data2/yichaoxiong/data/youtu'
        self._image_set = 'test'
        self._data_path = os.path.join(self._devkit_path, self.name)
        self._classes = ('__background__', # always index 0
                         'person', 'head')
        self._class_to_ind = dict(zip(self.classes, xrange(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._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        self.config = {'cleanup'     : False,
                       '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 #18
0
  def __init__(self, image_set, devkit_path):
        imdb.__init__(self, image_set)
#         pdb.set_trace()
        print image_set
        self._image_set = image_set
        self._devkit_path = devkit_path
        if image_set == 'train':
          self._data_path = os.path.join(self._devkit_path)
        else:
          self._data_path = os.path.join(self._devkit_path)
        #self.annotations_file = '/home/will/dev/py-faster-rcnn/hover/rcnn_tri_box_sz' 
        self.annotations_file = '/home/will/dev/py-faster-rcnn/hover/rcnn_tri_box_with_buffer_test' 
        self._classes = ('__background__', # always index 0
                         'gable',
                         )
        print 'number of classes: ', self.num_classes
        self._class_to_ind = dict(zip(self.classes, xrange(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

        # Specific config options
        self.config = {'cleanup'  : True,
                       'use_diff' : False,
                       'use_salt' : True,
                       'rpn_file' : None }
                       #'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, name, root_path='custom'):
        imdb.__init__(self, 'custom_' + name + '_' + image_set)
        self._image_set = image_set
        self._root_path = os.path.join(cfg.DATA_DIR, root_path)
        self._data_path = os.path.join(self._root_path, name)
        self._image_path = os.path.join(self._root_path, name, 'images')
        self._label_path = os.path.join(self._root_path, name, 'labels')
        self._classes = ('__background__', # always index 0
                        '0', '1', '2', '3', '4')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        self._salt = str(uuid.uuid4())

        self.config = {'cleanup'     : True,
                       'use_salt'    : True,
                       'rpn_file'    : None,
                       'min_size'    : 2}

        assert os.path.exists(self._root_path), \
               'Custom root path does not exist: {}'.format(self._root_path)
        assert os.path.exists(self._data_path), \
               'Data path does not exist: {}'.format(self._data_path)
        assert os.path.exists(self._image_path), \
               'Image path does not exist: {}'.format(self._image_path)
        assert os.path.exists(self._label_path), \
               'Label path does not exist: {}'.format(self._label_path)
    def __init__(self, image_set,  devkit_path=None):
        imdb.__init__(self, 'grotoap2_' + '_' + image_set) # change name here
        self._year = 2007
        self._image_set = image_set
        self._devkit_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        self._data_path = self._get_default_path()

        # Set your zones here
        self._classes = ('__background__', # always index 0
                         'title', 'abstract', 'acknowledgment', 'affiliation', 'author',
                         'bib_info', 'body', 'body_content', 'conflict_statement', 'copyright', 'correspondence',
                         'dates', 'editor', 'equation', 'figure', 'glossary', 'keywords', 'page_number', 'references',
                         'table', 'title_author', 'type', 'unknown')
        self._class_to_ind = dict(zip(self.classes, xrange(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._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 #21
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'voc3_' + year + '_' + image_set)
        self._year = year
        self._devkit_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        self._data_path = self._devkit_path

        clasnum = 20 * 2
        classes = ['__background__']
        for i in range(clasnum):
          classes.append(str(i + 1))
        self._classes=tuple(classes)


        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_type = 'images';
        self._image_set = image_set;
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_roidb
        self._salt = str(uuid.uuid4())

        # 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 #22
0
    def __init__(self, image_set, PHASE, mat_annot_file=None):
        imdb.__init__(self, image_set, PHASE)
        if PHASE == 'TRAIN':
            self._image_set = './action_experiments/listfiles/' + image_set + '.trainlist'  # you need a full path for image list and data path
        else:
            self._image_set = './action_experiments/listfiles/' + image_set + '.testlist'
        self._USE_MAT_GT = mat_annot_file != None
        self._annot_path = "/home/lear/xpeng/data/UCF101/UCF101_24_Annotations"  # you only have annotations in RGB data folder
        if 'RGB' in image_set and 'FLOW' in image_set:
            self._data_path = '/home/lear/xpeng/data/UCF101/flows_color'
        else:
            self._MOD = image_set.split('_')[1]
            self._LEN = image_set.split('_')[2]
            self._data_path = None
            if self._MOD == 'RGB':
                self._data_path = '/home/lear/xpeng/data/UCF101/frames_240'
            if self._MOD == 'FLOW':
                self._data_path = '/home/lear/xpeng/data/UCF101/flows_color'

        self._classes = ('__background__', 'Basketball', 'BasketballDunk',
                         'Biking', 'CliffDiving', 'CricketBowling', 'Diving',
                         'Fencing', 'FloorGymnastics', 'GolfSwing',
                         'HorseRiding', 'IceDancing', 'LongJump', 'PoleVault',
                         'RopeClimbing', 'SalsaSpin', 'SkateBoarding',
                         'Skiing', 'Skijet', 'SoccerJuggling', 'Surfing',
                         'TennisSwing', 'TrampolineJumping',
                         'VolleyballSpiking', 'WalkingWithDog')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._img_format = ''  # it will update after load image set index
        self._image_index = self._load_image_set_index(
        )  # get the temporal anotation

        self.test_videos = sorted([
            l.split()[0][:-4] for l in file(
                './action_experiments/listfiles/UCF101_video_testlist01.txt')
        ])
        self.train_videos = sorted([
            l.split()[0][:-4] for l in file(
                './action_experiments/listfiles/UCF101_video_trainlist01.txt')
        ])
        self.videos = sorted([
            l.split()[0][:-4] for l in file(
                "./action_experiments/listfiles/UCF101_video_trainlist01.txt")
        ] + self.test_videos)
        self.video_to_label = {
            v: self._class_to_ind[v.split('/')[0]]
            for v in self.videos
        }

        if mat_annot_file:
            self._mat_gt = self.get_mat_gt(mat_annot_file)
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb
Beispiel #23
0
    def __init__(self, split, wider_path=None):
        self._test_flag = True if split == 'test' else False
        self._split = split
        imdb.__init__(self, 'wider_' + split)
        self._image_set = split


        self._annotation_file_name = 'wider_face_test_filelist.txt' if self._test_flag else \
            'wider_face_{}_bbx_gt.txt'.format(split)

        if wider_path is None:
            self._dataset_path = self._get_default_path()
        else:
            self._dataset_path = wider_path
        self._imgs_path = os.path.join(self._dataset_path,
                                       'JPEGImages/wider_{}'.format(split),
                                       'images')

        # Read the annotations file
        anno_path = os.path.join(os.path.join(DATA_DIR,
                                              'facedata'), 'wider_face_split',
                                 self._annotation_file_name)
        assert os.path.isfile(
            anno_path), 'Annotation file not found {}'.format(anno_path)
        self._fp_bbox_map = {}
        with open(anno_path, 'r') as file:
            annos = file.readlines()

        self._fp_bbox_map = {}
        count = 0
        if not self._test_flag:
            while count < len(annos):
                name = str(annos[count]).rstrip()
                self._fp_bbox_map[name] = []
                count += 1
                n_anno = int(annos[count])
                for i in xrange(n_anno):
                    count += 1
                    bbox = annos[count].split(' ')[0:4]
                    bbox = [int(round(float(x))) for x in bbox]
                    x1 = max(0, bbox[0])
                    y1 = max(0, bbox[1])
                    self._fp_bbox_map[name].append(
                        [x1, y1, x1 + bbox[2], y1 + bbox[3]])
                count += 1
            self._image_paths = self._fp_bbox_map.keys()
        else:
            self._image_paths = []
            for path in annos:
                self._image_paths.append(str(path).rstrip())

        self._image_index = range(len(self._image_paths))
        self._classes = ['bg', 'face']
Beispiel #24
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 = os.environ['HOME'] + '/data/Object_Detection/pascal/VOCdevkit'
        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._devkit_path = '/workspace/mnt/group/general-reg/zhuriheng/github/code_zrh/caffe/img-det/refinedet/experiment/train_model_refinedet_res18_320x320/eval'
        self._data_path = os.path.join(self._devkit_path, 'VOC' + self._year)
        self._classes = (
            '__background__',  # always index 0
            'tibetan_flag',
            'gongzhang_logo',
            'BK_LOGO',
            'taiwan_bairiqi_flag',
            'isis_flag',
            'not_terror_card_text',
            'not_terror',
            'knives',
            'guns',
            'card',
            'islamic_flag',
            'china_guoqi_flag')

        self._class_to_ind = dict(zip(self.classes, xrange(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._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 #25
0
 def __init__(self, image_set, devkit_path=None):
     imdb.__init__(self, image_set)
     self._image_set = image_set
     self._devkit_path = devkit_path
     self._data_path = os.path.join(self._devkit_path)
     self._classes = ('__background__', 'person')
     self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
     self._image_index = self._load_image_set_index('ImageList_MOT.txt')
     self._roidb_handler = self.gt_roidb
     self.config = {'cleanup': True, 'use_salt': True, 'top_k': 2000}
     assert os.path.exists(
         devkit_path), 'data path dose not exist: {}'.format(devkit_path)
Beispiel #26
0
    def __init__(self,
                 image_set,
                 obj_attr_type,
                 devkit_path=None,
                 aux_path=None,
                 use_attrs=False,
                 is_smol=False):
        self.obj_attr_type = obj_attr_type
        imdb.__init__(
            self, 'IRSG_{}_{}{}'.format(image_set, self.obj_attr_type,
                                        '_smol' if is_smol else ''))
        self._image_set = image_set
        self._devkit_path = (self._get_default_path()
                             if devkit_path is None else devkit_path)
        self._aux_path = (self._get_default_aux_path()
                          if aux_path is None else aux_path)
        self.train_image_path = os.path.join(self._devkit_path,
                                             'sg_train_images')
        self.test_image_path = os.path.join(self._devkit_path,
                                            'sg_test_images')
        self._classes = self._load_classes(is_smol=is_smol)
        self._class_to_ind = dict(zip(self.classes, range(self.num_classes)))
        self._roidb_handler = self.rpn_roidb
        train_anno_path = os.path.join(self._devkit_path,
                                       'sg_train_annotations.json')
        test_anno_path = os.path.join(self._devkit_path,
                                      'sg_test_annotations.json')

        with open(train_anno_path) as f:
            print('loading train annotations...')
            self.train_annotations = self._filter_annotations(json.load(f))
        with open(test_anno_path) as f:
            print('loading test annotations...')
            self.test_annotations = self._filter_annotations(json.load(f))

        train_size = len(self.train_annotations)
        test_size = len(self.test_annotations)
        if image_set is 'train':
            self.annotations = self.train_annotations
            self.image_path = self.train_image_path
            self._image_index = self._get_image_index('train')
        elif image_set is 'val':
            self.annotations = self.train_annotations
            self.image_path = self.train_image_path
            self._image_index = self._get_image_index('val')
        elif image_set is 'test':
            self.annotations = self.test_annotations
            self.image_path = self.test_image_path
            self._image_index = self._get_image_index('test')
        else:
            error_format = ('invalid image set name \'{}\': only'
                            '\'train\' and \'test\' are allowed')
            raise ValueError(error_format.format(image_set))
Beispiel #27
0
    def __init__(self, image_set, year):
        imdb.__init__(self, 'fovea_' + 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.DATA_DIR, 'fovea')
        # load COCO API, classes, class <-> id mappings
        self._COCO = COCO(self._get_ann_file())
        """
        self._COCO.getCatIds()  --->  [1, 2, 3, ...91]
        cats = self._COCO.loadCats(self._COCO.getCatIds())      --->   [{"supercategory": "person", "id": 1, "name": "person"},..., {"supercategory": "person", "id": 1, "name": "person"}]
        self._classes = ('__background__', "person", "bicycle", "car", "motorcycle", ..., "toothbrush")         
        self._class_to_ind = {'__background__':0, "person":1, ..., "tothbrush":92}
        self._class_to_coco_cat_id = {"person":1, ..., "tothbrush":92}
        self._image_index = [img_id1, img_id2, ..., img_idN]

        self.roidb_handler = self.gt_roidb  #Return the database of ground-truth regions of interest.


        """
        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',
        }
        fovea_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[fovea_name]
                           if fovea_name in self._view_map else fovea_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val')

        with open(self._get_ann_file(), 'r') as annfile:
            load_dict = json.load(annfile)
            self.image_paths = {}
            for idx, ann in enumerate(load_dict['images']):
                self.image_paths[str(ann['id'])] = ann['file_name']
Beispiel #28
0
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'nyud3_images_' + year + '_' + image_set)
        self._year = 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, 'data')

        self._classes = (
            '__background__',  # always index 0
            'bathtub',
            'bed',
            'bookshelf',
            'box',
            'chair',
            'counter',
            'desk',
            'door',
            'dresser',
            'garbage-bin',
            'lamp',
            'monitor',
            'night-stand',
            'pillow',
            'sink',
            'sofa',
            'table',
            'television',
            'toilet',
            'hard_background')

        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_type = 'images'
        self._image_set = image_set
        self._image_ext = '.png'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.mcg_roidb
        self._salt = str(uuid.uuid4())

        # 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 #29
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)
        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._roidb_handler is another name of the function self.gt_roidb. As defined in the imdb.py ,when using the self.roidb, roidb=self._roidb_handler()
        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 #30
0
    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)
    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'
        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 #32
0
    def __init__(self, image_set, year):
        imdb.__init__(self, 'sg_vrd_vp_' + year + '_' + image_set)
        #self._image_set_path = 'imagenet_' + year + '_' + image_set
        self._year = year
        self._image_set = image_set
        self._folder_path = self._image_set
        #to handle splitted datasets so that we don't have to symlink for every splits
        if 'train' in self._image_set: self._folder_path = 'train'

        self._devkit_path = os.path.join(self._get_default_path(), 'devkit')
        self._data_path = os.path.join(self._get_default_path(), 'Data',
                                       self._folder_path)
        self._annot_path = os.path.join(self._get_default_path(),
                                        'Annotations', self._folder_path)

        self._classes = ()  # always index 0
        self._class_name = ()  # always index 0
        self._class_ids = ()  # always index 0
        self.m = h5py.File('/home/zawlin/Dropbox/proj/sg_vrd_vp_meta.h5', 'r',
                           'core')
        for i in range(len(self.m['meta/tri/idx2name/'].keys())):
            self._classes += (str(self.m['meta/tri/idx2name/' +
                                         str(i)][...]), )
            self._class_name += (str(self.m['meta/tri/idx2name/' +
                                            str(i)][...]), )
            self._class_ids += (str(self.m['meta/tri/idx2name/' +
                                           str(i)][...]), )
        self._class_to_ind = dict(zip(self._classes, xrange(self.num_classes)))
        self._class_to_ind.update(
            dict(zip(self._class_ids, xrange(self.num_classes))))
        self._class_to_ind = dict(zip(self._classes, xrange(self.num_classes)))
        self._class_to_ind.update(
            dict(zip(self._class_ids, xrange(self.num_classes))))
        self._image_ext = '.jpg'
        self._image_index, self._image_id = self._load_image_set_index()
        self._wh = self._load_image_width_height()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_roidb

        # PASCAL specific config options
        self.config = {
            'cleanup': True,
            'use_salt': True,
            'top_k': 2000,
            'use_diff': False,
            'rpn_file': None
        }
        assert os.path.exists(self._data_path), \
            'sg_vrd data path does not exist: {}'.format(self._data_path)
        if self._image_set != 'test':
            assert os.path.exists(self._annot_path), \
                'sg_vrd annotation path does not exist: {}'.format(self._annot_path)
Beispiel #33
0
    def __init__(self, image_set, year):

        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 = osp.join(cfg.DATA_DIR, 'coco')
        # load COCO API, classes, class <-> id mappings
        self._COCO = COCO(self._get_ann_file())

        cats = self._COCO.loadCats(cfg.TRAIN.CAT_IDS)

        # if the list in the cfg file is empty, use all possible category IDs

        if cfg.TRAIN.CAT_IDS == []:
            cfg.TRAIN.CAT_IDS = self._COCO.getCatIds()
            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], cfg.TRAIN.CAT_IDS))

        print str(self._class_to_coco_cat_id)

        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self.set_proposal_method('selective_search')
        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
        }
        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if self._view_map.has_key(coco_name) else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')
Beispiel #34
0
 def __init__(self, data_conf, common_conf, conf):
     imdb.__init__(self, data_conf, common_conf, conf)
     self._classes = ('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, range(self.num_classes)))
     self._image_set = data_conf['image_set']
     self._image_index = self._load_image_set_idex()
     self._all_image_paths = self.all_img_paths()
     self._cache_file = self.cache_file()
     self.debug()
 def __init__(self, datasetName, imageSet, configName):
     imdb.__init__(self, datasetName)
     self._local_path = os.path.dirname(__file__)
     self._datasetName = datasetName
     self._configName = configName
     self._image_set = imageSet
     self._image_index = []
     self._convertIdToCls = None
     self._obj_proposer = 'gt'
     self._roidb = None
     self._roidb_handler = self.gt_roidb
     self._roidbSize = []
     self._parseDatasetFile()
Beispiel #36
0
    def __init__(self, split, wider_path=None):
        self._test_flag = False
        self._split = split
        imdb.__init__(self, 'wider_' + split)
        self._image_set = split
        if wider_path is None:
            self._dataset_path = self._get_default_path()
        else:
            self._dataset_path = wider_path
        self._imgs_path = os.path.join(self._dataset_path,
                                       'WIDER_{}'.format(split), 'images')
        csv_path = os.path.join(self._dataset_path, 'WIDER_{}'.format(split),
                                'imglist.csv')

        if not os.path.exists(csv_path) and split != 'test':
            path = os.path.join(os.path.dirname(__file__), '..', '..',
                                'matlab')
            cmd = 'cd {} && '.format(path)
            cmd += 'matlab -nodisplay -nodesktop '
            cmd += '-r "dbstop if error; '
            cmd += 'wider_csv(\'{:s}\',\'{:s}\',\'{:s}\'); quit;"' \
                .format(self._dataset_path, split,
                        csv_path)
            print('Running:\n{}'.format(cmd))
            status = subprocess.call(cmd, shell=True)
        elif split == 'test':
            self._test_flag = True

        self._fp_bbox_map = {}
        prev_file = 'blah'
        with open(csv_path, 'r') as f:
            reader = csv.reader(f)
            if not self._test_flag:
                for row in reader:
                    if row[0] != prev_file:
                        self._fp_bbox_map[row[0]] = []
                    prev_file = row[0]

                    x1 = max(0, int(row[1]))
                    y1 = max(0, int(row[2]))
                    w = int(row[3])
                    h = int(row[4])
                    self._fp_bbox_map[row[0]].append([x1, y1, x1 + w, y1 + h])
                self._image_paths = self._fp_bbox_map.keys()
            else:
                self._image_paths = []
                for row in reader:
                    self._image_paths.append(row[0])

        self._image_index = range(len(self._image_paths))
        self._classes = ['_bg', 'face']
    def __init__(self, image_set, name, kaist_path=None, kaist_classes=None):
        imdb.__init__(self, 'kaist_' + name + '_' + image_set)
        self._name = name
        self._image_set = image_set

        ##### CONFIGURATION ############################################################################################
        if kaist_path == None:
            ### *** HOME ***
            #self._kaist_path = '{}/data/KAIST'.format(os.environ['HOME'])                                               # kaist_path usually given from 'factory.py'
            ### *** WORK ***
            self._kaist_path = '/net4/merkur/storage/deeplearning/users/gueste/data/KAIST'  # kaist_path usually given from 'factory.py'
        ################################################################################################################
        else:
            self._kaist_path = kaist_path

        self._ImageSets_path = os.path.join(self._kaist_path, self._name)
        #self._ImageData_path    = os.path.join(self._kaist_path, 'data-kaist', 'test-all')
        self._ImageData_path = None
        self._Annotations_path = None
        #self._classes = ('__background__', # always index 0
        #                 'person')
        self._classes = kaist_classes if not kaist_classes == None else (
            '__background__', 'person')  # Usually given from 'factory.py'
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.png'
        self._use_07_metric = False  # Shoult be 'False' in order to ensure correct calculation of Average Precision
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_roidb
        self._salt = str(uuid.uuid4()).split('-')[
            0]  # Modified to use only first UUID part (shorter)
        self._comp_id = 'comp4'  # DEFAULT: '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._kaist_path), \
                'KAIST path does not exist: {}'.format(self._kaist_path)
        assert os.path.exists(self._ImageSets_path), \
                'Path does not exist: {}'.format(self._ImageSets_path)
        assert os.path.exists(self._ImageData_path), \
                'Path does not exist: {}'.format(self._ImageData_path)
        assert os.path.exists(self._Annotations_path), \
                'Path does not exist: {}'.format(self._Annotations_path)
Beispiel #38
0
    def __init__(self, image_set, use_diff=False):
        name = 'kitti_' + image_set
        if use_diff:
            name += '_diff'
        imdb.__init__(self, name)
        self._year = 0
        self._image_set = image_set
        self._devkit_path = self._get_default_path()
        # my
        #--------------------------------------------------------------------------
        self._devkit_path = os.path.join(cfg.DATA_DIR, 'kitti_devkit')
        #--------------------------------------------------------------------------
        self._data_path = os.path.join(self._devkit_path, 'kitti')
        self._classes = (
            '__background__',  # always index 0
            #-------------------------------------------------------------------------
            # voc datasets
            #                 'aeroplane', 'bicycle', 'bird',
            #                 'boat', 'bottle', 'bus', 'car',
            #                 'cat', 'chair', 'cow', 'diningtable',
            #                 'dog', 'horse', 'motorbike', 'person',
            #                 'pottedplant', 'sheep', 'sofa', 'train',
            #                 'tvmonitor'
            #---------------------------------------------------------------------------
            #---------------------------------------------------------------------------
            # kitti datatets
            'car'
            #---------------------------------------------------------------------------
        )
        self._class_to_ind = dict(
            list(zip(self.classes, list(range(self.num_classes)))))
        self._image_ext = '.png'
        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), \
          'kittidevkit 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, 'DeepScoresV2' + year + '_' + image_set)
    self._year = year
    self._devkit_path = self._get_default_path() if devkit_path is None \
      else devkit_path

    self._image_set = image_set

    self._data_path = self._devkit_path + "/images"

    self.blacklist = ["staff", 'legerLine']


    self.o = OBBAnns(self._devkit_path+'/deepscores_'+image_set+'.json')
    self.o.load_annotations()
    print(self.o.annotation_sets)
    self.o.set_annotation_set_filter(['deepscores'])
    self.o.set_class_blacklist(self.blacklist)

    self._classes = [v["name"] for (k, v) in self.o.get_cats().items()]
    self._class_ids = [k for (k, v) in self.o.get_cats().items()]

    self._class_to_ind = dict(list(zip(self.classes, list(range(self.num_classes)))))
    self._class_ids_to_ind = dict(list(zip(self._class_ids, list(range(self.num_classes)))))
    self._ind_to_class_ids = {v: k for k, v in self._class_ids_to_ind.items()}

    self._image_index = self._load_image_set_index()

    # self.cat_ids = list(self.o.get_cats().keys())
    # self.cat2label = {
    #   cat_id: i
    #   for i, cat_id in enumerate(self.cat_ids)
    # }
    # self.label2cat = {v: k for k, v in self.cat2label.items()}
    # self.CLASSES = tuple([v["name"] for (k, v) in self.o.get_cats().items()])
    # self.img_ids = [id['id'] for id in self.o.img_info]


    self._image_ext = '.png'

    # 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}
    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)
        # if not set_classes, set in here
        if self._classes == []:

            self._classes = (
                '__background__',  # always index 0,'player','football',
                #                         'pillar')
                'Croissant',
                'Pineapple',
                'Coconut',
                'Cheese',
                'Baguette',
                'Walnut',
                'PorkFloss'
            )  #'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
            #                         '0','1','2','3',
            #                         '4','5','6','7','8','9')
            #'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()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_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 #41
0
    def __init__(self, image_set, year):

        imdb.__init__(self, 'coco_' + year + '_' + image_set)

        self._year = year
        self._image_set = image_set
        self._data_path = osp.join(cfg.DATA_DIR, 'coco')

        # load COCO API, classes, class <-> id mappings
        self._COCO = COCO(self._get_instances_ann_file())
        self._image_index = self._load_image_set_index()
        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()))

        # 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
        }
        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if self._view_map.has_key(coco_name) else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')
        self._roidb = self.gt_roidb()
        self.filter_roidb()

        file_path = osp.join(
            self._data_path,
            self._image_set + self._year + '_filtered_persons.txt')
        assert osp.exists(file_path), 'Path does not exist: {}'.format(
            file_path)
        self._cand_objs = set(np.loadtxt(file_path, dtype=str))

        if cfg.TRAIN.USE_FLIPPED:
            print 'Appending horizontally-flipped examples...'
            self.append_flipped_images()
            print 'done'

        self.permute_roidb_indices()
        print('roidb entries: {}'.format(len(self._roidb)))

        self._objdb = self.gt_objdb()
        self.permute_objdb_indices()
        print('objdb entries: {}'.format(len(self._objdb)))
Beispiel #42
0
 def __init__(self, image_set, devkit_path=None):
     imdb.__init__(self, 'FDDB_' + 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)
     self._classes = (
         '__background__',  # always index 0
         'face')
     self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
     self._image_ext = '.jpg'
     self._image_index = self._load_image_set_index()
     # 32202 images and 393703 faces
     print 'fddb image size = {}'.format(len(self._image_index))
    def __init__(self, image_set, year, devkit_path=None):
        imdb.__init__(self, 'sun_' + year + '_' + image_set)
        self._year = year
        self._image_set = image_set
        self._anno_set_dir = image_set
        if "val" in image_set:
            if "val1" in image_set:
                self._anno_set_dir = "val1"
            if "val2" in image_set:
                self._anno_set_dir = "val2"
        elif "train" in image_set:
            self._anno_set_dir = "train"
        elif "test" in image_set:
            self._anno_set_dir = "test"

        self._devkit_path = self._get_default_path() if devkit_path is None \
                            else devkit_path
        self._data_path = os.path.join(self._devkit_path, 'SUN' + self._year)

        self._classes = (
            '__background__',  # always index 0
            'person')

        self._class_to_ind = dict(zip(self.classes, xrange(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._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'
        self._image_path = os.path.join(self._data_path, 'JPEGImages',
                                        '{}' + self._image_ext)

        self.dataset_name = "sun"  # for index class

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

        assert os.path.exists(self._devkit_path), \
                'SUN path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
                'Path does not exist: {}'.format(self._data_path)
Beispiel #44
0
    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.DATA_DIR, 'simulated')
        # load COCO API, classes, class <-> id mappings
        if image_set == 'train':
            # self._COCO = COCO('/home/tony/datasets/simulated_data/annotations/train.json')
            self._COCO = COCO(
                osp.join(self._data_path, 'annotations', 'train.json'))
        else:
            # self._COCO = COCO('/home/tony/datasets/simulated_data/annotations/test.json')
            self._COCO = COCO(
                osp.join(self._data_path, 'annotations', 'test.json'))
        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',
        #   'valminuscapval2014': 'val2014',
        #   'capval2014': 'val2014',
        #   'captest2014': 'val2014'
        # }
        # 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)
        if image_set == 'train':
            self._data_name = 'simulated2020'
        else:
            self._data_name = 'unseen_simulated2020'
        self._gt_splits = ('train', 'val', 'minival')
 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'
     self._image_index, self._id_to_dir = self._load_image_set_index()
Beispiel #46
0
    def __init__(self, image_set, devkit_path=None):
        imdb.__init__(self, 'kitti_' + '_' + 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, 'data_object_image_2/training/image_2')
        self._classes = ('__background__','Car', 'Van', 'Truck', 'Cyclist','Pedestrian', 'Person_sitting', 'Tram', 'Misc' ,'DontCare')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.png'
        self._image_index = self._load_image_set_index()

        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'
        assert os.path.exists(self._devkit_path), 'Kitti path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), 'Path does not exist: {}'.format(self._data_path)
Beispiel #47
0
    def __init__(self, image_set, devkit_path=None):
        imdb.__init__(self, 'ir_' + image_set)
        self._year = 0
        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, 'ir')

        ## COCO CLASSES ##
        #self._classes =('__background__',
        #		'person', 'bicycle', 'car', 'motorcycle', 'airplane',
        #		'bus','train', 'truck', 'boat', 'traffic light',
        #		'fire hydrant', 'stop sign', 'parking meter','bench', 'bird',
        #		'cat', 'dog', 'horse', 'sheep', 'cow',
        #		'elephant', 'bear', 'zebra', 'giraffe', 'backpack',
        #		'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
        #		'skis', 'snowboard', 'sports ball', 'kite','baseball bat',
        #		'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle',
        #		'wine glass', 'cup', 'fork', 'knife', 'spoon',
        #		'bowl', 'banana', 'apple', 'sandwich', 'orange',
        #		'broccoli','carrot', 'hot dog', 'pizza', 'donut',
        #		'cake', 'chair', 'couch', 'potted plant', 'bed',
        #		'dining table','toilet', 'tv', 'laptop', 'mouse',
        #		'remote', 'keyboard', 'cell phone', 'microwave', 'oven',
        #		'toaster', 'sink', 'refrigerator', 'book', 'clock',
        #		'vase', 'scissors', 'teddy bear', 'hair drier','toothbrush')
        self._classes = ('__background__', 'tv')
        #self._classes = ('__background__', 'tv')
        self._class_to_ind = dict(zip(self.classes, xrange(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._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), \
                'IR 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 #48
0
    def __init__(self):
        imdb.__init__(self, 'coco21trainval_voc0712trainval')
        self.data_root = '/home/prmct/Database/'
        self.imageset_root = '/home/prmct/Database/MSCOCO/annotations/'
        self.source = 'coco21trainval_voc0712trainval_image2xml.txt'
        self.img_set = 'coco21trainval_voc0712trainval.txt'

        assert os.path.exists(self.data_root), \
                'Data root path does not exist: {}'.format(self.data_root)
        assert os.path.exists(self.imageset_root), \
                'Image set root path does not exist: {}'.format(self.imageset_root)

        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_index = self._load_image_set_index
        self.image_path_list = []
        self.xml_path_list = []
        self._load_image_xml_path()
        self._roidb_handler = self.gt_roidb

        self.config = {
            'cleanup': False,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }
Beispiel #49
0
    def __init__(self, datasetName, cls_order, cls_mapper=None, sets="train"):

        name = "openImages_v4"
        #FOR DEBUGGING
        self.debugging = True

        self.sets = sets

        imdb.__init__(self, name)

        self._data_path = '/root/data/data-openImages_v4'

        #CLS_mapper,labelList =  self.parseConfig()
        print cls_order
        if cls_mapper == None:
            tempMapper = {}
            for i in cls_order:
                tempMapper[i] = i
            cls_mapper = tempMapper

        print cls_mapper
        self.CLS_mapper = cls_mapper
        namedAnnotation, annotation, target_imgs = self.getAnnotation(
            cls_order, cls_mapper, sets)

        tempClass = []
        for i in cls_order:
            if cls_mapper.has_key(i):
                if cls_mapper.get(i) not in tempClass:
                    tempClass.append(cls_mapper.get(i))
            elif i not in tempClass:
                tempClass.append(i)

        self._classes = tempClass
        self._num_classes = len(tempClass)

        self._annotation = annotation

        self._class_to_ind = dict(zip(self._classes,
                                      xrange(self._num_classes)))

        self.original_classes = self.get_original_classes()

        meta_data_path = os.path.join(self._data_path, "meta.json")
        self._meta = load_meta(meta_data_path)
        self._image_ext = self._meta["format"]
        self._image_ext = '.jpg'
        self._image_index = target_imgs
        self._imageSizeMap = self._mappedImgSize()
        print "images set loaded"
Beispiel #50
0
 def __init__(self, image_set):
     name = "learnit_db" + "_" + image_set
     imdb.__init__(self, name)
     self._classes = (
         '__background__',  # always index 0
         'box')
     self._data_path = os.path.join(cfg.DATA_DIR, 'learnit_db')
     self._class_to_ind = dict(
         list(zip(self.classes, list(range(self.num_classes)))))
     self._image_set = image_set
     self._image_index = self._load_image_set_index()
     # Default to roidb handler
     self._roidb_handler = self.gt_roidb
     self._image_ext = '.jpg'
Beispiel #51
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
            'Basketball',
            'Biking',
            'CricketBowling',
            'Fencing',
            'GolfSwing',
            'IceDancing',
            'PoleVault',
            'SalsaSpin',
            'Skiing',
            'SoccerJuggling',
            'TennisSwing',
            'VolleyballSpiking',
            'BasketballDunk',
            'CliffDiving',
            'Diving',
            'FloorGymnastics',
            'HorseRiding',
            'LongJump',
            'RopeClimbing',
            'SkateBoarding',
            'Skijet',
            'Surfing',
            'TrampolineJumping',
            'WalkingWithDog')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

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

        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 #52
0
    def __init__(self, image_set, devkit_path=None):
        imdb.__init__(self, 'celeba_' + 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, 'CelebA')
        self._classes = (
            '__background__',  # always index 0
            'eye',
            'nose',
            'mouth',
            'upper',
            'lower',
            'face')
        self._face_attributes_name = (
            '5_o_Clock_Shadow', 'Arched_Eyebrows', 'Attractive',
            'Bags_Under_Eyes', 'Bald', 'Bangs', 'Big_Lips', 'Big_Nose',
            'Black_Hair', 'Blond_Hair', 'Blurry', 'Brown_Hair',
            'Bushy_Eyebrows', 'Chubby', 'Double_Chin', 'Eyeglasses', 'Goatee',
            'Gray_Hair', 'Heavy_Makeup', 'High_Cheekbones', 'Male',
            'Mouth_Slightly_Open', 'Mustache', 'Narrow_Eyes', 'No_Beard',
            'Oval_Face', 'Pale_Skin', 'Pointy_Nose', 'Receding_Hairline',
            'Rosy_Cheeks', 'Sideburns', 'Smiling', 'Straight_Hair',
            'Wavy_Hair', 'Wearing_Earrings', 'Wearing_Hat', 'Wearing_Lipstick',
            'Wearing_Necklace', 'Wearing_Necktie', 'Young')
        self._class_to_ind = dict(zip(self.classes, xrange(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._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'

        # PASCAL specific config options
        # min_size here means the minimum size of the boxes to keep
        # cleanup means whether to clean up the voc results file or not
        self.config = {
            'cleanup': False,
            'use_salt': True,
            'use_diff': False,
            'matlab_eval': False,
            'rpn_file': None,
            'min_size': 2
        }

        assert os.path.exists(self._devkit_path), \
                'CelebAdevkit path does not exist: {}'.format(self._devkit_path)
        assert os.path.exists(self._data_path), \
                'Path does not exist: {}'.format(self._data_path)
Beispiel #53
0
    def __init__(self, image_set, year):

        imdb.__init__(self, 'coco_' + year + '_' + image_set)

        self._year      = year
        self._image_set = image_set
        self._data_path = osp.join(cfg.DATA_DIR, 'coco')

        # load COCO API, classes, class <-> id mappings
        self._COCO = COCO(self._get_instances_ann_file())
        self._image_index = self._load_image_set_index()
        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()))

        # 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
        }
        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if self._view_map.has_key(coco_name)
                           else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')
        self._roidb = self.gt_roidb()
        self.filter_roidb()

        file_path = osp.join(self._data_path, self._image_set+self._year+'_filtered_persons.txt')
        assert osp.exists(file_path), 'Path does not exist: {}'.format(file_path)
        self._cand_objs = set(np.loadtxt(file_path, dtype=str))
         
        if cfg.TRAIN.USE_FLIPPED:
            print 'Appending horizontally-flipped examples...'
            self.append_flipped_images()
            print 'done'

        self.permute_roidb_indices()
        print('roidb entries: {}'.format(len(self._roidb)))

        self._objdb = self.gt_objdb()
        self.permute_objdb_indices()
        print('objdb entries: {}'.format(len(self._objdb)))
    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(zip(self.classes, xrange(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._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 #55
0
    def __init__(self, image_set, devkit_path=None):
        imdb.__init__(self, image_set)
        self._image_set = image_set
        self._devkit_path2 = '/media/dey/debidatd/pascal3d/PASCAL/VOCdevkit/'
        self._devkit_path =  '/media/dey/debidatd/pascal3d/'
        self._data_path = '/media/dey/debidatd/pascal3d/Images/'#os.path.join(self._devkit_path, 'data')
        self._classes = ('__background__', # always index 0
                         'aeroplane',
                         'bicycle',
                         'boat',
                         'bottle',
                         'bus',
                         'car',
                         'chair',
                         'diningtable',
                         'motorbike',
                         'sofa',
                         'train',
                         'tvmonitor')
        #self._classes = ['__background__']
        #for i in xrange(1,len(self._pseudo_classes)):
        #    for j in xrange(24):
        #        self._classes.append(self._pseudo_classes[i]+'_'+str(j))
        #self._classes = tuple(self._classes)
        #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()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_roidb
        self._salt = str(uuid.uuid4())
        self._comp_id = 'comp4'
        self._year = '2012'
        # 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), \
                'Devkit path does not exist: {}'.format(self._devkit_path)
Beispiel #56
0
    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)
    def __init__(self, split, wider_path=None):
        self._test_flag = True if split == 'test' else False
        self._split = split
        imdb.__init__(self, 'wider_' + split)
        self._image_set = split


        self._annotation_file_name = 'wider_face_test_filelist.txt' if self._test_flag else \
            'wider_face_{}_bbx_gt.txt'.format(split)

        if wider_path is None:
            self._dataset_path = self._get_default_path()
        else:
            self._dataset_path = wider_path
        self._imgs_path = os.path.join(self._dataset_path, 'WIDER_{}'.format(split), 'images')

        # Read the annotations file
        anno_path = os.path.join(self._dataset_path,'wider_face_split',self._annotation_file_name)
        assert os.path.isfile(anno_path), 'Annotation file not found {}'.format(anno_path)
        self._fp_bbox_map = {}
        with open(anno_path, 'r') as file:
            annos = file.readlines()

        self._fp_bbox_map = {}
        count = 0
        if not self._test_flag:
            while count < len(annos):
                name = str(annos[count]).rstrip()
                self._fp_bbox_map[name] = []
                count += 1
                n_anno = int(annos[count])
                for i in xrange(n_anno):
                    count += 1
                    bbox = annos[count].split(' ')[0:4]
                    bbox = [int(round(float(x))) for x in bbox]
                    x1 = max(0, bbox[0])
                    y1 = max(0, bbox[1])
                    self._fp_bbox_map[name].append([x1, y1, x1 + bbox[2], y1 + bbox[3]])
                count += 1
            self._image_paths = self._fp_bbox_map.keys()
        else:
            self._image_paths = []
            for path in annos:
                self._image_paths.append(str(path).rstrip())

        self._image_index = range(len(self._image_paths))
        self._classes = ['bg', 'face']
Beispiel #58
0
    def __init__(self, image_set, kitti_path=None):
        imdb.__init__(self, 'kitti_' + image_set)
        self._image_set = image_set
        self._kitti_path = self._get_default_path() if kitti_path is None \
                            else kitti_path
        self._data_path = os.path.join(self._kitti_path, 'data_object_image_2')
        self._classes = ('__background__', 'Pedestrian', 'Car', 'Cyclist')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.png'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.gt_roidb

        assert os.path.exists(self._kitti_path), \
                'KITTI path does not exist: {}'.format(self._kitti_path)
        assert os.path.exists(self._data_path), \
                'Path does not exist: {}'.format(self._data_path)
Beispiel #59
0
    def __init__(self, version, image_set, devkit_path="caltech-pedestrian-dataset-converter"):
        imdb.__init__(self,'caltech_pedestrian_' + image_set)
        self.version = version
        
        self.config = {"include_all_classes":False, "include_background": False}
        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("data",self._devkit_path, 'data')
        self._classes = ('__background__', # always index 0
                         'person')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        annotation_path = os.path.join(self._data_path, "annotations.json")
        assert os.path.exists(annotation_path), \
                'Annotation path does not exist.: {}'.format(annotation_path)
         

        self._annotation = json.load(open(annotation_path))
        
        
        self._image_ext = '.jpg'
        self._image_index = self._load_image_set_index()
        # Default to roidb handler
        self._roidb_handler = self.selective_search_roidb
        self._salt = str(uuid.uuid4())
        #


       
        '''
        # Caltech Pedestrain specific config options
        self.config = {'cleanup'     : True,
                       'use_salt'    : True,
                       'use_diff'    : False,
                       'matlab_eval' : False,
                       'rpn_file'    : None,
                       'min_size'    : 2}
        '''
        #not usre if I should keep this line
        #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):
        imdb.__init__(self, str(image_set))
        self._image_set = image_set
        self._data_path = data_path
        self._classes = ('__background__',  # always index 0
                         'TrafficSign', 'TrafficLight', 'StreetNumber', 'StreetName', 'BusinessName', 'StreetNumberRange', 'SecondaryUnitDesignator', 'None')
        self._class_to_ind = dict(zip(self.classes, xrange(self.num_classes)))
        self._image_ext = '.jpg'
        self._label_ext = '_labeled.xml'
        self._image_index = self._load_image_set_index()

        # Default to roidb handler
        self.set_proposal_method('selective_search')
        self.competition_mode(False)

        # Put any IEI-specific config options here
        self.config = {'cleanup': True}

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