[Model] Add DecodeProcess For PPDet (#1127)

* 更新ppdet

* 更新ppdet

* 更新ppdet

* 更新ppdet

* 更新ppdet

* 新增ppdet_decode

* 更新多batch支持

* 更新多batch支持

* 更新多batch支持

* 更新注释内容

* 尝试解决pybind问题

* 尝试解决pybind的问题

* 尝试解决pybind的问题

* 重构代码

* 重构代码

* 重构代码

* 按照要求修改

* 修复部分bug
加入pybind

* 修复pybind

* 修复pybind错误的问题
This commit is contained in:
Zheng-Bicheng
2023-01-16 18:42:41 +08:00
committed by GitHub
parent 30def02a89
commit 23dfcac891
13 changed files with 704 additions and 298 deletions

View File

@@ -49,6 +49,15 @@ class PaddleDetPreprocessor:
self._preprocessor.disable_permute()
class NMSOption:
def __init__(self):
self.nms_option = C.vision.detection.NMSOption()
@property
def background_label(self):
return self.nms_option.background_label
class PaddleDetPostprocessor:
def __init__(self):
"""Create a postprocessor for PaddleDetection Model
@@ -64,10 +73,12 @@ class PaddleDetPostprocessor:
"""
return self._postprocessor.run(runtime_results)
def apply_decode_and_nms(self):
def apply_decode_and_nms(self, nms_option=None):
"""This function will enable decode and nms in postprocess step.
"""
return self._postprocessor.apply_decode_and_nms()
if nms_option is None:
nms_option = NMSOption()
self._postprocessor.ApplyDecodeAndNMS(self, nms_option.nms_option)
class PPYOLOE(FastDeployModel):
@@ -734,7 +745,7 @@ class GFL(PPYOLOE):
super(PPYOLOE, self).__init__(runtime_option)
assert model_format == ModelFormat.PADDLE, "GFL model only support model format of ModelFormat.Paddle now."
self._model = C.vision.detection.GFL(
model_file, params_file, config_file, self._runtime_option,
model_format)
assert self.initialized, "GFL model initialize failed."
self._model = C.vision.detection.GFL(model_file, params_file,
config_file, self._runtime_option,
model_format)
assert self.initialized, "GFL model initialize failed."