Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
Samples and tutorials for the Dnn High Level API#15240
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
150e03f tofc24a93Comparejsxyhelu commentedAug 9, 2019
pull request to opencv is a hard way,come on! |
dkurt commentedOct 11, 2019
I'd like to recommend to modify samples first. In example,segmentation.py andsegmentation.cpp. |
asmorkalov commentedNov 13, 2019
dvd42 commentedNov 13, 2019
Yes, sorry I have started my masters and have been extremely busy. I will update the PRs in the next couple of weeks. |
VadimLevin commentedJan 14, 2020
Hello,@dvd42 . Do you have a time to proceed with the PR? |
dvd42 commentedJan 14, 2020
Hello,@VadimLevin, yes, I will finish it this week. |
dvd42 commentedJan 16, 2020
@VadimLevin I've updated the PR, let me know if any change is required :) |
| std::pair<int,float> prediction = model.classify(image); | ||
| std::string pred ="Prediction" +std::to_string(prediction.first); | ||
| std::string confidence =" Confidence" +std::to_string(prediction.second); |
themechanicalcoderJan 17, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@dvd42 I think your model if failing builds because of "std::to_string()" instead use string stream do something like
stringstream ss ;ss << prediction.first;string pred = "Prediction " + ss.str();and similarly for confidence.
Do it for all the files
This is a known problem of Android GCC toolchain + gnustl_static C++ runtime.
b8d7f24 to65cb267Compare| ~~~~~~~~~~~~~{.cpp} | ||
| #include <opencv2/core.hpp> | ||
| #include <opencv2/highgui/highgui.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please extract code from text documents and embed it through@include or@snippet doxygen commands.
Dedicated locations for tutorial files (or reuse any existed sample from "samples/" folder):
- https://github.com/opencv/opencv/tree/master/samples/cpp/tutorial_code
- https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code
This help to ensure that code in documentation is not broken:
- All C++ samples are checked through compilation on CI.
- Python files are checked by linters (pylint / flake8 - see "Docs" builder).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi,@alalek, thanks for the feedback. I have a couple of questions:
Will the CI be able to check the samples if they have runtime parameters such as the ones in detection.cpp or classification.cpp?
The code that I have inserted in the markdown is simpler than the one in the samples, since I wanted to make the example easier to understand, can I include a block of code with@code ...@Endcode instead of embedding a file? If not, where should I create a new file and put this block of code in order to embed it using@snippet?
Some of the required files for the samples to run are network weights, these files are too large to make them part of the tutorial files and upload them to the repo, what should I do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
CI just checks compilation (in case of C++). Samples are not launched.
Normal "samples" contains a lot of helper code, like args parsing, etc. Code in tutorials is more simple. There are examples ofcode block andits embedding
It is better to reuse already existed data in repository. If not, then external link (URL) is preferable in case of huge data. Users should be able to reproduce tutorial results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- The external data that I use its already part of the downloadable links inopencv_extra, should I just explain this in the tutorial, or just comment the URL in the tutorial file so that the users can download it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I believe, it is enough to add reference with model's name and with the link on downloader script.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
samples/dnn/segmentation.cpp Outdated
| blobFromImage(frame, blob,scale,Size(inpWidth, inpHeight), mean, swapRB,false); | ||
| //! [Create a 4D blob from a frame] | ||
| //! [Set input parameters] | ||
| net.setInputParams(scale,Size(inpWidth, inpHeight), mean, swapRB,false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This method should be called once
| const uchar *ptrMaxCl =mask.ptr<uchar>(row); | ||
| Vec3b *ptrSegm = segm.ptr<Vec3b>(row); | ||
| for (int col =0; col < cols; col++) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please modify Python sample as well.
doc/tutorials/dnn/dnn_high_level_api/dnn_classification_module.markdown OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
alalek commentedJan 22, 2020
Preview of added pages. |
e5170be to3a1348cCompare| int classId = classIdPoint.x; | ||
| //! [Get a class with a highest score] | ||
| //! [Network Forward pass] | ||
| std::pair<int,float> prediction = net.classify(frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please replace to
int classId;float confidence;std::tie(classId, confidence) = net.classify(frame);
| "{ input i | | Path to input image or video file. Skip this argument to capture frames from a camera. }" | ||
| "{ framework f | | Optional name of an origin framework of the model. Detect it automatically if it does not set. }" | ||
| "{ classes | | Optional path to a text file with names of classes. }" | ||
| "{ num_classes | | number of classes with which the model was trained. If a classes file is provided this parameter will be infered.}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In fact, we can just push new colors in case of new class id is more than current number of classes. So please modify code so it can manage it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hey,@dkurt I am sorry, but I dont understand what you mean by this, could you please explain with an example. Thanks.
| @@ -1,5 +1,7 @@ | |||
| #include<fstream> | |||
| #include<sstream> | |||
| #include<iostream> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
unused header
alalek commentedMar 12, 2020
Merge commits are not allowed in PRs. |
vpisarev commentedMay 12, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
it looks good to me, we definitely need such a tutorial. The examples, thanks to the reviewers, are now quite polished. But the textual/descriptive part definitely needs some improvement. Maybe GSoC student Anastasia or someone else can work on it. At least, brief yet clear description of the key methods ( Of course, we can merge it now and then improve the text. But overall the tutorial is far from the final state. |
bhack commentedMay 12, 2020
I agree. I think that we could use this baseline if we have a Gsoc resource to finalize it. |
vpisarev commentedDec 2, 2020
@asmorkalov,@dkurt, is this PR deprecated now as we now have better tutorials on detection, segmentation and such? |
wenqingzhang-gordon commentedDec 4, 2020
If this PR is deprecated, I am willing to write a guideline about how to contribute to DNN high-level APIs in detail. |
asenyaev commentedApr 7, 2021
jenkins cn please retry a build |
asmorkalov commentedJun 4, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The PR is replaced with another GSoC project results: |
Uh oh!
There was an error while loading.Please reload this page.
This pullrequest changes
Adds Samples and Tutorials for the Dnn High Level API
Live demo.