[Model] Support PaddleYOLOv8 model (#1136)

This commit is contained in:
DefTruth
2023-01-13 20:15:48 +08:00
committed by GitHub
parent 8d789162b3
commit 4e2102ada5
5 changed files with 266 additions and 0 deletions

View File

@@ -490,6 +490,31 @@ class PaddleYOLOv7(PPYOLOE):
assert self.initialized, "PaddleYOLOv7 model initialize failed."
class PaddleYOLOv8(PPYOLOE):
def __init__(self,
model_file,
params_file,
config_file,
runtime_option=None,
model_format=ModelFormat.PADDLE):
"""Load a YOLOv8 model exported by PaddleDetection.
:param model_file: (str)Path of model file, e.g yolov8/model.pdmodel
:param params_file: (str)Path of parameters file, e.g yolov8/model.pdiparams, if the model_fomat is ModelFormat.ONNX, this param will be ignored, can be set as empty string
:param config_file: (str)Path of configuration file for deployment, e.g yolov8/infer_cfg.yml
:param runtime_option: (fastdeploy.RuntimeOption)RuntimeOption for inference this model, if it's None, will use the default backend on CPU
:param model_format: (fastdeploy.ModelForamt)Model format of the loaded model
"""
super(PPYOLOE, self).__init__(runtime_option)
assert model_format == ModelFormat.PADDLE, "PaddleYOLOv8 model only support model format of ModelFormat.Paddle now."
self._model = C.vision.detection.PaddleYOLOv8(
model_file, params_file, config_file, self._runtime_option,
model_format)
assert self.initialized, "PaddleYOLOv8 model initialize failed."
class RTMDet(PPYOLOE):
def __init__(self,
model_file,