diff --git a/examples/vision/segmentation/paddleseg/cpp/infer.cc b/examples/vision/segmentation/paddleseg/cpp/infer.cc index 37f16f04eb..d3c4627043 100644 --- a/examples/vision/segmentation/paddleseg/cpp/infer.cc +++ b/examples/vision/segmentation/paddleseg/cpp/infer.cc @@ -43,7 +43,7 @@ void CpuInfer(const std::string& model_dir, const std::string& image_file) { } std::cout << res.Str() << std::endl; - auto vis_im = fastdeploy::vision::VisSegmentation(im, res); + auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5); cv::imwrite("vis_result.jpg", vis_im); std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl; } @@ -72,7 +72,7 @@ void GpuInfer(const std::string& model_dir, const std::string& image_file) { } std::cout << res.Str() << std::endl; - auto vis_im = fastdeploy::vision::VisSegmentation(im, res); + auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5); cv::imwrite("vis_result.jpg", vis_im); std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl; } @@ -102,7 +102,7 @@ void TrtInfer(const std::string& model_dir, const std::string& image_file) { } std::cout << res.Str() << std::endl; - auto vis_im = fastdeploy::vision::VisSegmentation(im, res); + auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5); cv::imwrite("vis_result.jpg", vis_im); std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl; } diff --git a/examples/vision/segmentation/paddleseg/python/infer.py b/examples/vision/segmentation/paddleseg/python/infer.py index dd65ebf273..866e32bfb8 100644 --- a/examples/vision/segmentation/paddleseg/python/infer.py +++ b/examples/vision/segmentation/paddleseg/python/infer.py @@ -53,5 +53,5 @@ def build_option(args): print(result) # 可视化结果 -vis_im = fd.vision.visualize.vis_segmentation(im, result) +vis_im = fd.vision.vis_segmentation(im, result, weight=0.5) cv2.imwrite("vis_img.png", vis_im) diff --git a/python/fastdeploy/vision/visualize/__init__.py b/python/fastdeploy/vision/visualize/__init__.py index 37ac727dca..403ac1e3ad 100644 --- a/python/fastdeploy/vision/visualize/__init__.py +++ b/python/fastdeploy/vision/visualize/__init__.py @@ -36,8 +36,8 @@ def vis_face_detection(im_data, face_det_result, line_size=1, font_size=0.5): font_size) -def vis_segmentation(im_data, seg_result): - return C.vision.vis_segmentation(im_data, seg_result) +def vis_segmentation(im_data, seg_result, weight=0.5): + return C.vision.vis_segmentation(im_data, seg_result, weight) def vis_matting_alpha(im_data,