(self, index)
return {'boxes' : boxes,
                'gt_classes': gt_classes,
                'gt_overlaps' : overlaps,
                'flipped' : False}
Load image and bounding boxes info from XML file in the PASCAL VOC
        format.
Load image and bounding boxes info from XML file in the PASCAL VOC
        format.
Load image and bounding boxes info from XML file in the PASCAL VOC format .
def _load_pascal_annotation(self, index):
        """
        Load image and bounding boxes info from XML file in the PASCAL VOC
        format.
        """
        filename = os.path.join(self._data_path, 'Annotations', index + '.xml')
        def get_data_from_tag(node, tag):
            return node.getElementsByTagName(tag)[0].childNodes[0].data

        with open(filename) as f:
            data = minidom.parseString(f.read())

        objs = data.getElementsByTagName('object')
        num_objs = len(objs)
        #print self.num_classes
        boxes = np.zeros((num_objs, 4), dtype=np.uint16)
        gt_classes = np.zeros((num_objs), dtype=np.int32)
        overlaps = np.zeros((num_objs, self.num_classes), dtype=np.float32)
        # Load object bounding boxes into a data frame.
        for ix, obj in enumerate(objs):
            # Make pixel indexes 0-based
            x1 = float(get_data_from_tag(obj, 'xmin')) - 1
            y1 = float(get_data_from_tag(obj, 'ymin')) - 1
            x2 = float(get_data_from_tag(obj, 'xmax')) - 1
            y2 = float(get_data_from_tag(obj, 'ymax')) - 1
            cls = self._class_to_ind[
                   str(get_data_from_tag(obj, "name")).lower().strip()]
            boxes[ix, :] = [x1, y1, x2, y2]
            gt_classes[ix] = cls
            overlaps[ix, cls] = 1.0

        return {'boxes' : boxes,
                'gt_classes': gt_classes,
                'gt_overlaps' : overlaps,
                'flipped' : False}
def _load_pascal_annotation ( self , index ) : filename = os . path . join ( self . _data_path , 'Annotations' , index + '.xml' ) def get_data_from_tag ( node , tag ) : return node . getElementsByTagName ( tag ) [ 0 ] . childNodes [ 0 ] . data with open ( filename ) as f : data = minidom . parseString ( f . read ( ) ) objs = data . getElementsByTagName ( 'object' ) num_objs = len ( objs ) #print self.num_classes boxes = np . zeros ( ( num_objs , 4 ) , dtype = np . uint16 ) gt_classes = np . zeros ( ( num_objs ) , dtype = np . int32 ) overlaps = np . zeros ( ( num_objs , self . num_classes ) , dtype = np . float32 ) # Load object bounding boxes into a data frame. for ix , obj in enumerate ( objs ) : # Make pixel indexes 0-based x1 = float ( get_data_from_tag ( obj , 'xmin' ) ) - 1 y1 = float ( get_data_from_tag ( obj , 'ymin' ) ) - 1 x2 = float ( get_data_from_tag ( obj , 'xmax' ) ) - 1 y2 = float ( get_data_from_tag ( obj , 'ymax' ) ) - 1 cls = self . _class_to_ind [ str ( get_data_from_tag ( obj , "name" ) ) . lower ( ) . strip ( ) ] boxes [ ix , : ] = [ x1 , y1 , x2 , y2 ] gt_classes [ ix ] = cls overlaps [ ix , cls ] = 1.0 return { 'boxes' : boxes , 'gt_classes' : gt_classes , 'gt_overlaps' : overlaps , 'flipped' : False }