Download examples/visualizer_code/source/tests/test_scale4d_camera_ablation.py from facebook/SCALE4D: direct link, hf CLI and curl.
- Browser
- Download file 702 Bytes
-
https://huggingface.co/facebook/SCALE4D/resolve/main/examples/visualizer_code/source/tests/test_scale4d_camera_ablation.py
- Command line
-
hf download hf://facebook/SCALE4D/examples/visualizer_code/source/tests/test_scale4d_camera_ablation.py
-
curl -L -o test_scale4d_camera_ablation.py https://huggingface.co/facebook/SCALE4D/resolve/main/examples/visualizer_code/source/tests/test_scale4d_camera_ablation.py
702 Bytes
| import numpy as np | |
| from evaluation.ucpe_inputs import ClipLabels | |
| from evaluation.ucpe_scores import score_tracks | |
| def test_frames_before_and_at_the_query_do_not_affect_masked_scores(): | |
| gt = np.zeros((4, 1, 3), np.float32) | |
| prediction = gt.copy() | |
| prediction[:2, :, 0] = 10 | |
| labels = ClipLabels(gt, np.ones((4, 1), bool)) | |
| probability = np.ones((4, 1), np.float32) | |
| mask = np.arange(4)[:, None] > 1 | |
| masked = score_tracks(labels, prediction, probability, evaluation_mask=mask) | |
| assert masked["metric"]["aj"] == 100 | |
| assert masked["metric"]["apd"] == 100 | |
| assert masked["metric"]["epe"] == 0 | |
| assert score_tracks(labels, prediction, probability)["metric"]["aj"] < 100 | |