[Doc] Update PaddleSeg comments (#785)

* Update docs for wrong path

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update segmentation_result.md

* Update README.md

* Update README.md

* Update README.md

* Update PaddleSeg comments

Co-authored-by: Jason <928090362@qq.com>
This commit is contained in:
huangjianhui
2022-12-05 10:14:35 +08:00
committed by GitHub
parent 1860d3ab78
commit a0caf9fbb7
4 changed files with 35 additions and 9 deletions

View File

@@ -1,5 +1,14 @@
# Semantic Segmentation(语义分割) # Semantic Segmentation(语义分割)
## fastdeploy.vision.segmentation.PaddleSegPreprocessor
```{eval-rst}
.. autoclass:: fastdeploy.vision.segmentation.PaddleSegPreprocessor
:members:
:inherited-members:
```
## fastdeploy.vision.segmentation.PaddleSegModel ## fastdeploy.vision.segmentation.PaddleSegModel
```{eval-rst} ```{eval-rst}
@@ -7,3 +16,11 @@
:members: :members:
:inherited-members: :inherited-members:
``` ```
## fastdeploy.vision.segmentation.PaddleSegPostprocessor
```{eval-rst}
.. autoclass:: fastdeploy.vision.segmentation.PaddleSegPostprocessor
:members:
:inherited-members:
```

View File

@@ -20,7 +20,8 @@
namespace fastdeploy { namespace fastdeploy {
namespace vision { namespace vision {
namespace segmentation { namespace segmentation {
/*! @brief Postprocessor object for PaddleSeg serials model.
*/
class FASTDEPLOY_DECL PaddleSegPostprocessor { class FASTDEPLOY_DECL PaddleSegPostprocessor {
public: public:
/** \brief Create a postprocessor instance for PaddleSeg serials model /** \brief Create a postprocessor instance for PaddleSeg serials model

View File

@@ -18,7 +18,8 @@
namespace fastdeploy { namespace fastdeploy {
namespace vision { namespace vision {
namespace segmentation { namespace segmentation {
/*! @brief Preprocessor object for PaddleSeg serials model.
*/
class FASTDEPLOY_DECL PaddleSegPreprocessor { class FASTDEPLOY_DECL PaddleSegPreprocessor {
public: public:
/** \brief Create a preprocessor instance for PaddleSeg serials model /** \brief Create a preprocessor instance for PaddleSeg serials model

View File

@@ -50,23 +50,26 @@ class PaddleSegModel(FastDeployModel):
return self._model.predict(image) return self._model.predict(image)
def batch_predict(self, image_list): 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 :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) return self._model.batch_predict(image_list)
@property @property
def preprocessor(self): def preprocessor(self):
"""Get PaddleSegPreprocessor object of the loaded model """Get PaddleSegPreprocessor object of the loaded model
:return PaddleSegPreprocessor
:return: PaddleSegPreprocessor
""" """
return self._model.preprocessor return self._model.preprocessor
@property @property
def postprocessor(self): def postprocessor(self):
"""Get PaddleSegPostprocessor object of the loaded model """Get PaddleSegPostprocessor object of the loaded model
:return PaddleSegPostprocessor
:return: PaddleSegPostprocessor
""" """
return self._model.postprocessor return self._model.postprocessor
@@ -74,6 +77,7 @@ class PaddleSegModel(FastDeployModel):
class PaddleSegPreprocessor: class PaddleSegPreprocessor:
def __init__(self, config_file): def __init__(self, config_file):
"""Create a preprocessor for PaddleSegModel from configuration file """Create a preprocessor for PaddleSegModel from configuration file
:param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml :param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml
""" """
self._preprocessor = C.vision.segmentation.PaddleSegPreprocessor( self._preprocessor = C.vision.segmentation.PaddleSegPreprocessor(
@@ -81,7 +85,8 @@ class PaddleSegPreprocessor:
def run(self, input_ims): def run(self, input_ims):
"""Preprocess input images for PaddleSegModel """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: list of FDTensor
""" """
return self._preprocessor.run(input_ims) return self._preprocessor.run(input_ims)
@@ -114,6 +119,7 @@ class PaddleSegPreprocessor:
class PaddleSegPostprocessor: class PaddleSegPostprocessor:
def __init__(self, config_file): def __init__(self, config_file):
"""Create a postprocessor for PaddleSegModel from configuration file """Create a postprocessor for PaddleSegModel from configuration file
:param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml :param config_file: (str)Path of configuration file, e.g ppliteseg/deploy.yaml
""" """
self._postprocessor = C.vision.segmentation.PaddleSegPostprocessor( self._postprocessor = C.vision.segmentation.PaddleSegPostprocessor(
@@ -121,8 +127,9 @@ class PaddleSegPostprocessor:
def run(self, runtime_results, imgs_info): def run(self, runtime_results, imgs_info):
"""Postprocess the runtime results for PaddleSegModel """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: 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) return self._postprocessor.run(runtime_results, imgs_info)