yolov5 servitization optimization (#262)

* yolov5 split pre and post process

* yolov5 postprocess

* yolov5 postprocess
This commit is contained in:
heliqi
2022-09-21 05:22:39 -05:00
committed by GitHub
parent 463ee0a088
commit a8e447f225
9 changed files with 194 additions and 77 deletions

View File

@@ -37,6 +37,31 @@ class YOLOv5(FastDeployModel):
return self._model.predict(input_image, conf_threshold,
nms_iou_threshold)
@staticmethod
def preprocess(input_image,
size=[640, 640],
padding_value=[114.0, 114.0, 114.0],
is_mini_pad=False,
is_no_pad=False,
is_scale_up=False,
stride=32,
max_wh=7680.0,
multi_label=True):
return C.vision.detection.YOLOv5.preprocess(
input_image, size, padding_value, is_mini_pad, is_no_pad,
is_scale_up, stride, max_wh, multi_label)
@staticmethod
def postprocess(infer_result,
im_info,
conf_threshold=0.25,
nms_iou_threshold=0.5,
multi_label=True,
max_wh=7680.0):
return C.vision.detection.YOLOv5.postprocess(
infer_result, im_info, conf_threshold, nms_iou_threshold,
multi_label, max_wh)
# 一些跟YOLOv5模型有关的属性封装
# 多数是预处理相关可通过修改如model.size = [1280, 1280]改变预处理时resize的大小前提是模型支持
@property