-
Notifications
You must be signed in to change notification settings - Fork 639
Fix warp perspective documentation #5815
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
…ened 1D. Signed-off-by: Bryce Ferenczi <[email protected]>
Hello, |
When I initially developed for GPU, I used numpy.flatten() on my homographies to make 1D as per the docs and got the error message that I added in the original post "Expected a uniform list of 3x3 matrices. Instead got data with shape: {9, 9, 9, 9, 9, 9}" I've actually just tried to check that the CPU has the same behaviour with assering 3x3 mat, but I just got the error: |
!build |
CI MESSAGE: [23960901]: BUILD STARTED |
CI MESSAGE: [23960901]: BUILD FAILED |
Since there is no warp_perspective operator for CPU, only the CV-CUDA wrapper, I plan on adding one in my spare time, maybe over the weekend, just based on cv::warpPerspective. We can move this minor doc fix to that PR. This is also the case for fn.experimental.debayer, only CUDA op available based on npp, an opencv wrapper is needed for CPU impl. I think the [0,0], [0,1] notation is also a bit awkward imo, and is different from NPP and OpenCV which is an enum. |
It's better to keep changes small.
That notation was a conscious decision - it makes it easier to debayer cropped images, for example - something that, with enums, requires a lot of lookups and/or if-else ladders. |
And sorry for the delay in merging this, but we have some small unrelated issue in the CI resulting in failed builds. When the build is successful I will merge this. |
CI MESSAGE: [24182434]: BUILD STARTED |
No worries, I'll open up a new PR for warpPerspective CPU impl later when I get the free time. The added benefit of that notation checks out, but I can't see any reference to cropping in the operator itself, I guess there might be some internal use elsewhere. It just gets converted to an enum from what I can see here. I'll more deeply look into it when doing an implementation that just wraps cv::cvtColor later. I find a balance of CPU and GPU preprocessing is critical for peak training througput in my case. |
CI MESSAGE: [24182434]: BUILD PASSED |
Warp perspective requires 3x3 tensor list (not 1D), fixing documetation to reflect this requirement.
Category:
Bug fix (non-breaking change which fixes an issue)
Description:
Documentation doesn't reflect the assertions made in the code:
Additional information:
I'm not familiar with how to fix the automatically generated documetation of "matrix",
.addOptionalArg<float>("matrix", ..., std::vector<float>({}), ...)
generates "float or list of float or TensorList of float, optional, default = []" which is also incorrect. I think this problem could be pervasive in the codebase, where the inputs to operators should be 2D but the class used in .add(Optional)Arg is 1D std::vector. Maybe this is doable with ArgValue<float, 2> somehow, I'm not sure, I didn't test implementing/building this.An additional pain point for this operator in general is that size has to be on CPU, but if I have some other target image I am warping to that is already on GPU, I can't use target.shape() because cpu()->gpu() isn't allowed without experimental feature activated.
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A