This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Add PointCloud Segmentation (#566)
* update * wip * update * update * update * resolve issues * update * update * add doc * update * add tests * update * update tests * update on comments * update * update * resolve some bugs * remove breakpoint * Update docs/source/api/pointcloud.rst * update Co-authored-by: Ethan Harris <[email protected]>
- Loading branch information
1 parent
a340464
commit 9c42528
Showing
33 changed files
with
1,311 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
################ | ||
flash.pointcloud | ||
################ | ||
|
||
.. contents:: | ||
:depth: 1 | ||
:local: | ||
:backlinks: top | ||
|
||
.. currentmodule:: flash.pointcloud | ||
|
||
Segmentation | ||
____________ | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
:nosignatures: | ||
:template: classtemplate.rst | ||
|
||
~segmentation.model.PointCloudSegmentation | ||
~segmentation.data.PointCloudSegmentationData | ||
|
||
segmentation.data.PointCloudSegmentationPreprocess | ||
segmentation.data.PointCloudSegmentationFoldersDataSource | ||
segmentation.data.PointCloudSegmentationDatasetDataSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
.. _pointcloud_segmentation: | ||
|
||
####################### | ||
PointCloud Segmentation | ||
####################### | ||
|
||
******** | ||
The Task | ||
******** | ||
|
||
A Point Cloud is a set of data points in space, usually describes by ``x``, ``y`` and ``z`` coordinates. | ||
|
||
PointCloud Segmentation is the task of performing classification at a point-level, meaning each point will associated to a given class. | ||
The current integration builds on top `Open3D-ML <https://github.com/intel-isl/Open3D-ML>`_. | ||
|
||
------ | ||
|
||
******* | ||
Example | ||
******* | ||
|
||
Let's look at an example using a data set generated from the `KITTI Vision Benchmark <http://www.semantic-kitti.org/dataset.html>`_. | ||
The data are a tiny subset of the original dataset and contains sequences of point clouds. | ||
The data contains multiple folder, one for each sequence and a meta.yaml file describing the classes and their official associated color map. | ||
A sequence should contain one folder for scans and one folder for labels, plus a ``pose.txt`` to re-align the sequence if required. | ||
Here's the structure: | ||
|
||
.. code-block:: | ||
data | ||
├── meta.yaml | ||
├── 00 | ||
│ ├── scans | ||
| | ├── 00000.bin | ||
| | ├── 00001.bin | ||
| | ... | ||
│ ├── labels | ||
| | ├── 00000.label | ||
| | ├── 00001.label | ||
| | ... | ||
| ├── pose.txt | ||
│ ... | ||
| | ||
└── XX | ||
├── scans | ||
| ├── 00000.bin | ||
| ├── 00001.bin | ||
| ... | ||
├── labels | ||
| ├── 00000.label | ||
| ├── 00001.label | ||
| ... | ||
├── pose.txt | ||
Learn more: http://www.semantic-kitti.org/dataset.html | ||
|
||
|
||
Once we've downloaded the data using :func:`~flash.core.data.download_data`, we create the :class:`~flash.image.segmentation.data.PointCloudSegmentationData`. | ||
We select a pre-trained ``randlanet_semantic_kitti`` backbone for our :class:`~flash.image.segmentation.model.PointCloudSegmentation` task. | ||
We then use the trained :class:`~flash.image.segmentation.model.PointCloudSegmentation` for inference. | ||
Finally, we save the model. | ||
Here's the full example: | ||
|
||
.. literalinclude:: ../../../flash_examples/pointcloud_segmentation.py | ||
:language: python | ||
:lines: 14- | ||
|
||
|
||
|
||
.. image:: https://raw.githubusercontent.com/intel-isl/Open3D-ML/master/docs/images/getting_started_ml_visualizer.gif | ||
:width: 100% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from dataclasses import dataclass | ||
from typing import Callable, Optional | ||
|
||
from flash.core.data.properties import ProcessState | ||
|
||
|
||
@dataclass(unsafe_hash=True, frozen=True) | ||
class CollateFn(ProcessState): | ||
|
||
collate_fn: Optional[Callable] = None |
Oops, something went wrong.