# Supervisely Point Cloud ## Format specification Specification for the Point Cloud data format is available [here](https://docs.supervise.ly/data-organization/00_ann_format_navi). You can also find examples of working with the dataset [here](https://drive.google.com/file/d/1BtZyffWtWNR-mk_PHNPMnGgSlAkkQpBl/view). Supported annotation types: - `cuboid_3d` Supported annotation attributes: - `track_id` (read/write, integer), responsible for `object` field - `createdAt` (write, string), - `updatedAt` (write, string), - `labelerLogin` (write, string), responsible for the corresponding fields in the annotation file. - arbitrary attributes Supported image attributes: - `description` (read/write, string), - `createdAt` (write, string), - `updatedAt` (write, string), - `labelerLogin` (write, string), responsible for the corresponding fields in the annotation file. - `frame` (read/write, integer). Indicates frame number of the image. - arbitrary attributes ## Import Supervisely Point Cloud dataset An example dataset in Supervisely Point Cloud format is available for download: Point Cloud dataset directory should have the following structure: ``` └─ Dataset/ ├── ds0/ │ ├── ann/ │ │ ├── │ │ ├── │ │ └── ... │ ├── pointcloud/ │ │ ├── │ │ ├── │ │ └── ... │ ├── related_images/ │ │ ├── / │ │ | ├── │ │ | ├── │ │ └── ... ├── key_id_map.json └── meta.json ``` There are two ways to import a Supervisely Point Cloud dataset: ```bash datum create datum import --format sly_pointcloud --input-path ``` or ``` bash datum create datum import -f sly_pointcloud ``` To make sure that the selected dataset has been added to the project, you can run `datum project info`, which will display the project and dataset information. ## Export to other formats Datumaro can convert Supervisely Point Cloud dataset into any other format [Datumaro supports](/docs/user-manual/supported_formats/). Such conversion will only be successful if the output format can represent the type of dataset you want to convert, e.g. 3D point clouds can be saved in `KITTI Raw` format, but not in `COCO keypoints`. There are several ways to convert a Supervisely Point Cloud dataset to other dataset formats: ``` bash datum create datum import -f sly_pointcloud datum export -f kitti_raw -o ``` or ``` bash datum convert -if sly_pointcloud -i -f kitti_raw ``` Or, using Python API: ```python from datumaro.components.dataset import Dataset dataset = Dataset.import_from('', 'sly_pointcloud') dataset.export('save_dir', 'kitti_raw', save_images=True) ``` ## Export to Supervisely Point Cloud There are several ways to convert a dataset to Supervisely Point Cloud format: ``` bash # export dataset into Supervisely Point Cloud format from existing project datum export -p -f sly_pointcloud -o \ -- --save-images ``` ``` bash # converting to Supervisely Point Cloud format from other format datum convert -if kitti_raw -i \ -f sly_pointcloud -o -- --save-images ``` Extra options for exporting in Supervisely Point Cloud format: - `--save-images` allow to export dataset with saving images. This will include point clouds and related images (by default `False`) - `--image-ext IMAGE_EXT` allow to specify image extension for exporting dataset (by default - keep original or use `.png`, if none) - `--reindex` assigns new indices to frames and annotations. - `--allow-undeclared-attrs` allows writing arbitrary annotation attributes. By default, only attributes specified in the input dataset metainfo will be written. ## Examples ### Example 1. Import dataset, compute statistics ```bash datum create -o project datum import -p project -f sly_pointcloud ../sly_dataset/ datum stats -p project ``` ### Example 2. Convert Supervisely Point Clouds to KITTI Raw ``` bash datum convert -if sly_pointcloud -i ../sly_pcd/ \ -f kitti_raw -o my_kitti/ -- --save-images --reindex --allow-attrs ``` ### Example 3. Create a custom dataset ``` python from datumaro.components.annotation import Cuboid3d from datumaro.components.dataset import Dataset from datumaro.components.extractor import DatasetItem dataset = Dataset.from_iterable([ DatasetItem(id='frame_1', annotations=[ Cuboid3d(id=206, label=0, position=[320.86, 979.18, 1.04], attributes={'occluded': False, 'track_id': 1, 'x': 1}), Cuboid3d(id=207, label=1, position=[318.19, 974.65, 1.29], attributes={'occluded': True, 'track_id': 2}), ], pcd='path/to/pcd1.pcd', attributes={'frame': 0, 'description': 'zzz'} ), DatasetItem(id='frm2', annotations=[ Cuboid3d(id=208, label=1, position=[23.04, 8.75, -0.78], attributes={'occluded': False, 'track_id': 2}) ], pcd='path/to/pcd2.pcd', related_images=['image2.png'], attributes={'frame': 1} ), ], categories=['cat', 'dog']) dataset.export('my_dataset/', format='sly_pointcloud', save_images=True, allow_undeclared_attrs=True) ``` Examples of using this format from the code can be found in [the format tests](https://github.com/openvinotoolkit/datumaro/tree/develop/tests/test_sly_pointcloud_format.py)