Release KITTI-C2L v1.0.0: documented self-contained benchmark, loader and baselines
db613b6 verified Download code/tests/test_schema.py from mcocheteux/KITTI-C2L-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_schema.py
- Command line
-
hf download hf://datasets/mcocheteux/KITTI-C2L-Dataset/code/tests/test_schema.py
-
curl -L -o test_schema.py https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_schema.py
1.76 kB
| from __future__ import annotations | |
| from pathlib import Path | |
| import pyarrow.parquet as pq | |
| from kitti_c2l.generate import generate_sequence_rows | |
| from kitti_c2l.schema import COLUMN_NAMES, SCHEMA | |
| from kitti_c2l.sequence_mapping import SequenceInfo | |
| from kitti_c2l.stages import STAGES | |
| from kitti_c2l.writer import write_split | |
| def test_parquet_round_trip(fake_kitti_root: Path, tmp_path: Path): | |
| seq_info = SequenceInfo(sequence="04", date="2011_09_30", drive="0016", start=0, end=3, frame_count=4, split="train") | |
| rows = list(generate_sequence_rows(seq_info, fake_kitti_root, stages=STAGES)) | |
| output_path = tmp_path / "train.parquet" | |
| count = write_split(rows, output_path) | |
| assert count == len(rows) | |
| table = pq.read_table(output_path) | |
| assert table.schema.equals(SCHEMA) | |
| assert table.num_rows == len(rows) | |
| first = table.to_pylist()[0] | |
| assert set(first.keys()) == set(COLUMN_NAMES) | |
| assert len(first["gt_R_cam_from_velo"]) == 9 | |
| assert len(first["camera_intrinsics"]) == 9 | |
| def test_row_values_survive_round_trip(fake_kitti_root: Path, tmp_path: Path): | |
| seq_info = SequenceInfo(sequence="04", date="2011_09_30", drive="0016", start=0, end=3, frame_count=4, split="train") | |
| rows = list(generate_sequence_rows(seq_info, fake_kitti_root, stages=STAGES[:1])) | |
| output_path = tmp_path / "train.parquet" | |
| write_split(rows, output_path) | |
| table_rows = pq.read_table(output_path).to_pylist() | |
| for original, read_back in zip(rows, table_rows, strict=True): | |
| assert read_back["sample_id"] == original.sample_id | |
| assert read_back["sample_seed"] == original.sample_seed | |
| for a, b in zip(read_back["gt_R_cam_from_velo"], original.gt_R_cam_from_velo, strict=True): | |
| assert a == b | |