-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,61 @@ | ||
# Lanelet2 ML Converter | ||
|
||
Converter module to convert Lanelet2 maps into local label instances for machine learning tasks. | ||
Converter module to convert Lanelet2 maps into local instance labels for machine learning tasks. | ||
|
||
![](doc/summary_flowchart.png) | ||
|
||
## Usage Examples | ||
|
||
### Python | ||
|
||
```python | ||
import lanelet2 | ||
from lanelet2.core import BasicPoint2d | ||
from lanelet2.ml_converter import MapDataInterface | ||
|
||
pos = BasicPoint2d(10, 10) # set your local reference frame origin | ||
yaw = 0 # set your local reference frame yaw angle (heading) | ||
mDataIf = MapDataInterface(ll2_map) # get the MapDataInterface object and pass the ll2 map | ||
mDataIf.setCurrPosAndExtractSubmap(pos, yaw) # extract the local submap | ||
lData = mDataIf.laneData(True) # get the LaneData local instance labels | ||
tfData = lData.getTensorFeatureData(True, False) # get the local instance labels as numpy arrays | ||
``` | ||
|
||
### C++ | ||
```c++ | ||
#include "lanelet2_ml_converter/MapData.h" | ||
#include "lanelet2_ml_converter/MapDataInterface.h" | ||
#include "lanelet2_ml_converter/MapFeatures.h" | ||
|
||
using TensorData = lanelet::ml_converter::LaneData::TensorFeatureData; | ||
|
||
lanelet::BasicPoint2d pos(10, 10); // set your local reference frame origin | ||
double yaw = 0; // set your local reference frame yaw angle (heading) | ||
MapDataInterface mDataIf(laneletMap); // get the MapDataInterface object and pass the ll2 map | ||
mDataIf.setCurrPosAndExtractSubmap(pos, yaw); // extract the local submap | ||
lanelet::ml_converter::LaneData lData = mDataIf.laneData(True); // get the LaneData local instance labels | ||
TensorData tData = lData.getTensorFeatureData(True, False); // get the local instance labels as Eigen mats | ||
``` | ||
## Components | ||
### `MapDataInterface` | ||
Main interface class that is used to generate `LaneData` objects. | ||
### `LaneData` | ||
`LaneData` objects hold all local instance labels of a local reference frame pose. | ||
### `TensorFeatureData` | ||
Subclass of `LaneData` that holds all local instance label in a convenient numpy array / Eigen matrix form. | ||
### `LaneLineStringFeature` / `CompoundLaneLineStringFeature` / `LaneletFeature` / ... | ||
Each object of these classes holds a single instance label. You can access various information such as the map element ID and the raw or partially processed LineStrings. | ||
## Important to know | ||
- **Road border tagging**: To correctly recognize road borders, they must be tagged as such! It is not possible to automatically recognize untagged road borders, they will be processed as lane dividers. | ||
- **Python numpy arrays**: To make it possible to convert the underlying Eigen matrices to numpy arrays, they are copied for each access (such as calling `getTensorFeatureData`). This means that if you change a numpy array returned from a function like this, the underlying Eigen matrix or object will not be modified! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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