mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
[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:
@@ -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:
|
||||
```
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user