Release KITTI-C2L v1.0.0: documented self-contained benchmark, loader and baselines
db613b6 verified Download code/tests/test_visualize_projection.py from mcocheteux/KITTI-C2L-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_visualize_projection.py
- Command line
-
hf download hf://datasets/mcocheteux/KITTI-C2L-Dataset/code/tests/test_visualize_projection.py
-
curl -L -o test_visualize_projection.py https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_visualize_projection.py
1.92 kB
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| pytest.importorskip("matplotlib") | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "scripts")) | |
| from visualize_projection import visualize # noqa: E402 | |
| from kitti_c2l.generate import generate_sequence_rows | |
| from kitti_c2l.sequence_mapping import SequenceInfo | |
| from kitti_c2l.stages import STAGES | |
| from kitti_c2l.writer import write_split | |
| def demo_parquet(fake_kitti_root: Path, tmp_path: Path) -> Path: | |
| seq_info = SequenceInfo(sequence="04", date="2011_09_30", drive="0016", start=0, end=3, frame_count=4, split="train") | |
| rows = generate_sequence_rows(seq_info, fake_kitti_root, stages=STAGES) | |
| output_path = tmp_path / "train.parquet" | |
| write_split(rows, output_path) | |
| return output_path | |
| def test_visualize_all_stages_for_a_frame(fake_kitti_root: Path, demo_parquet: Path, tmp_path: Path): | |
| output_path = visualize( | |
| demo_parquet, fake_kitti_root, tmp_path / "overlay.png", sequence="04", frame=1 | |
| ) | |
| assert output_path.exists() | |
| assert output_path.stat().st_size > 0 | |
| def test_visualize_single_stage_by_sample_id(fake_kitti_root: Path, demo_parquet: Path, tmp_path: Path): | |
| output_path = visualize( | |
| demo_parquet, fake_kitti_root, tmp_path / "overlay.png", sample_id="04_000002_stage3" | |
| ) | |
| assert output_path.exists() | |
| def test_visualize_stage_filter(fake_kitti_root: Path, demo_parquet: Path, tmp_path: Path): | |
| output_path = visualize( | |
| demo_parquet, fake_kitti_root, tmp_path / "overlay.png", sequence="04", frame=0, stages={1, 5} | |
| ) | |
| assert output_path.exists() | |
| def test_visualize_unknown_sample_id_raises(fake_kitti_root: Path, demo_parquet: Path, tmp_path: Path): | |
| with pytest.raises(ValueError, match="No row"): | |
| visualize(demo_parquet, fake_kitti_root, tmp_path / "overlay.png", sample_id="does_not_exist") | |