Spaces:
Running on Zero
Running on Zero
Download tests/test_evaluate_pointcloud.py from junaid-simamdigital/Simam3D-GPU: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/junaid-simamdigital/Simam3D-GPU/resolve/main/tests/test_evaluate_pointcloud.py
- Command line
-
hf download hf://spaces/junaid-simamdigital/Simam3D-GPU/tests/test_evaluate_pointcloud.py
-
curl -L -o test_evaluate_pointcloud.py https://huggingface.co/spaces/junaid-simamdigital/Simam3D-GPU/resolve/main/tests/test_evaluate_pointcloud.py
1.23 kB
| import numpy as np | |
| from evaluate_pointcloud import load_points, pointcloud_metrics | |
| def test_pointcloud_metrics_is_perfect_for_identical_clouds(): | |
| points = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0]], dtype=float) | |
| metrics = pointcloud_metrics(points, points, threshold=0.01) | |
| assert metrics["chamfer_l1"] == 0.0 | |
| assert metrics["precision"] == 1.0 | |
| assert metrics["recall"] == 1.0 | |
| assert metrics["fscore"] == 1.0 | |
| def test_pointcloud_metrics_exposes_one_sided_missing_geometry(): | |
| prediction = np.array([[0, 0, 0], [1, 0, 0]], dtype=float) | |
| reference = np.array([[0, 0, 0], [1, 0, 0], [2, 0, 0]], dtype=float) | |
| metrics = pointcloud_metrics(prediction, reference, threshold=0.1) | |
| assert metrics["precision"] == 1.0 | |
| assert metrics["recall"] < 1.0 | |
| assert metrics["fscore"] < 1.0 | |
| def test_load_points_reads_simam3d_ascii_ply(tmp_path): | |
| path = tmp_path / "points.ply" | |
| path.write_text("\n".join([ | |
| "ply", "format ascii 1.0", "element vertex 2", "property float x", | |
| "property float y", "property float z", "end_header", "0 1 2 99", "3 4 5 88", "", | |
| ]), encoding="utf-8") | |
| assert np.array_equal(load_points(path), np.array([[0, 1, 2], [3, 4, 5]], dtype=float)) | |