Skip to content

Commit

Permalink
[Bug Fix ]Update ppseg visualize python api && demo (#454)
Browse files Browse the repository at this point in the history
Update ppseg visualize python api && demo
  • Loading branch information
felixhjh authored Oct 28, 2022
1 parent 52423b8 commit d794810
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/vision/segmentation/paddleseg/cpp/infer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/vision/segmentation/paddleseg/python/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions python/fastdeploy/vision/visualize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d794810

Please sign in to comment.