support PPSeg model for dnn module#20511
Conversation
|
jenkins cn please retry a build |
1 similar comment
|
jenkins cn please retry a build |
rogday
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
|
|
||
| there are 3 part of this execution | ||
|
|
||
| * 1. Export PaddlePaddle ResNet50 model to onnx format; |
There was a problem hiding this comment.
Please, choose bullet list or numbered list and change ; to .
|
|
||
| ### Convert to ONNX Model | ||
|
|
||
| #### Step1. get Paddle Inference model |
|
|
||
| there are 3 part of this execution | ||
|
|
||
| * 1. Use `cv2.dnn.readNetFromONNX` load model file; |
There was a problem hiding this comment.
- Use
cv2.dnn.readNetFromONNXto load the model file.
| @@ -0,0 +1,80 @@ | |||
| # Run PaddlePaddle model by OpenCV | |||
| @@ -0,0 +1,80 @@ | |||
| # Run PaddlePaddle model by OpenCV | |||
|
|
|||
| This tutorial gives 2 demos show how to run PaddlePaddle model by opencv | |||
There was a problem hiding this comment.
These two demonstrations show how to inference PaddlePaddle model using OpenCV.
| there are 3 part of this execution | ||
|
|
||
| * 1. Export PaddlePaddle ResNet50 model to onnx format; | ||
| * 2. Use `cv2.dnn.readNetFromONNX` load model file; |
There was a problem hiding this comment.
- Use
cv2.dnn.readNetFromONNXto load the model file.
|
|
||
| * 1. Export PaddlePaddle ResNet50 model to onnx format; | ||
| * 2. Use `cv2.dnn.readNetFromONNX` load model file; | ||
| * 3. Preprocess image file and do inference. |
There was a problem hiding this comment.
- Preprocess image file and do the inference.
| python paddle_humanseg.py | ||
| ``` | ||
|
|
||
| there are 3 part of this execution |
There was a problem hiding this comment.
There are three parts to the process:
|
|
||
| * 1. Use `cv2.dnn.readNetFromONNX` load model file; | ||
| * 2. Preprocess image file and do inference. | ||
| * 3. Postprocess image file and visualization. |
There was a problem hiding this comment.
- Postprocess image file and visualize.
| * 2. Preprocess image file and do inference. | ||
| * 3. Postprocess image file and visualization. | ||
|
|
||
| The result is in the path `data/result_test_human.jpg` . |
There was a problem hiding this comment.
The resulting file can be found at data/result_test_human.jpg.
| @@ -0,0 +1,80 @@ | |||
| # Run PaddlePaddle model using OpenCV | |||
There was a problem hiding this comment.
samples/dnn/dnn_model_runner/dnn_conversion
Looks like these files are borrowed from the master branch.
There are no such files on "3.4" maintenance branch and no plans to backport this feature.
There was a problem hiding this comment.
Because previous PR is based on "master",the main purpose is to add a portrait segmentation sample in the samples/dnn/dnn_model_runner/dnn_conversion/paddlepaddle directory, but because the "3.4" branch does not have a corresponding directory, I created this directory for the future It's easy to merge into the "master" branch. If this is the case, do you have any good suggestions to solve this problem?
There was a problem hiding this comment.
Lets keep bugfix part for "3.4" branch.
New samples and other features should go to "master" branch (continue PR #20290).
There was a problem hiding this comment.
Thanks for your suggestions~
|
@alalek I have kept bugfix part for "3.4" branch,and new samples and other features should go to #20290. |
|
@wjj19950828 Thank you for update! Please take a look on tests failures. Debug dump |
|
We still have failed test due to missing test data file (it was renamed in opencv_extra PR). |
There seems to be no problem with the test cases, but the opencv_extra branch prompts that the file size exceeds the 1M limit, but in fact the relevant test cases do not exceed the 1M size. How should I solve it? In addition, the status of this PR has not been updated for a long time. Do you have any good suggestions for this PR? Looking forward to it your reply~ |
alalek
left a comment
There was a problem hiding this comment.
Looks good to me! Thank you for contribution 👍
Thank you~Do you have any plans or suggestions for this PR:#20290 Looking forward to your reply~ |
Merge with extra: opencv/opencv_extra#892
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
This PR do follow contributes
1、fixed opencv.dnn resize op,support interp_mode == "half_pixel" situation.if not fixed,the onnx and dnn result has diff.
2、add PaddleSeg Portrait Segmentation demo by OpenCV.
3、update readme.
my previous PR:#20290, because previous PR is based on "master" and if target previous PR to 3.4 branch 3000+ files have changed,so i open PR again based on 3.4 branch.All comments in previous PR have done in this PR.
Test data and model in opencv/opencv_extra#892