-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add description for converting files
- Loading branch information
Showing
2 changed files
with
39 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.. | ||
Copyright DB Netz AG and contributors | ||
SPDX-License-Identifier: Apache-2.0 | ||
============================= | ||
1 Validating Annotation Files | ||
============================= | ||
|
||
Many annotation providers have their own proprietary format, that they use internally. If the project requirements demand the delivery of the data in the RailLabel format, then the `raillabel_providerkit.convert()` method can support you with that. | ||
|
||
.. code-block:: python | ||
from raillabel_providerkit import convert | ||
import raillabel | ||
import json # in the case the data is in the json-format | ||
with open("path/to/source/data.json") as f: | ||
raw_data = json.load(f) | ||
raillabel_scene = convert(raw_data) | ||
raillabel.save(raillabel_scene, "path/to/target/scene.json") | ||
If you have created a proper loader class for your format in the loader_classes directory, your class should be selected automatically. If not, you should contact our engineers to create one. | ||
|
||
In the case, that you do not want to publish your proprietary format, you can also keep your loader class local and provide it as a function parameter. Just make sure your loader class is a child of the `raillabel_providerkit.loader_classes.LoaderABC`-class. | ||
|
||
.. code-block:: python | ||
from raillabel_providerkit import convert | ||
import raillabel | ||
import json # in the case the data is in the json-format | ||
with open("path/to/source/data.json") as f: | ||
raw_data = json.load(f) | ||
raillabel_scene = convert(raw_data, YourLoaderClass) |
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