-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Nvidia optical flow #2165
Nvidia optical flow #2165
Conversation
Is it OK if we discuss all necessary changes and then il make all changes at once? |
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.
Thank you for update!
Hi @alalek Traceback (most recent call last): |
All base classes must be wrapped into bindings too: -class CV_EXPORTS NvidiaHWOpticalFlow
+class CV_EXPORTS_W NvidiaHWOpticalFlow |
@alalek Thanks for reviewing till now, |
Hi @alalek This error here is due to CUDA_CUDA_LIBRARY not linked to opencv_world module for which i submitted a pull request in opencv main branch |
This build tests both patches together (both patches are applied). |
Looks like its not picking properly from opencv main branch. NVIDIA_Optical_Flow branch is not used here: |
Here:
|
Hi @alalek and i was able to build opencv without any errors. Is CUDA installed on that machine where the compilation is going on? |
Build is going in Linux docker container (without any CUDA device, just build, no tests). Dockerfile with CUDA related installations is here. |
These files are available from container:
So only "stubs" are available in build container. Here:
It seems correct. Need to check what linker does wrong. Update: Looks like stub file is malformed and can't be used with shared libraries.
|
Related issue: NVIDIA/nvidia-container-toolkit#185 |
Does re-linking solved the build issue? I still see failure with same error. |
There is typo in my previous comment ( I tried building with extra symbolic link (from here), it seems able to build. However it is not robust solution in general (due patching content in CUDA SDK directories). Changes are not added into CI infrastructure yet. |
What should be our next step then? Since you were able to build that indicates everything is fine in this patch right? |
@param enableCostBuffer Optional Parameter. Flag to enable cost buffer output from calc(). Defaults to false. | ||
@param gpuId Optional parameter to select the GPU ID on which the optical flow should be computed. Useful in multi-GPU systems. Defaults to 0. | ||
*/ | ||
CV_WRAP static Ptr<NvidiaOpticalFlow_1_0> create( |
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.
Lets remove CV_WRAP
here to workaround bindings issue (look like there is bug in bindings generator).
This would disable Python bindings for this functionality (not critical for now - can be enabled later with corresponding Python tests)
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.
Sure. I got python bindings error repro locally and i was able to fix it. Hopefully it compiles fine now.
Thanks @alalek for all suggestions.. Appreciated :-)
And your test commit works so will you merge it in opencv main branch and then il update my PR or how should we take this integration?
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.
Looks good to me! Thank you 👍
Thanks alot @alalek |
Main PR: opencv/opencv#14888
Adds source code for OpenCV-OF interface implementation, unit test and performance test.
This change implements a OpenCV interface for the NVIDIA Optical Flow SDK 1.0. The SDK exposes the latest hardware
capability of Turing GPUs dedicated to computing the relative motion of pixels between images.
The hardware uses sophisticated algorithms to yield highly accurate flow vectors, with robust frame-to-frame intensity variations and
tracks the true object motion faster and more accurately. The optical flow hardware accelerator generates block-based optical flow vectors.
The size of the block depends on hardware in use and can be queried using the function getGridSize(). The block-based flow vectors generated
by the hardware can be converted to dense representation (i.e. per-pixel flow vectors) using upSampler() helper function, if needed.
The flow vectors are stored in CV_16SC2 format with x and y components of each flow vector in 16-bit signed fixed point representation S10.5.
This change also adds a unit test and a performance test for the new interface.