-
Notifications
You must be signed in to change notification settings - Fork 154
[Doc] add tutorials for level 3 and 4 #920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
docs/source/docs/level-up/basic_skills/03_dataset_import_export.md
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
docs/source/docs/level-up/basic_skills/03_dataset_import_export.rst
This file contains hidden or 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,90 @@ | ||
| ============= | ||
| Level 3: Data Import and Export | ||
| ============= | ||
|
|
||
| Datumaro is a tool that supports public data formats across a wide range of tasks such as | ||
| classification, detection, segmentation, pose estimation, or visual tracking. | ||
| To facilitate this, Datumaro provides assistance with data import and export via both Python API and CLI. | ||
| This makes it easier for users to work with various data formats using Datumaro. | ||
|
|
||
| Prepare dataset | ||
| ============ | ||
|
|
||
| For the segmentation task, we here introduce the Cityscapes, which collects road scenes from 50 | ||
| different cities and contains 5K fine-grained pixel-level annotations and 20K coarse annotations. | ||
| More detailed description is given by :ref:`here <Cityscapes>`. | ||
| The Cityscapes dataset is available for free `download <https://www.cityscapes-dataset.com/downloads/>`_. | ||
|
|
||
| Convert data format | ||
| ============ | ||
|
|
||
| Users sometimes needs to compare, merge, or manage various kinds of public datasets in a unified | ||
| system. To achieve this, Datumaro not only has `import` and `export` funcionalities, but also | ||
| provides `convert`, which shortens the import and export into a single command line. | ||
| We now convert the Cityscapes data into the MS-COCO format, which is described in :ref:`here <COCO>`. | ||
|
|
||
|
|
||
| .. tabbed:: CLI | ||
|
|
||
| Without creation of a project, we can achieve this with a single line command `convert` in Datumaro | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum convert -if cityscapes -i <path/to/cityscapes> -f coco_panoptic -o <path/to/output> | ||
|
|
||
| .. tabbed:: Python | ||
|
|
||
| With Pthon API, we can import the data through `Dataset` as below. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from datumaro.components.dataset import Dataset | ||
|
|
||
| data_path = '/path/to/cityscapes' | ||
| data_format = 'cityscapes' | ||
|
|
||
| dataset = Dataset.import_from(data_path, data_format) | ||
|
|
||
| We then export the import dataset as | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| output_path = '/path/to/output' | ||
|
|
||
| dataset.export(output_path, format='coco_panoptic') | ||
|
|
||
| .. tabbed:: ProjectCLI | ||
|
wonjuleee marked this conversation as resolved.
|
||
|
|
||
| With the project-based CLI, we first require to create a project by | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum create -o <path/to/project> | ||
|
|
||
| We now import Cityscapes data into the project through | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum import --format cityscapes -p <path/to/project> <path/to/cityscapes> | ||
|
|
||
| (Optional) When we import a data, the change is automatically commited in the project. | ||
| This can be shown through `log` as | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum log -p <path/to/project> | ||
|
|
||
| (Optional) We can check the imported dataset information such as subsets, number of data, or | ||
| categories through `info`. | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum info -p <path/to/project> | ||
|
|
||
| Finally, we export the data within the project with MS-COCO format as | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum export --format coco -p <path/to/project> -o <path/to/save> -- --save-media | ||
|
|
||
| For a data with an unknown format, we can detect the format in the :ref:`next level <Level 4: Detect Data Format from an Unknown Dataset>`! | ||
28 changes: 0 additions & 28 deletions
28
docs/source/docs/level-up/basic_skills/04_detect_data_format.md
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
docs/source/docs/level-up/basic_skills/04_detect_data_format.rst
This file contains hidden or 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,41 @@ | ||
| ============= | ||
| Level 4: Detect Data Format from an Unknown Dataset | ||
| ============= | ||
|
|
||
| Datumaro provides a function to detect the format of a dataset before importing data. This can be | ||
| useful in cases where information about the original format of the data has been lost or is unclear. | ||
| With this function, users can easily identify the format and proceed with appropriate data | ||
| handling processes. | ||
|
|
||
| Detect data format | ||
| ============ | ||
|
|
||
| .. tabbed:: CLI | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| datum detect-format <path/to/data> | ||
|
|
||
| The printed format can be utilized as `format` argument when importing a dataset as following the | ||
| :ref:`previous level <Level 3: Data Import and Export>`. | ||
|
|
||
| .. tabbed:: Python | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from datumaro.components.environment import Environment | ||
|
|
||
| data_path = '/path/to/data' | ||
|
|
||
| env = Environment() | ||
|
|
||
| detected_formats = env.detect_dataset(data_path) | ||
|
|
||
|
|
||
| (Optional) With the detected format, we can import the dataset as below. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from datumaro.components.dataset import Dataset | ||
|
|
||
| dataset = Dataset.import_from(data_path, detected_formats[0]) |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.