def yolo5_postprocess_np(yolo_outputs, image_shape, anchors, num_classes, model_image_size, max_boxes=100, confidence=0.1, iou_threshold=0.4, elim_grid_sense=True): predictions = yolo5_decode(yolo_outputs, anchors, num_classes, input_dims=model_image_size, elim_grid_sense=elim_grid_sense) predictions = yolo_correct_boxes(predictions, image_shape, model_image_size) boxes, classes, scores = yolo_handle_predictions( predictions, image_shape, max_boxes=max_boxes, confidence=confidence, iou_threshold=iou_threshold, use_cluster_nms=True) boxes = yolo_adjust_boxes(boxes, image_shape) return boxes, classes, scores
def yolo3_postprocess_np(yolo_outputs, image_shape, anchors, num_classes, model_input_shape, max_boxes=100, confidence=0.1, iou_threshold=0.4, elim_grid_sense=False): # here we sort the prediction tensor list with grid size (e.g. 19/38/76) # to make sure it matches with anchors order yolo_outputs.sort(key=lambda x: x.shape[1]) predictions = yolo3_decode(yolo_outputs, anchors, num_classes, input_shape=model_input_shape, elim_grid_sense=elim_grid_sense) predictions = yolo_correct_boxes(predictions, image_shape, model_input_shape) boxes, classes, scores = yolo_handle_predictions( predictions, image_shape, num_classes, max_boxes=max_boxes, confidence=confidence, iou_threshold=iou_threshold) boxes = yolo_adjust_boxes(boxes, image_shape) return boxes, classes, scores
def yolo2_postprocess_np(yolo_outputs, image_shape, anchors, num_classes, model_input_shape, max_boxes=100, confidence=0.1, iou_threshold=0.4, elim_grid_sense=False): scale_x_y = 1.05 if elim_grid_sense else None predictions = yolo_decode(yolo_outputs, anchors, num_classes, input_shape=model_input_shape, scale_x_y=scale_x_y, use_softmax=True) predictions = yolo_correct_boxes(predictions, image_shape, model_input_shape) boxes, classes, scores = yolo_handle_predictions( predictions, image_shape, num_classes, max_boxes=max_boxes, confidence=confidence, iou_threshold=iou_threshold) boxes = yolo_adjust_boxes(boxes, image_shape) return boxes, classes, scores
def yolo2_postprocess_np(yolo_outputs, image_shape, anchors, num_classes, model_image_size, max_boxes=100, confidence=0.1, iou_threshold=0.4): predictions = yolo_head(yolo_outputs, anchors, num_classes, input_dims=model_image_size, use_softmax=True) predictions = yolo_correct_boxes(predictions, image_shape, model_image_size) boxes, classes, scores = yolo_handle_predictions(predictions, image_shape, max_boxes=max_boxes, confidence=confidence, iou_threshold=iou_threshold) boxes = yolo_adjust_boxes(boxes, image_shape) return boxes, classes, scores