CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
raft support added in this sample code #24913
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
Conversation
Thank you for your contribution! Have you run these two models with dnn and record the inference speed? I would like to know which runs faster. |
Average Inference Time for FlowNet v2: 0.83 seconds per frame This is how I calculated start_time = cv.getTickCount()
flow = self.net.forward()
end_time = cv.getTickCount()
inference_time = (end_time - start_time) / cv.getTickFrequency()
self.total_time += inference_time avg_time = opt_flow.total_time / num_frames I used the model weights mentioned in the sample code file. |
That's useful information. Thank you! |
caffemodel = open(args.model, 'rb').read() | ||
opt_flow = OpticalFlow(caffemodel, var['ADAPTED_HEIGHT'], var['ADAPTED_WIDTH'], bytearray(config.encode())) | ||
else: | ||
opt_flow = OpticalFlow(args.model, 360, 480) |
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.
Use args.height and args.width
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.
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.
Do you think I should leave this as it is? Or, should I find a new model or train a new model?
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 think that 360x480 gives the best accuracy but using lower resolutions might be faster. But yes, let’s keep original shapes and merge this PR.
@fengyuentau If there are no reviews can you approve these changes, so this PR can be merged? |
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.
LGTM 👍
Raft support added in this sample code opencv#24913 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake fix: opencv#24424 Update DNN Optical Flow sample with RAFT model I implemented both RAFT and FlowNet v2 leaving it to the user which one he wants to use to estimate the optical flow. Co-authored-by: Uday Sharma <uday@192.168.1.35>
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.
fix: #24424 Update DNN Optical Flow sample with RAFT model
I implemented both RAFT and FlowNet v2 leaving it to the user which one he wants to use to estimate the optical flow.