def get_infer_results(outs_res, eval_type, catid): """ Get result at the stage of inference. The output format is dictionary containing bbox or mask result. For example, bbox result is a list and each element contains image_id, category_id, bbox and score. """ if outs_res is None or len(outs_res) == 0: raise ValueError( 'The number of valid detection result if zero. Please use reasonable model and check input data.' ) infer_res = {} if 'bbox' in eval_type: box_res = [] for outs in outs_res: box_res += get_det_res(outs['bbox'], outs['bbox_num'], outs['im_id'], catid) infer_res['bbox'] = box_res if 'mask' in eval_type: seg_res = [] for outs in outs_res: seg_res += get_seg_res(outs['mask'], outs['bbox_num'], outs['im_id'], catid) infer_res['mask'] = seg_res return infer_res
def get_infer_results(outs, catid): """ Get result at the stage of inference. The output format is dictionary containing bbox or mask result. For example, bbox result is a list and each element contains image_id, category_id, bbox and score. """ if outs is None or len(outs) == 0: raise ValueError( 'The number of valid detection result if zero. Please use reasonable model and check input data.' ) im_id = outs['im_id'] infer_res = {} if 'bbox' in outs: infer_res['bbox'] = get_det_res(outs['bbox'], outs['score'], outs['label'], outs['bbox_num'], im_id, catid) if 'mask' in outs: # mask post process infer_res['mask'] = get_seg_res(outs['mask'], outs['score'], outs['label'], outs['bbox_num'], im_id, catid) if 'segm' in outs: infer_res['segm'] = get_solov2_segm_res(outs, im_id, catid) return infer_res
def get_infer_results(outs_res, eval_type, catid): """ Get result at the stage of inference. The output format is dictionary containing bbox or mask result. For example, bbox result is a list and each element contains image_id, category_id, bbox and score. """ if outs_res is None or len(outs_res) == 0: raise ValueError( 'The number of valid detection result if zero. Please use reasonable model and check input data.' ) infer_res = {k: [] for k in eval_type} for i, outs in enumerate(outs_res): im_id = outs['im_id'] im_shape = outs['im_shape'] scale_factor = outs['scale_factor'] if 'bbox' in eval_type: infer_res['bbox'] += get_det_res(outs['bbox'], outs['bbox_num'], im_id, catid) if 'mask' in eval_type: # mask post process infer_res['mask'] += get_seg_res(outs['mask'], outs['bbox_num'], im_id, catid) return infer_res