diff --git a/docs/api_docs/python/semantic_segmentation.md b/docs/api_docs/python/semantic_segmentation.md index 6d224e085..7a0eb6ca9 100644 --- a/docs/api_docs/python/semantic_segmentation.md +++ b/docs/api_docs/python/semantic_segmentation.md @@ -1,5 +1,14 @@ # Semantic Segmentation(语义分割) + +## fastdeploy.vision.segmentation.PaddleSegPreprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.segmentation.PaddleSegPreprocessor + :members: + :inherited-members: +``` + ## fastdeploy.vision.segmentation.PaddleSegModel ```{eval-rst} @@ -7,3 +16,11 @@ :members: :inherited-members: ``` + +## fastdeploy.vision.segmentation.PaddleSegPostprocessor + +```{eval-rst} +.. autoclass:: fastdeploy.vision.segmentation.PaddleSegPostprocessor + :members: + :inherited-members: +``` diff --git a/fastdeploy/vision/segmentation/ppseg/postprocessor.h b/fastdeploy/vision/segmentation/ppseg/postprocessor.h index a42e25397..89c8371ee 100644 --- a/fastdeploy/vision/segmentation/ppseg/postprocessor.h +++ b/fastdeploy/vision/segmentation/ppseg/postprocessor.h @@ -20,7 +20,8 @@ namespace fastdeploy { namespace vision { namespace segmentation { - +/*! @brief Postprocessor object for PaddleSeg serials model. + */ class FASTDEPLOY_DECL PaddleSegPostprocessor { public: /** \brief Create a postprocessor instance for PaddleSeg serials model diff --git a/fastdeploy/vision/segmentation/ppseg/preprocessor.h b/fastdeploy/vision/segmentation/ppseg/preprocessor.h index 77ac36d93..faa7fb8de 100644 --- a/fastdeploy/vision/segmentation/ppseg/preprocessor.h +++ b/fastdeploy/vision/segmentation/ppseg/preprocessor.h @@ -18,7 +18,8 @@ namespace fastdeploy { namespace vision { namespace segmentation { - +/*! @brief Preprocessor object for PaddleSeg serials model. + */ class FASTDEPLOY_DECL PaddleSegPreprocessor { public: /** \brief Create a preprocessor instance for PaddleSeg serials model diff --git a/python/fastdeploy/vision/segmentation/ppseg/__init__.py b/python/fastdeploy/vision/segmentation/ppseg/__init__.py index 1c9fa8e1f..7a18b7964 100644 --- a/python/fastdeploy/vision/segmentation/ppseg/__init__.py +++ b/python/fastdeploy/vision/segmentation/ppseg/__init__.py @@ -50,23 +50,26 @@ class PaddleSegModel(FastDeployModel): return self._model.predict(image) def batch_predict(self, image_list): - """Predict the segmentation results for a batch of input image + """Predict the segmentation results for a batch of input images + :param image_list: (list of numpy.ndarray) The input image list, each element is a 3-D array with layout HWC, BGR format - :return list of SegmentationResult + :return: list of SegmentationResult """ return self._model.batch_predict(image_list) @property def preprocessor(self): """Get PaddleSegPreprocessor object of the loaded model - :return PaddleSegPreprocessor + + :return: PaddleSegPreprocessor """ return self._model.preprocessor @property def postprocessor(self): """Get PaddleSegPostprocessor object of the loaded model - :return PaddleSegPostprocessor + + :return: PaddleSegPostprocessor """ return self._model.postprocessor @@ -74,6 +77,7 @@ class PaddleSegModel(FastDeployModel): class PaddleSegPreprocessor: def __init__(self, config_file): """Create a preprocessor for PaddleSegModel from configuration file + :param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml """ self._preprocessor = C.vision.segmentation.PaddleSegPreprocessor( @@ -81,7 +85,8 @@ class PaddleSegPreprocessor: def run(self, input_ims): """Preprocess input images for PaddleSegModel - :param: input_ims: (list of numpy.ndarray)The input image + + :param input_ims: (list of numpy.ndarray)The input image :return: list of FDTensor """ return self._preprocessor.run(input_ims) @@ -114,6 +119,7 @@ class PaddleSegPreprocessor: class PaddleSegPostprocessor: def __init__(self, config_file): """Create a postprocessor for PaddleSegModel from configuration file + :param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml """ self._postprocessor = C.vision.segmentation.PaddleSegPostprocessor( @@ -121,8 +127,9 @@ class PaddleSegPostprocessor: def run(self, runtime_results, imgs_info): """Postprocess the runtime results for PaddleSegModel - :param: runtime_results: (list of FDTensor)The output FDTensor results from runtime - :param: imgs_info: The original input images shape info map, key is "shape_info", value is [[image_height, image_width]] + + :param runtime_results: (list of FDTensor)The output FDTensor results from runtime + :param imgs_info: The original input images shape info map, key is "shape_info", value is [[image_height, image_width]] :return: list of SegmentationResult(If the runtime_results is predict by batched samples, the length of this list equals to the batch size) """ return self._postprocessor.run(runtime_results, imgs_info)