Release KITTI-C2L v1.0.0: documented self-contained benchmark, loader and baselines
db613b6 verified Download code/tests/test_sequence_mapping.py from mcocheteux/KITTI-C2L-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.93 kB
-
https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_sequence_mapping.py
- Command line
-
hf download hf://datasets/mcocheteux/KITTI-C2L-Dataset/code/tests/test_sequence_mapping.py
-
curl -L -o test_sequence_mapping.py https://huggingface.co/datasets/mcocheteux/KITTI-C2L-Dataset/resolve/main/code/tests/test_sequence_mapping.py
1.93 kB
| from __future__ import annotations | |
| import pytest | |
| from kitti_c2l.sequence_mapping import ( | |
| ALL_SEQUENCES, | |
| AVAILABLE_SEQUENCES, | |
| TEST_SEQUENCES, | |
| TRAIN_SEQUENCES, | |
| load_sequence_mapping, | |
| ) | |
| def test_all_eleven_sequences_present(): | |
| mapping = load_sequence_mapping() | |
| assert set(mapping.keys()) == {f"{i:02d}" for i in range(11)} | |
| def test_frame_count_matches_start_end(): | |
| mapping = load_sequence_mapping() | |
| for seq_info in mapping.values(): | |
| assert seq_info.frame_count == seq_info.end - seq_info.start + 1 | |
| def test_split_assignment_matches_field_standard_protocol(): | |
| mapping = load_sequence_mapping() | |
| for seq_id in TRAIN_SEQUENCES: | |
| assert mapping[seq_id].split == "train" | |
| for seq_id in TEST_SEQUENCES: | |
| assert mapping[seq_id].split == "test" | |
| assert set(TRAIN_SEQUENCES) | set(TEST_SEQUENCES) == set(ALL_SEQUENCES) | |
| def test_raw_frame_index_offset(): | |
| mapping = load_sequence_mapping() | |
| seq08 = mapping["08"] | |
| assert seq08.raw_frame_index(0) == seq08.start == 1100 | |
| assert seq08.raw_frame_index(seq08.frame_count - 1) == seq08.end | |
| def test_raw_frame_index_out_of_range_raises(): | |
| mapping = load_sequence_mapping() | |
| seq04 = mapping["04"] | |
| with pytest.raises(IndexError): | |
| seq04.raw_frame_index(seq04.frame_count) | |
| def test_drive_name_format(): | |
| mapping = load_sequence_mapping() | |
| assert mapping["00"].drive_name == "2011_10_03_drive_0027_sync" | |
| def test_sequence_03_flagged_unavailable(): | |
| """Sequence 03's raw drive 404s on KITTI's official mirror -- see sequence_mapping.yaml.""" | |
| mapping = load_sequence_mapping() | |
| assert mapping["03"].available is False | |
| assert "03" not in AVAILABLE_SEQUENCES | |
| def test_available_sequences_are_all_except_03(): | |
| assert set(AVAILABLE_SEQUENCES) == set(ALL_SEQUENCES) - {"03"} | |
| assert all(load_sequence_mapping()[seq_id].available for seq_id in AVAILABLE_SEQUENCES) | |