parameters: (self, index)
return_statement: return {'boxes': boxes,
                  'gt_classes': gt_classes,
                  'gt_overlaps': overlaps,
                  'flipped': False,
                  'seg_areas': seg_areas}
docstring: Load image and bounding boxes info from XML file in the PASCAL VOC
          format.
docstring_summary: Load image and bounding boxes info from XML file in the PASCAL VOC
          format.
docstring_tokens: Load image and bounding boxes info from XML file in the PASCAL VOC format .
function: 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')
          tree = ET.parse(filename)
          objs = tree.findall('object')
          if not self.config['use_diff']:
              # Exclude the samples labeled as difficult
              non_diff_objs = [
                  obj for obj in objs if int(obj.find('difficult').text) == 0]
              # if len(non_diff_objs) != len(objs):
              #     print 'Removed {} difficult objects'.format(
              #         len(objs) - len(non_diff_objs))
              objs = non_diff_objs
          num_objs = len(objs)
  
          # Text Quad
          boxes = np.zeros((num_objs, 8), dtype=np.uint16)
          gt_classes = np.zeros((num_objs), dtype=np.int32)
          overlaps = np.zeros((num_objs, self.num_classes), dtype=np.float32)
          # "Seg" area for pascal is just the box area
          seg_areas = np.zeros((num_objs), dtype=np.float32)
          # Load object bounding boxes into a data frame.
  
          # get img size
          im_size = tree.find('size')
          im_width = float(im_size.find('width').text)
          im_height = float(im_size.find('height').text)
  
          for ix, obj in enumerate(objs):
              bbox = obj.find('bndbox')
              #
              x1 = np.minimum(np.maximum(float(bbox.find('x1').text), 0), im_width - 1)
              y1 = np.minimum(np.maximum(float(bbox.find('y1').text), 0), im_height - 1)
              x2 = np.minimum(np.maximum(float(bbox.find('x2').text), 0), im_width - 1)
              y2 = np.minimum(np.maximum(float(bbox.find('y2').text), 0), im_height - 1)
              x3 = np.minimum(np.maximum(float(bbox.find('x3').text), 0), im_width - 1)
              y3 = np.minimum(np.maximum(float(bbox.find('y3').text), 0), im_height - 1)
              x4 = np.minimum(np.maximum(float(bbox.find('x4').text), 0), im_width - 1)
              y4 = np.minimum(np.maximum(float(bbox.find('y4').text), 0), im_height - 1)
              boxes[ix, :] = [x1, y1, x2, y2, x3, y3, x4, y4]
  
              cls = self._class_to_ind[obj.find('name').text.lower().strip()]
              gt_classes[ix] = cls
              overlaps[ix, cls] = 1.0
              seg_areas[ix] = (x2 - x1 + 1) * (y2 - y1 + 1)
  
          overlaps = scipy.sparse.csr_matrix(overlaps)
  
          return {'boxes': boxes,
                  'gt_classes': gt_classes,
                  'gt_overlaps': overlaps,
                  'flipped': False,
                  'seg_areas': seg_areas}
function_tokens: def _load_pascal_annotation ( self , index ) : filename = os . path . join ( self . _data_path , 'Annotations' , index + '.xml' ) tree = ET . parse ( filename ) objs = tree . findall ( 'object' ) if not self . config [ 'use_diff' ] : # Exclude the samples labeled as difficult non_diff_objs = [ obj for obj in objs if int ( obj . find ( 'difficult' ) . text ) == 0 ] # if len(non_diff_objs) != len(objs): #     print 'Removed {} difficult objects'.format( #         len(objs) - len(non_diff_objs)) objs = non_diff_objs num_objs = len ( objs ) # Text Quad boxes = np . zeros ( ( num_objs , 8 ) , dtype = np . uint16 ) gt_classes = np . zeros ( ( num_objs ) , dtype = np . int32 ) overlaps = np . zeros ( ( num_objs , self . num_classes ) , dtype = np . float32 ) # "Seg" area for pascal is just the box area seg_areas = np . zeros ( ( num_objs ) , dtype = np . float32 ) # Load object bounding boxes into a data frame. # get img size im_size = tree . find ( 'size' ) im_width = float ( im_size . find ( 'width' ) . text ) im_height = float ( im_size . find ( 'height' ) . text ) for ix , obj in enumerate ( objs ) : bbox = obj . find ( 'bndbox' ) # x1 = np . minimum ( np . maximum ( float ( bbox . find ( 'x1' ) . text ) , 0 ) , im_width - 1 ) y1 = np . minimum ( np . maximum ( float ( bbox . find ( 'y1' ) . text ) , 0 ) , im_height - 1 ) x2 = np . minimum ( np . maximum ( float ( bbox . find ( 'x2' ) . text ) , 0 ) , im_width - 1 ) y2 = np . minimum ( np . maximum ( float ( bbox . find ( 'y2' ) . text ) , 0 ) , im_height - 1 ) x3 = np . minimum ( np . maximum ( float ( bbox . find ( 'x3' ) . text ) , 0 ) , im_width - 1 ) y3 = np . minimum ( np . maximum ( float ( bbox . find ( 'y3' ) . text ) , 0 ) , im_height - 1 ) x4 = np . minimum ( np . maximum ( float ( bbox . find ( 'x4' ) . text ) , 0 ) , im_width - 1 ) y4 = np . minimum ( np . maximum ( float ( bbox . find ( 'y4' ) . text ) , 0 ) , im_height - 1 ) boxes [ ix , : ] = [ x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 ] cls = self . _class_to_ind [ obj . find ( 'name' ) . text . lower ( ) . strip ( ) ] gt_classes [ ix ] = cls overlaps [ ix , cls ] = 1.0 seg_areas [ ix ] = ( x2 - x1 + 1 ) * ( y2 - y1 + 1 ) overlaps = scipy . sparse . csr_matrix ( overlaps ) return { 'boxes' : boxes , 'gt_classes' : gt_classes , 'gt_overlaps' : overlaps , 'flipped' : False , 'seg_areas' : seg_areas }