Package: cpdd-dataset
CPDD-DatasetThis is the data access package for the CARLA panoramaic depth detection dataset,
created and published as part of my thesisDataset and Evaluation of Self-Supervised Learning for Panoramic Depth EstimationThe code used to generate the dataset is available athttps://github.com/rnett/CARLASim.ExampleSet the environment variableCARLA_DOWNLOAD_LOCATIONto wherever you want to keep the data.Then, loading the data is as simple as:importcpdd_datasettrain_configs=cpdd_dataset.config.load_csv("train_data.csv")train_data=[]forconfigintrain_configs:withconfig.cylindrical_data.download()asdata:train_data.append({"color":data.color,"depth":data.depth})You can make a csv file structured like:city,rain,time,num_cars,num_peds,index
Town01,Clear,Noon,*,*,2and load it in a single line:carla_dataset.data.load_csv("train.csv").If you need camera intrinsics,CylindricalIntrinsics,SphericalIntrinsics,PinholeIntrinsics, andPinhole90Intrinsics(see Utilities) classes are available indata, and provide the intrinsics values and matrix.K=CylindricalIntrinsics().KStructureData LocationTo set the dataset download/loading location, you can usedata.set_download_location, andget_download_locationto get it.
However, this is not advised.
Instead, set the environment variableCARLA_DOWNLOAD_LOCATION.
The above methods are simply wrappers around it.
It is loaded usingpathlib.Path, so use whatever path format your machine does.ConfigEach simulation run is represented by aconfig.Configobject, which contains the simulation parameters
(city, rain, number of pedestrians, etc) necessary to get the location of the data files.
It provides utility methods and properties based on this, including getting data files for pinhole, cylindrical,
spherical, and pose data, getting the local and remote locations, and downloading all of the data files.LoadingAConfigcan be constructed manually or from the folder name (usingConfig.from_folder_name),
but will probably be loaded fromconfig.expand_wildcards.expand_wildcardsfillsNoneparameters will all valid values.
You probably don't need to use it directly, as loader methodsload_df,load_csv, andload_textmethods are provided, as well asall.Data FilesData files can be gotten fromConfigobjects, and represent a data file.
They havedownloadmethods that accept aforceparameter, anis_downloaded()method, and adataproperty.
Non-pose data files also have anintrinsicsproperty to get the associated intrinsics (described later).
Thedataproperty opens and loads the file, returning aDataFile.DataFiles also work with Python'swithblocks, and can be used likewith file as data:.
This has the advantage of automatically closing the file.
The pinhole data file also exposes side methodstop,bottom, etc. to get individual sides'
groups within the pinhole data file, and a__getitem__operator that takes adata.Sideto do the same.DataThe data objects gotten from data files expose the ndarray data for the training run.
Pinhole data (gotten from pinhole data files) has properties to get the data for each side.
Pinhole side data (gotten from side data files), cylindrical data, and spherical data havergbanddepthproperties
that return their respective data asnumpyndarrays.
Both are of shape[batch, height, width, channels], where color images have 3 channels (RGB) and depth images have 1.
Depth images areuint16and have the depth in decimeters, while color images are the standarduint8.
Pinhole images are 768x768, while cylindrical and spherical images are 2048x1024 (width x height).Pose data objects have fieldsabsolute_pose,relative_pose, andstart_relative_pose.
Relative pose is relative to the last pose value, while start relative pose is relative to the inital post of that simulation.
Pose data is shape[batch, 6], where the 6 values are[X, Y, Z, x, y, z]where[X, Y, Z]is the position in meters, and[x, y, z]is the unit heading vector of the car.IntrinsicsCylindricalIntrinsics,SphericalIntrinsics,PinholeIntrinsics, andPinhole90Intrinsics(see Utilities) are available indata, and provide the intrinsics values and matrix.
Each object hasK,normalized_K,height,width,f_x,f_y,c_x,c_y, andfov(degrees) fields.UtilitiesA methoddata.crop_pinhole_to_90is provided to crop the 100 degree FOV pinhole images into 90 degree FOV images of the same size.
It usescv2.getRectSubPixinternally.
The intrinsics for these images are provided byPinhole90Intrinsicsusing the same format as other intrinsics.