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

How to run the detection on rectangular ROIs #1

Open
rsingh2083 opened this issue Jul 1, 2022 · 5 comments
Open

How to run the detection on rectangular ROIs #1

rsingh2083 opened this issue Jul 1, 2022 · 5 comments

Comments

@rsingh2083
Copy link

Hi Sir,

I want to run this on only two rectangular ROI of the video. For example a rectangular ROI in top left and bottom right, that's it.
Can you please help how to do it .

@Qengineering
Copy link
Owner

Dear @rsingh2083,

How do you want to prioritize the found objects? For instance, you found 8 objects. Which two do you want to show?
The two with the highest probability? Or with the largest surface?
Be aware, that the next frame can be slightly different compared to the previous, resulting in another outcome. Your two ROI will get bouncing around.

@rsingh2083
Copy link
Author

Sir I just want to check if there is any person in 4 rectangular ROI.
In these 4 rectangular regions if a person with highest probability is detected, that's it.

@Qengineering
Copy link
Owner

Start playing with cv::Rect. Your outcome has a rect around the person, and if you define the 4 regions as rect, you can find the overlap. See https://answers.opencv.org/question/67091/how-to-find-if-2-rectangles-are-overlapping-each-other/ for the math on rects

@rsingh2083
Copy link
Author

rsingh2083 commented Jul 10, 2022

Thanks sir.
If the centroid of rect of person from YOLO lies between the 4 rectangular regions created by me, then I'll count that.
Sir do you think this process will also decrease CPU load, because now instead of the entire video frame ,we will be processing only 4 rectangular regions. I'm asking because I want to have this benefit also.

@Qengineering
Copy link
Owner

The design of the deep learning model determines the dimensions of the input image. In the case of YoloFastestV2, it is 352x352. Regardless of the resolution offered, the first thing the algorithm does is resize to this 352x352 (line 186 of yolo-fastestv2.cpp). As a result, the inference time also remains the same, regardless of the image size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants