[CVCUDA] PP-OCR and PPDet preprocessor support use_cuda python API(#1734)

add cvcuda support in ppocr and ppdet
This commit is contained in:
guxukai
2023-03-29 20:57:36 +08:00
committed by GitHub
parent 3ef48f7746
commit 38f056d1c1
2 changed files with 34 additions and 60 deletions

View File

@@ -17,36 +17,28 @@ from typing import Union, List
import logging
from .... import FastDeployModel, ModelFormat
from .... import c_lib_wrap as C
from ...common import ProcessorManager
class PaddleDetPreprocessor:
class PaddleDetPreprocessor(ProcessorManager):
def __init__(self, config_file):
"""Create a preprocessor for PaddleDetection Model from configuration file
:param config_file: (str)Path of configuration file, e.g ppyoloe/infer_cfg.yml
"""
self._preprocessor = C.vision.detection.PaddleDetPreprocessor(
config_file)
def run(self, input_ims):
"""Preprocess input images for PaddleDetection Model
:param: input_ims: (list of numpy.ndarray)The input image
:return: list of FDTensor, include image, scale_factor, im_shape
"""
return self._preprocessor.run(input_ims)
self._manager = C.vision.detection.PaddleDetPreprocessor(config_file)
def disable_normalize(self):
"""
This function will disable normalize in preprocessing step.
"""
self._preprocessor.disable_normalize()
self._manager.disable_normalize()
def disable_permute(self):
"""
This function will disable hwc2chw in preprocessing step.
"""
self._preprocessor.disable_permute()
self._manager.disable_permute()
class NMSOption: