(all_boxes, test_imgid_list, det_save_dir)
:param all_boxes: is a list. each item reprensent the detections of a img.
  the detections is a array. shape is [-1, 7]. [category, score, x, y, w, h, theta]
  Note that: if none detections in this img. that the detetions is : []

  :param test_imgid_list:
  :param det_save_path:
  :return:
def write_voc_results_file(all_boxes, test_imgid_list, det_save_dir):
  '''

  :param all_boxes: is a list. each item reprensent the detections of a img.
  the detections is a array. shape is [-1, 7]. [category, score, x, y, w, h, theta]
  Note that: if none detections in this img. that the detetions is : []

  :param test_imgid_list:
  :param det_save_path:
  :return:
  '''
  for cls, cls_id in NAME_LABEL_MAP.items():
    if cls == 'back_ground':
      continue
    print("Writing {} VOC resutls file".format(cls))

    tools.mkdir(det_save_dir)
    det_save_path = os.path.join(det_save_dir, "det_"+cls+".txt")
    with open(det_save_path, 'wt') as f:
      for index, img_name in enumerate(test_imgid_list):
        this_img_detections = all_boxes[index]

        this_cls_detections = this_img_detections[this_img_detections[:, 0] == cls_id]
        if this_cls_detections.shape[0] == 0:
          continue # this cls has none detections in this img
        for a_det in this_cls_detections:
          f.write('{:s} {:.3f} {:.1f} {:.1f} {:.1f} {:.1f} {:.1f}\n'.
                  format(img_name, a_det[1],
                         a_det[2], a_det[3],
                         a_det[4], a_det[5], a_det[6]))
def write_voc_results_file ( all_boxes , test_imgid_list , det_save_dir ) : for cls , cls_id in NAME_LABEL_MAP . items ( ) : if cls == 'back_ground' : continue print ( "Writing {} VOC resutls file" . format ( cls ) ) tools . mkdir ( det_save_dir ) det_save_path = os . path . join ( det_save_dir , "det_" + cls + ".txt" ) with open ( det_save_path , 'wt' ) as f : for index , img_name in enumerate ( test_imgid_list ) : this_img_detections = all_boxes [ index ] this_cls_detections = this_img_detections [ this_img_detections [ : , 0 ] == cls_id ] if this_cls_detections . shape [ 0 ] == 0 : continue # this cls has none detections in this img for a_det in this_cls_detections : f . write ( '{:s} {:.3f} {:.1f} {:.1f} {:.1f} {:.1f} {:.1f}\n' . format ( img_name , a_det [ 1 ] , a_det [ 2 ] , a_det [ 3 ] , a_det [ 4 ] , a_det [ 5 ] , a_det [ 6 ] ) )