[Other] Update deprecated segmentation apis && segmentation label map resize interinterpolation (#790)

* Refactor PaddleSeg with preprocessor && postprocessor

* Fix bugs

* Delete redundancy code

* Modify by comments

* Refactor according to comments

* Add batch evaluation

* Add single test script

* Add ppliteseg single test script && fix eval(raise) error

* fix bug

* Fix evaluation segmentation.py batch predict

* Fix segmentation evaluation bug

* Fix evaluation segmentation bugs

* Update segmentation result docs

* Update old predict api and DisableNormalizeAndPermute

* Update resize segmentation label map with cv::INTER_NEAREST

Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
huangjianhui
2022-12-05 09:57:54 +08:00
committed by GitHub
parent d74e1209ae
commit 6c31198342
4 changed files with 13 additions and 9 deletions

View File

@@ -280,13 +280,17 @@ bool PaddleSegPostprocessor::Run(
FDMat mat;
std::vector<uint8_t> uint8_result_buffer;
// Resize interpration
int interpolation = cv::INTER_LINEAR;
if (is_resized) {
if (infer_results_dtype == FDDataType::INT64 ||
infer_results_dtype == FDDataType::INT32 ){
FDTensorCast2Uint8(&infer_result, infer_chw, &uint8_result_buffer);
}
FDTensorCast2Uint8(&infer_result, infer_chw, &uint8_result_buffer);
// label map resize with nearest interpolation
interpolation = cv::INTER_NEAREST;
}
mat = std::move(Mat::Create(infer_result, ProcLib::OPENCV));
Resize::Run(&mat, input_width, input_height, -1.0f, -1.0f, 1, false, ProcLib::OPENCV);
Resize::Run(&mat, input_width, input_height, -1.0f, -1.0f, interpolation, false, ProcLib::OPENCV);
mat.ShareWithTensor(&infer_result);
}
result->shape = infer_result.shape;