Pytorch KITTI
This project aims to provide a simple yet effective way to scaffold and load the KITTI Vision Banchmark Dataset providing
-
Datasets: Pytorch datasets to load each dataset
-
Scaffolding: to download the datasets
-
Metrics: common metrics used for each dataset
-
Transformations: utilities to manipulate samples
Installation
To install torch-kitti
$ pip install torch-kitti
Scaffolding datasets
To manually download the datasets the torch-kitti command line utility comes in handy:
$ torch_kitti download --help
usage: Torch Kitti download [-h]
{sync_rectified,depth_completion,depth_prediction}
path
positional arguments:
{sync_rectified,depth_completion,depth_prediction}
name of the dataset to download
path where scaffold the dataset
optional arguments:
-h, --help show this help message and exit
Actually available datasets are:
- KITTI Depth Completion Dataset
- KITTI Depth Prediction Dataset
- KITTI Raw Sync+Rect Dataset
Loading Datasets
All datasets return dictionaries, utilities to manipulate them can be found in the torch_kitti.transforms module. Often each dataset provides options to include optional fields, for instance KittiDepthCompletionDataset usually provides simply the img, its sparse depth groundtruth gt and the sparse lidar hints lidar but using load_stereo=True stereo images will be included for each example.
from torchvision.transforms import Compose, RandomCrop, ToTensor
from torch_kitti.depth_completion import KittiDepthCompletionDataset
from torch_kitti.transforms import ApplyToFeatures
transform = ApplyToFeatures(
Compose(
[
ToTensor(),
RandomCrop([256, 512]),
]
),
features=["img", "gt", "lidar"],
)
ds = KittiDepthCompletionDataset(
"kitti_raw_sync_rect_root",
"kitti_depth_completion_root",
load_stereo=False,
load_sequence=3,
transform=transform,
download=True, # download if not found
)
Customizing Datasets
Each dataset exposes the elems attribute, containing the paths used by each example loaded, and it can be modified to customize the loaded data, it is composed by DataGroups each containing many DataElems. These latter can load many different file types and each loader automatically will load them if added to each DataGroup, the supported data types are image, depth, pcd, calib, imu, rt and intrinsics.
For example to load only a specific drive sequence for depth completion you could:
class SeqKittiDepthCompletionDataset(KittiDepthCompletionDataset):
def __init__(self, drive_name: str, *args, **kwargs):
super().__init__(*args, subset="all", **kwargs)
self.elems = sorted(
filter(lambda group: group.drive == drive_name and group.cam == 2, self.elems),
key=lambda group: group.idx
)
Contributing
Developing setup
Download from kitti and cd in the folder then prepare a virtual environment (1), install dev and doc dependencies (2) and pre-commit (3).
$ git clone https://github.com/andreaconti/torch_kitti.git
$ cd torch_kitti
$ python3 -m virtualenv .venv && source .venv/bin/activate # (1)
$ pip install .[dev, doc] # (2)
$ pre-commit install # (3)
$ python3 setup.py develop
$ pytest
Feel free to open an issue on GitHub, fork the repository and submit a pull request to solve bugs, improve docs, add datasets and features. All new feature must be tested.
Disclaimer on KITTI Vision Benchmark Suite
This library is an utility that downloads and prepares the dataset. The KITTI Vision Benchmark Suite is not hosted by this project nor it's claimed that you have license to use the dataset, it is your responsibility to determine whether you have permission to use this dataset under its license. You can find more details here.
Metadata
Release files for torch-kitti 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torch-kitti-1.0.1.tar.gz | 23.2 kB | Without provenance | Details for torch-kitti-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_kitti-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for torch_kitti-1.0.1-py3-none-any.whl |
Total release size: 52.8 kB
Release files / torch-kitti-1.0.1.tar.gz
| Download URL | torch-kitti-1.0.1.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bab065cb8e4c7fb65ae62c0ee6b64e10dd50ffa27c4c70322dea170dc4b3fa3
|
|
BLAKE2b-256 checksum How to use checksums |
17bda4cb8ae6cc8d43d206e2d21836ce8edbe0082305ad73856cfbdbae0eb3cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Release files / torch_kitti-1.0.1-py3-none-any.whl
| Download URL | torch_kitti-1.0.1-py3-none-any.whl |
|---|---|
| Size | 29.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36af1b367a085cd6f8599313461265a33a2b12908ae5e93d74f28ec3acd96d52
|
|
BLAKE2b-256 checksum How to use checksums |
a331c3c897fda536bf33472ac38902cb8ee0383c001b4890a876f638b568d4bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Security for torch-kitti 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.