Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
dvd42 wants to merge1 commit intoopencv:masterfromdvd42:tutorial

Conversation

@dvd42
Copy link
Contributor

@dvd42dvd42 commentedAug 5, 2019
edited by alalek
Loading

This pullrequest changes

Adds Samples and Tutorials for the Dnn High Level API

Live demo.

cancerberoSgx reacted with thumbs up emoji
@dvd42dvd42force-pushed thetutorial branch 6 times, most recently from150e03f tofc24a93CompareAugust 6, 2019 13:45
@jsxyhelu
Copy link
Contributor

pull request to opencv is a hard way,come on!

@dkurt
Copy link
Member

I'd like to recommend to modify samples first. In example,segmentation.py andsegmentation.cpp.

@asmorkalov
Copy link
Contributor

@dvd42@dkurt Do you plan to continue with the patch? CI bot reports issues.

@dvd42
Copy link
ContributorAuthor

Yes, sorry I have started my masters and have been extremely busy. I will update the PRs in the next couple of weeks.

richipower and asmorkalov reacted with thumbs up emoji

@VadimLevin
Copy link
Contributor

Hello,@dvd42 . Do you have a time to proceed with the PR?

dvd42 reacted with thumbs up emoji

@dvd42
Copy link
ContributorAuthor

Hello,@VadimLevin, yes, I will finish it this week.

VadimLevin reacted with thumbs up emoji

@dvd42
Copy link
ContributorAuthor

@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);
Copy link
Contributor

@themechanicalcoderthemechanicalcoderJan 17, 2020
edited
Loading

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.

@dvd42dvd42force-pushed thetutorial branch 2 times, most recently fromb8d7f24 to65cb267CompareJanuary 22, 2020 11:21
~~~~~~~~~~~~~{.cpp}
#include <opencv2/core.hpp>
#include <opencv2/highgui/highgui.hpp>
Copy link
Member

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):

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).

Copy link
ContributorAuthor

@dvd42dvd42Jan 22, 2020
edited
Loading

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:

  1. Will the CI be able to check the samples if they have runtime parameters such as the ones in detection.cpp or classification.cpp?

  2. 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?

  3. 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?

Copy link
Member

Choose a reason for hiding this comment

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

  1. CI just checks compilation (in case of C++). Samples are not launched.

  2. 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

  3. 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.

dvd42 reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

  1. 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?

Copy link
Member

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.

dvd42 reacted with thumbs up emoji
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);
Copy link
Member

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

dvd42 reacted with thumbs up emoji
const uchar *ptrMaxCl =mask.ptr<uchar>(row);
Vec3b *ptrSegm = segm.ptr<Vec3b>(row);
for (int col =0; col < cols; col++)
{
Copy link
Member

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.

@alalek
Copy link
Member

Preview of added pages.

dvd42 reacted with thumbs up emoji

@dvd42dvd42force-pushed thetutorial branch 5 times, most recently frome5170be to3a1348cCompareJanuary 28, 2020 13:50
int classId = classIdPoint.x;
//! [Get a class with a highest score]
//! [Network Forward pass]
std::pair<int,float> prediction = net.classify(frame);
Copy link
Member

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);

dvd42 reacted with thumbs up emoji
"{ 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.}"
Copy link
Member

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.

Copy link
ContributorAuthor

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>
Copy link
Member

Choose a reason for hiding this comment

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

unused header

@alalek
Copy link
Member

Merge commits are not allowed in PRs.
Squashed patch into a single commit and rebased on latest master.

@vpisarev
Copy link
Contributor

vpisarev commentedMay 12, 2020
edited
Loading

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 (classify,detect,segment) needs to be added: what they take on input, what they give on output. Some pictures with illustration of results, as well as usage examples, would be helpful as well. For example, "the detection sample can be run with such a network with these flags on this picture, it will give this result", "segmentation sample can be run on that" etc.

Of course, we can merge it now and then improve the text. But overall the tutorial is far from the final state.

bhack and asmorkalov reacted with thumbs up emoji

@bhack
Copy link

I agree. I think that we could use this baseline if we have a Gsoc resource to finalize it.

@vpisarevvpisarev added the Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/ labelMay 24, 2020
@vpisarev
Copy link
Contributor

@asmorkalov,@dkurt, is this PR deprecated now as we now have better tutorials on detection, segmentation and such?

@wenqingzhang-gordon
Copy link
Contributor

If this PR is deprecated, I am willing to write a guideline about how to contribute to DNN high-level APIs in detail.
From my side, I think it will be helpful for new contributors, while GSoC2021 is going to start.
@vpisarev

alalek reacted with thumbs up emoji

@asenyaev
Copy link
Contributor

jenkins cn please retry a build

@asmorkalov
Copy link
Contributor

asmorkalov commentedJun 4, 2021
edited
Loading

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@alalekalalekalalek left review comments

@dkurtdkurtdkurt left review comments

+1 more reviewer

@themechanicalcoderthemechanicalcoderthemechanicalcoder left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@vpisarevvpisarev

Labels

category: dnnGSoCHackathonhttps://opencv.org/opencv-hackathon-starts-next-week/incomplete

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

11 participants

@dvd42@jsxyhelu@dkurt@asmorkalov@VadimLevin@alalek@vpisarev@bhack@wenqingzhang-gordon@asenyaev@themechanicalcoder

[8]ページ先頭

©2009-2025 Movatter.jp