lib/datasets/imagenetVID_PLUS.py
def gt_roidb(self):
        """
        Return the database of ground-truth regions of interest.
        This function loads/saves from/to a cache file to speed up future calls.
        The roidb is list of list of shape (cat_num, vid_num, img_num)
        """
        cache_file = os.path.join(self.cache_path, self.name + '_gt_roidb.pkl')
        print(cache_file)

        if os.path.exists(cache_file):
            with open(cache_file, 'rb') as fid:
                roidb = pickle.load(fid)
            print('{} gt roidb loaded from {}'.format(self.name, cache_file))
            return roidb

        gt_roidb = []
        for img_idx in self.image_index:
            gt_roidb.append(self._load_imagenet_annotation(img_idx))

        roidb = gt_roidb
        for i in range(len(self.image_index)):
            roidb[i]['img_id'] = self.image_id_at(i)
            roidb[i]['image'] = self.image_path_at(i)
            size = PIL.Image.open(roidb[i]['image']).size
            roidb[i]['width'] = size[0]
            roidb[i]['height'] = size[1]
            # need gt_overlaps as a dense array for argmax
            gt_overlaps = roidb[i]['gt_overlaps'].toarray()
            # max overlap with gt over classes (columns)
            max_overlaps = gt_overlaps.max(axis=1)
            # gt class that had the max overlap
            max_classes = gt_overlaps.argmax(axis=1)
            roidb[i]['max_classes'] = max_classes
            roidb[i]['max_overlaps'] = max_overlaps
            # sanity checks
            # max overlap of 0 => class should be zero (background)
            zero_inds = np.where(max_overlaps == 0)[0]
            assert all(max_classes[zero_inds] == 0)
            # max overlap > 0 => class should not be zero (must be a fg class)
            nonzero_inds = np.where(max_overlaps > 0)[0]
            assert all(max_classes[nonzero_inds] != 0)

        with open(cache_file, 'wb') as fid:
            pickle.dump(gt_roidb, fid, pickle.HIGHEST_PROTOCOL)
        print('wrote gt roidb to {}'.format(cache_file))
        return gt_roidb

        Return the database of ground-truth regions of interest.
        This function loads/saves from/to a cache file to speed up future calls.
        The roidb is list of list of shape (cat_num, vid_num, img_num)
        
Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls.
The roidb is list of list of shape (cat_num, vid_num, img_num)
Return the database of ground - truth regions of interest . This function loads / saves from / to a cache file to speed up future calls . The roidb is list of list of shape ( cat_num vid_num img_num )
def gt_roidb(self):
        cache_file = os.path.join(self.cache_path, self.name + '_gt_roidb.pkl')
        print(cache_file)
        if os.path.exists(cache_file):
            with open(cache_file, 'rb') as fid:
                roidb = pickle.load(fid)
            print('{} gt roidb loaded from {}'.format(self.name, cache_file))
            return roidb
        gt_roidb = []
        for img_idx in self.image_index:
            gt_roidb.append(self._load_imagenet_annotation(img_idx))
        roidb = gt_roidb
        for i in range(len(self.image_index)):
            roidb[i]['img_id'] = self.image_id_at(i)
            roidb[i]['image'] = self.image_path_at(i)
            size = PIL.Image.open(roidb[i]['image']).size
            roidb[i]['width'] = size[0]
            roidb[i]['height'] = size[1]
            gt_overlaps = roidb[i]['gt_overlaps'].toarray()
            max_overlaps = gt_overlaps.max(axis=1)
            max_classes = gt_overlaps.argmax(axis=1)
            roidb[i]['max_classes'] = max_classes
            roidb[i]['max_overlaps'] = max_overlaps
            zero_inds = np.where(max_overlaps == 0)[0]
            assert all(max_classes[zero_inds] == 0)
            nonzero_inds = np.where(max_overlaps > 0)[0]
            assert all(max_classes[nonzero_inds] != 0)
        with open(cache_file, 'wb') as fid:
            pickle.dump(gt_roidb, fid, pickle.HIGHEST_PROTOCOL)
        print('wrote gt roidb to {}'.format(cache_file))
        return gt_roidb
def gt_roidb ( self ) : cache_file = os . path . join ( self . cache_path , self . name + '_gt_roidb.pkl' ) print ( cache_file ) if os . path . exists ( cache_file ) : with open ( cache_file , 'rb' ) as fid : roidb = pickle . load ( fid ) print ( '{} gt roidb loaded from {}' . format ( self . name , cache_file ) ) return roidb gt_roidb = [ ] for img_idx in self . image_index : gt_roidb . append ( self . _load_imagenet_annotation ( img_idx ) ) roidb = gt_roidb for i in range ( len ( self . image_index ) ) : roidb [ i ] [ 'img_id' ] = self . image_id_at ( i ) roidb [ i ] [ 'image' ] = self . image_path_at ( i ) size = PIL . Image . open ( roidb [ i ] [ 'image' ] ) . size roidb [ i ] [ 'width' ] = size [ 0 ] roidb [ i ] [ 'height' ] = size [ 1 ] gt_overlaps = roidb [ i ] [ 'gt_overlaps' ] . toarray ( ) max_overlaps = gt_overlaps . max ( axis = 1 ) max_classes = gt_overlaps . argmax ( axis = 1 ) roidb [ i ] [ 'max_classes' ] = max_classes roidb [ i ] [ 'max_overlaps' ] = max_overlaps zero_inds = np . where ( max_overlaps == 0 ) [ 0 ] assert all ( max_classes [ zero_inds ] == 0 ) nonzero_inds = np . where ( max_overlaps > 0 ) [ 0 ] assert all ( max_classes [ nonzero_inds ] != 0 ) with open ( cache_file , 'wb' ) as fid : pickle . dump ( gt_roidb , fid , pickle . HIGHEST_PROTOCOL ) print ( 'wrote gt roidb to {}' . format ( cache_file ) ) return gt_roidb
Return the database of ground-truth regions of interest.
Return the database of ground - truth regions of interest .
"""
        Return the database of ground-truth regions of interest.
        This function loads/saves from/to a cache file to speed up future calls.
        The roidb is list of list of shape (cat_num, vid_num, img_num)
        """ # need gt_overlaps as a dense array for argmax # max overlap with gt over classes (columns) # gt class that had the max overlap # sanity checks # max overlap of 0 => class should be zero (background) # max overlap > 0 => class should not be zero (must be a fg class)
self