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

RGBD tests refactoring #2854

Merged
merged 19 commits into from
Apr 1, 2021
Merged

Conversation

DumDereDum
Copy link
Member

@DumDereDum DumDereDum commented Feb 2, 2021

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@DumDereDum DumDereDum changed the title WIP: RGBD tests refactoring **WIP**: RGBD tests refactoring Feb 2, 2021
@tomoaki0705
Copy link
Contributor

If you are intended of refactoring RGBD module, I really appreciate if you could merge those 2 implementations.
i.e. merge TSDFVolumeGPU class and TSDFVolumeCPU class and just keep TSDFVolume
TSDFVolumeGPU class triggers several kernels under the hood, but single kernel build failure leads directly to runtime error.
The difference can be only decided at the beginning.

It will be way more convenient for user if any kernel build/run failure fall back to CPU version during the function call.

More precisely, use following cascaded function call everywhere

CV_OCL_RUN(ocl_integrate(....))

// followed by CPU version
cpu_integrate();

Putting HAVE_OPENCL in the test code is really the opposite way to go.

That's why it's called "T-API" (Transparent API) 1 2

@DumDereDum DumDereDum changed the title **WIP**: RGBD tests refactoring RGBD tests refactoring Mar 18, 2021
@savuor
Copy link
Contributor

savuor commented Mar 25, 2021

@tomoaki0705, the way to organize code could be more consistent but would involve constant copying data from/to host and GPU memory, which would involve huge stalls during code execution.

Copy link
Contributor

@savuor savuor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use namespace indentation, please fix this.
Also when running TSDF GPU tests with display=true flag I see quite glitchy image during rendering. Using viz I could find out that rendered points are OK but normals have wrong direction. Now investigating this.

@savuor
Copy link
Contributor

savuor commented Mar 25, 2021

@DumDereDum Found out what's the reason of the bug:
https://github.com/opencv/opencv_contrib/blob/master/modules/rgbd/src/opencl/tsdf.cl#L230

Here you subtract compressed values then convert them to float. This is incorrect: the values should be converted to float, then subtracted, this solves the bug.
Please fix this in this PR and add the corresponding mention to PR description.


void normal_test(bool isHashTSDF, bool isRaycast, bool isFetchPointsNormals, bool isFetchNormals)
{
auto normalCheck = [](Vec4f& vector, const int*)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add explicit setUseOpenCL() calls here and in normal_test function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have OpenCL we don't need to use setUseOpenCL

TEST(HashTSDF, fetch_normals) { normal_test(true, false, false, true); }
TEST(HashTSDF, valid_points) { valid_points_test(true); }
#else
TEST(TSDF_CPU, raycast_normals)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove OCL tests from this file, we have them in ocl/ folder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if I remove them there would be two equal GPU tests

@savuor savuor self-assigned this Apr 1, 2021
@savuor
Copy link
Contributor

savuor commented Apr 1, 2021

👍

@alalek alalek merged commit c287e52 into opencv:master Apr 1, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
@DumDereDum DumDereDum deleted the rgbd_test_refactoring branch April 19, 2021 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants