Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix ]Update ppseg visualize python api && demo #454

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个接口,是没有给weight默认值吗,要不直接给默认值加上0.5吧~

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给了默认值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