Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Relifest committed Nov 22, 2024
1 parent 7b0f763 commit ea5d650
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 25 deletions.
59 changes: 35 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,53 @@ The training dataset can also be encoded to TrainingDML-AI JSON format with Pyth

```python
from pytdml.io import write_to_json
from pytdml.type import EOTrainingDataset, EOTrainingData, EOTask, EODataSource, SceneLabel
from pytdml.type import EOTrainingDataset, AI_EOTrainingData, AI_EOTask, AI_SceneLabel

# generate EO training dataset
dataset = EOTrainingDataset(
id='...',
name='...',
description='...',
license='...',
tasks=[
AI_EOTask(
id='...',
task_type='...'),
...
],
data=[
EOTrainingData(
AI_EOTrainingData(
id='...',
data_URL='...',
labels=[
SceneLabel(
label_class='...',
data_url='...',
date_time='...'),
AI_SceneLabel(
label_class='...'
),
...
]),
...
],
version="...",

amount_of_training_data=...,
created_time="...",
updated_time="...",
providers=["..."],
keywords=["...", "..."],
tasks=[EOTask(task_type="...",
description="...")],
data_sources=[EODataSource(
id="...",
data_type="...",
resolution="..."
)],
classes=["...", "...", "..."],
classification_scheme='...',
created_time="...",
data_sources=['...'],
doi='...',
keywords=['...', '...'],
number_of_classes=...,
bands=["...", "...", "..."],
image_size="..."
providers=['...'],
scope=...,
statistics_info=[...],
updated_time='...',
version='...',
labeling=[...],
metrics_in_LIT=[...],
quality=[...],
changesets=[...],
bands=[...],
extent=[...],
image_size='...'
)
# write to json
write_to_json(dataset, "dataset.json")
Expand Down Expand Up @@ -362,14 +373,14 @@ for e in range(100):

### Convert other EO dataset formats to TrainingDML-AI format

- convert coco format to TrainingDMl-AI format:
- convert stac format to TrainingDMl-AI format:

```python
from pytdml.convert_utils import convert_coco_to_tdml,convert_stac_to_tdml
from pytdml.io.stac_converter import convert_stac_to_tdml

coco_path = "/mnt/example/coco_file.json"
stac_path = "/mnt/example/stac_file.json"
output_path = "convert_result.json"

convert_coco_to_tdml(coco_path, output_path)
dataset = convert_stac_to_tdml(stac_path)
```

2 changes: 1 addition & 1 deletion pytdml/type/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from .basic_types import TrainingDataset
from .extended_types import AI_PixelLabel
from .extended_types import AI_ObjectLabel
from .extended_types import AI_ObjectLabel
from .extended_types import AI_SceneLabel
from .extended_types import AI_EOTask
from .extended_types import AI_EOTrainingData
from .extended_types import EOTrainingDataset
3 changes: 3 additions & 0 deletions pytdml/yaml_to_tdml.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,6 @@ def main():
training_datasets = yaml_to_tdml(yaml_path)
if training_datasets:
write_to_json(training_datasets, json_path)

if __name__ == '__main__':
main()

0 comments on commit ea5d650

Please sign in to comment.