tools.writer module#
Defines OVWriter class to write generated data on a file system.
- class tools.writer.NullWriter#
Bases:
object
Represents a non-instantiated OV Writer. Follows Null Object design pattern.
- attach(camera_renders: List[Any]) None #
Duck-type interface of null object for OV Writer.
- Parameters:
camera_render (List[Any]) – List of camera renders belonging to the camera setup.
- create(scenario_name: str) str #
Duck-type interface of null object for OV Writer.
- Parameters:
scenario_name (str) – scenario name.
- Returns:
Returns the name name of created writer. This name is used later on to delete the writer.
- Return type:
str
- initialize(**kwargs: Any) None #
Duck-type interface of null object for OV Writer.
- class tools.writer.OVWriter(fs_store_path: str, write_rgb: bool, write_bounding_box_2d_tight: bool, write_bounding_box_2d_loose: bool, write_semantic_segmentation: bool, write_instance_segmentation: bool, write_distance_to_camera: bool, write_distance_to_image_plane: bool, write_bounding_box_3d: bool, write_occlusion: bool, write_normals: bool, write_motion_vectors: bool, write_camera_params: bool)#
Bases:
object
Defines OVWriter class to write generated data on file system.
- fs_store_path#
Defines Writer output folder path.
- Type:
str
- writer#
Stores actual OV writer used to save data. NullWriter is used before OV Writer is instantiated.
- Type:
Union[NullWriter, WriterTemplate]
- writer_name#
OV Writer type name.
- Type:
str
- write_rgb#
True will generate RGB images.
- Type:
bool
- write_bounding_box_2d_tight#
True will generate 2D bboxes, not covering obscured object’s parts.
- Type:
bool
- write_bounding_box_2d_loose#
True will generate 2D bboxes, covering also obscured object’s parts.
- Type:
bool
- write_semantic_segmentation#
True will generate semantic segmentaion annotations.
- Type:
bool
- write_instance_segmentation#
True will generate instance segmentation annotations.
- Type:
bool
- write_distance_to_camera#
True will generate inverse depth map to camera.
- Type:
bool
- write_distance_to_image_plane#
True will generate inverse depth map to image plane.
- Type:
bool
- write_bounding_box_3d#
True will generate 3D bounding boxes.
- Type:
bool
- write_occlusion#
TODO add the description.
- Type:
bool
- write_normals#
True will generate normals for each pixels in the image.
- Type:
bool
- write_motion_vectors#
True will generate motion vector of the pixels inside the image.
- Type:
bool
- write_camera_params#
True will store camera’s parameters (intrinsics, extrinsics).
- Type:
bool
- __init__(fs_store_path: str, write_rgb: bool, write_bounding_box_2d_tight: bool, write_bounding_box_2d_loose: bool, write_semantic_segmentation: bool, write_instance_segmentation: bool, write_distance_to_camera: bool, write_distance_to_image_plane: bool, write_bounding_box_3d: bool, write_occlusion: bool, write_normals: bool, write_motion_vectors: bool, write_camera_params: bool) None #
Init.
- Parameters:
fs_store_path (str) – Defines Writer output folder path.
write_rgb (bool) – True will generate RGB images.
write_bounding_box_2d_tight (bool) – True will generate 2D bboxes, not covering obscured object’s parts.
write_bounding_box_2d_loose (bool) – True will generate 2D bboxes, covering also obscured object’s parts.
write_semantic_segmentation (bool) – True will generate semantic segmentaion annotations.
write_instance_segmentation (bool) – True will generate instance segmentation annotations.
write_distance_to_camera (bool) – True will generate inverse depth map to camera.
write_distance_to_image_plane (bool) – True will generate inverse depth map to image plane.
write_bounding_box_3d (bool) – True will generate 3D bounding boxes.
write_occlusion (bool) – TODO add the description.
write_normals (bool) – True will generate normals for each pixels in the image.
write_motion_vectors (bool) – True will generate motion vector of the pixels inside the image.
write_camera_params (bool) – True will store camera’s parameters (intrinsics, extrinsics).
- attach(camera_renders: List[Any]) None #
Attaches <camera_renders> camera renders to the writer to capture images from that cameras in the camera setup.
- Parameters:
camera_render (List[Any]) – List of camera renders belonging to the camera setup.
- create(scenario_name: str, frames_readout_offset: int) str #
Creates a writer for given <scenario_name> scenario. It creates a new folder with <scenario_name> name on <fs_store_path> path to sepearte data for each scenario.
- Parameters:
scenario_name (str) – scenario name.
frames_readout_offset (int) – Scenario’s frames readout offset before saving a frame.
- Returns:
Returns the name name of created writer. This name is used later on to delete the writer.
- Return type:
str