raft support added in this sample code#24913
raft support added in this sample code#24913asmorkalov merged 6 commits intoopencv:4.xfrom usyntest:optical-flow-sample-raft
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_timeavg_time = opt_flow.total_time / num_framesI 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.
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.
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? |
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.