Package: torch-kitti
Pytorch KITTIThis project aims to provide a simple yet effective way to scaffold and load theKITTI Vision Banchmark DatasetprovidingDatasets: Pytorch datasets to load each datasetScaffolding: to download the datasetsMetrics: common metrics used for each datasetTransformations: utilities to manipulate samplesInstallationTo installtorch-kitti$pipinstalltorch-kittiScaffolding datasetsTo manually download the datasets thetorch-kitticommand line utility comes in handy:$torch_kittidownload--help
usage:TorchKittidownload[-h]{sync_rectified,depth_completion,depth_prediction}path

positionalarguments:{sync_rectified,depth_completion,depth_prediction}nameofthedatasettodownloadpathwherescaffoldthedataset

optionalarguments:-h,--helpshowthishelpmessageandexitActually available datasets are:KITTI Depth Completion DatasetKITTI Depth Prediction DatasetKITTI Raw Sync+Rect DatasetLoading DatasetsAll datasets return dictionaries, utilities to manipulate them can be found in thetorch_kitti.transformsmodule. Often each dataset provides options to include optional fields, for instanceKittiDepthCompletionDatasetusually provides simply theimg, its sparse depth groundtruthgtand the sparse lidar hintslidarbut usingload_stereo=Truestereo images will be included for each example.fromtorchvision.transformsimportCompose,RandomCrop,ToTensorfromtorch_kitti.depth_completionimportKittiDepthCompletionDatasetfromtorch_kitti.transformsimportApplyToFeaturestransform=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 DatasetsEach dataset exposes theelemsattribute, containing the paths used by each example loaded, and it can be modified to customize the loaded data, it is composed byDataGroups each containing manyDataElems. 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:classSeqKittiDepthCompletionDataset(KittiDepthCompletionDataset):def__init__(self,drive_name:str,*args,**kwargs):super().__init__(*args,subset="all",**kwargs)self.elems=sorted(filter(lambdagroup:group.drive==drive_nameandgroup.cam==2,self.elems),key=lambdagroup:group.idx)ContributingDeveloping setupDownload from kitti andcdin the folder then prepare a virtual environment (1), installdevanddocdependencies (2) andpre-commit(3).$gitclonehttps://github.com/andreaconti/torch_kitti.git
$cdtorch_kitti
$python3-mvirtualenv.venv&&source.venv/bin/activate# (1)$pipinstall.[dev,doc]# (2)$pre-commitinstall# (3)$python3setup.pydevelop
$pytestFeel free to open an issue onGitHub, fork therepositoryand submit a pull request to solve bugs, improve docs, add datasets and features. All new feature must be tested.Disclaimer on KITTI Vision Benchmark SuiteThis 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 detailshere.