Skip to content

3D algorithms benchmark script added#13

Open
savuor wants to merge 17 commits intoopencv:developfrom
savuor:rv/bench_3d
Open

3D algorithms benchmark script added#13
savuor wants to merge 17 commits intoopencv:developfrom
savuor:rv/bench_3d

Conversation

@savuor
Copy link
Copy Markdown

@savuor savuor commented Mar 28, 2024

This PR changes

Adding a script that downloads models from a specific dataset, runs several 3D algorithms on it and calculates accuracy.

TODO:

  • Point cloud generation: subsample triangles in proportion to overall surface area
  • Colored mesh generation for triangleRasterize(): assign vertex color based on a color from a texture
  • Collecting stats
  • More camera poses
  • Correctly process Stanford files (w/o textures)
  • No hardcoded filenames, better argument processing

@savuor savuor marked this pull request as ready for review April 16, 2024 03:25
Comment thread download_collection.py
Comment on lines +21 to +22
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
raise Exception("Python 3.5 or greater is required. Try running `python3 download_collection.py`")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread download_collection.py
normL2Rgb = np.linalg.norm(colorDiff, ord=2) / (width * height)
print("rgb L2: %f Inf: %f" % (normL2Rgb, normInfRgb))

cv.imwrite(color_diff_path, (colorDiff.reshape((height, width, 3)) + 1) * 0.5 * 255.0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why *0.5?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

because difference range is 2x bigger than value range

Comment thread download_collection.py
colorGl = colorGl.astype(np.float32) * (1.0/255.0)
colorDiff = np.ravel(colorGl - colorRasterize)
normInfRgb = np.linalg.norm(colorDiff, ord=np.inf)
normL2Rgb = np.linalg.norm(colorDiff, ord=2) / (width * height)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I propose to report min/max/average, but not only value normalized on pixel count. In case if the scene is sparse and most of pixels are background the current value is not informative.

Comment thread download_collection.py
position = np.array([0.0, 0.0, zat], dtype=np.float32)
lookat = np.array([0.0, 0.0, 0.0], dtype=np.float32)
upVector = np.array([0.0, 1.0, 0.0], dtype=np.float32)
cameraPose = lookAtMatrixCal(position, lookat, upVector)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like we need to add it to OpenCV as API.

Comment thread download_collection.py
Comment on lines +1 to +2
# Script to download Scanned Objects by Google Research dataset and Stanford models
# Distributed by CC-BY 4.0 License
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please extract Google owned code as dedicated file with own license header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants