Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kitti: Documentation #288

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions alodataset/kitti_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@


class KittiObjectDataset(BaseDataset, SplitMixin):
"""
Object Task from KITTI dataset.
Parameters
----------
name : str
Name of the dataset.
right_frame : bool
If True, load the right frame.
context_images : int
Number of image before the main frame to load (max 3).
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Get all the training samples:
>>> dataset = KittiObjectDataset(right_frame=True, context_images=3, split=Split.TRAIN)
>>> # Get the annotated image from the left camera from the testing set:
>>> dataset = KittiObjectDataset(right_frame=False, context_images=0, split=Split.TEST)
"""
SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}
LABELS = ["Car", "Van", "Truck", "Pedestrian", "Person_sitting", "Cyclist", "Tram", "Misc", "DontCare"]

Expand Down
29 changes: 29 additions & 0 deletions alodataset/kitti_odometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@


class KittiOdometryDataset(BaseDataset, SplitMixin):
"""
Odometry Task from KITTI dataset.
Parameters
----------
name : str
Name of the dataset
sequences : str | List[str] | None
List of sequences to load. If None, all sequences are loaded.
grayscale : bool
If True, load grayscale images. Otherwise, load RGB images.
right_frame : bool
If True, load right frame images.
sequence_size : int
Number of images per item.
skip : int
Number of images to skip between each image in the sequence.
sequence_skip : int
Nunber of sequences to skip between each item.
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load all training sequences with 3 images per item and 3 image from right camera
>>> dataset = KittiOdometryDataset(split=Split.TRAIN, sequence_size=3, right_frame=True)
>>> # Load all training sequences from sequence 00 and 03 with 5 images per item
>>> dataset = KittiOdometryDataset(split=Split.TRAIN, sequences=["00", "03"], sequence_size=5, right_frame=False)
"""

def __init__(
self,
name="kitti_odometry",
Expand Down
27 changes: 27 additions & 0 deletions alodataset/kitti_road.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,34 @@

from alodataset.utils.kitti import load_calib_cam_to_cam


class KittiRoadDataset(BaseDataset, SplitMixin):
"""
Road task from Kitti dataset.
Parameters
----------
name : str
Name of the dataset.
right_frame : bool
If True, load the right frame.
grayscale : bool
If True, load the grayscale images.
environement : str
Environement to load. Must be in ['um', 'umm', 'uu'].
(urban marked, urban unmarked multiple lanes, urban unmarked)
obj : str
Can be set to 'lane' if environement is 'um'.
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load urban marked environement with lane object:
>>> dataset = KittiRoadDataset(environement="um", obj="lane")
>>> # Load urban unmarked environement with road object with grayscale images:
>>> dataset = KittiRoadDataset(environement="uu", obj="road", grayscale=True)
"""

SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}

def __init__(self, name="kitti_road", right_frame=False, grayscale=False, environement="um", obj="road", **kwargs):
Expand Down
19 changes: 17 additions & 2 deletions alodataset/kitti_semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@
from typing import Union

from alodataset import BaseDataset, Split, SplitMixin
from aloscene import Frame, Mask, Labels, BoundingBoxes2D
from aloscene.camera_calib import CameraIntrinsic, CameraExtrinsic
from aloscene import Frame, Mask, Labels


class KittiSemanticDataset(BaseDataset, SplitMixin):
"""
Semantic task from Kitti dataset.
Parameters
----------
name : str
Name of the dataset.
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load kitti training semantic dataset
>>> dataset = KittiSemanticDataset(split=Split.TRAIN)
>>> # Load kitti testing semantic dataset
>>> dataset = KittiSemanticDataset(split=Split.TEST)
"""
SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}

def __init__(self, name="kitti_semantic", **kwargs):
Expand Down
34 changes: 34 additions & 0 deletions alodataset/kitti_stereo_flow2012.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,40 @@


class KittiStereoFlow2012(BaseDataset, SplitMixin):
"""
Stereo, Flow tasks from Kitti 2012 dataset.
Parameters
----------
name : str
Name of the dataset
grayscale : bool
If True, load images in grayscale
sequence_start : int
20 images are available for each item. Only image 10 is annotated.
sequence_start is the first image to load.
sequence_end : int
sequence_end is the last image to load.
load : list
List of data to load. Available data are:
- right: right image
- disp_noc: disparity map without occlusions
- disp_occ: disparity map with occlusions
- disp_refl_noc: disparity map without occlusions and reflections
- disp_refl_occ: disparity map with occlusions and reflections
- flow_noc: flow map without occlusions
- flow_occ: flow map with occlusions
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load only annotated images with all available data
>>> kitti_stereo = KittiStereoFlow2012(sequence_start=10, sequence_end=10, split=Split.TRAIN)
>>> # Load only annotated images with no data except right image
>>> kitti_stereo = KittiStereoFlow2012(load=["right"], sequence_start=10, sequence_end=10, split=Split.TRAIN)
>>> # Load only all trainging images with all available data
>>> kitti_stereo = KittiStereoFlow2012(sequence_start=0, sequence_end=20, split=Split.TRAIN)
"""
SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}

def __init__(
Expand Down
34 changes: 34 additions & 0 deletions alodataset/kitti_stereo_flow_sflow2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,40 @@


class KittiStereoFlowSFlow2015(BaseDataset, SplitMixin):
"""
Stereo, Flow, SceneFlow Tasks from Kitti 2015 dataset.
Parameters
----------
name : str
Name of the dataset
sequence_start : int
20 images are available for each item. Only image 10 and 11 are annotated.
sequence_start is the first image to load.
sequence_end : int
sequence_end is the last image to load.
grayscale : bool
If True, load images in grayscale.
load : List[str]
List of data to load. Available data are:
- right: right image
- disp_noc: disparity map without occlusions
- disp_occ: disparity map with occlusions
- flow_occ: flow map with occlusions
- flow_noc: flow map without occlusions
- scene_flow: scene flow map
- obj_map: object map
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load dataset with only the 2 annotated images
>>> dataset = KittiStereoFlowSFlow2015(sequence_start=10, sequence_end=11)
>>> # Load dataset with 3 context images before the 2 annotated images
>>> dataset = KittiStereoFlowSFlow2015(sequence_start=7, sequence_end=11)
>>> # Load dataset with all the context images
>>> dataset = KittiStereoFlowSFlow2015(sequence_start=0, sequence_end=20)
"""
SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}

def __init__(
Expand Down
26 changes: 26 additions & 0 deletions alodataset/kitti_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,32 @@


class KittiTrackingDataset(BaseDataset, SplitMixin):
"""
Tracking task from KITTI dataset.
Parameters
----------
name : str
Name of the dataset
sequences : int | list[str] | None
List of sequences to load. If None, all sequences are loaded.
right_frame : bool
If True, load the right frame.
sequence_size : int
Number of frames in a sequence.
skip : int
Number of frames to skip between two frames in a sequence.
sequence_skip : int
Nunber of sequences to skip between each item.
split : Split
Split of the dataset. Can be `Split.TRAIN` or `Split.TEST`.

Examples
--------
>>> # Load the first sequence without the right frame
>>> dataset = KittiTrackingDataset(sequences=0, right_frame=False)
>>> # Load the sequences 0, 1 and 2 with 4 image per item
>>> dataset = KittiTrackingDataset(sequences=["0000", "0001", "0002"], sequence_size=4)
"""
SPLIT_FOLDERS = {Split.TRAIN: "training", Split.TEST: "testing"}
LABELS = ["Car", "Van", "Truck", "Pedestrian", "Person_sitting", "Cyclist", "Tram", "Misc", "DontCare"]

Expand Down