Skip to content
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

Update multi-label document and conversion script #2358

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Dataset Format
**************

As it is a common practice to use object detection datasets in the academic area, we support the most popular object detection format: `COCO <https://cocodataset.org/#format-data>`_.
Specifically, this format should be converted in our `internal representation <https://github.com/openvinotoolkit/training_extensions/tree/develop/data/datumaro_multilabel>`_ first. We provided a `script <https://github.com/openvinotoolkit/training_extensions/blob/develop/src/otx/algorithms/classification/utils/convert_coco_to_multilabel.py>` to help with conversion.
Specifically, this format should be converted in our `internal representation <https://github.com/openvinotoolkit/training_extensions/tree/develop/tests/assets/datumaro_multilabel>`_ first. We provided a `script <https://github.com/openvinotoolkit/training_extensions/blob/develop/src/otx/algorithms/classification/utils/convert_coco_to_multilabel.py>` to help with conversion.
To convert the COCO data format to our internal one, run this script in similar way:

.. code-block::
Expand All @@ -35,6 +35,9 @@ To convert the COCO data format to our internal one, run this script in similar

Please, refer to our :doc:`dedicated tutorial <../../../tutorials/base/how_to_train/classification>` for more information how to train, validate and optimize classification models.

.. note::
For now, "___" is a symbol to distinguish the multi-label format. So, it must be included at the front of the label name.

******
Models
******
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def coco_to_datumaro_multilabel(ann_file_path: str, data_root_dir: str, output:
overall_classes: List = coco_dataset.get_classes()
for class_name in overall_classes:
multilabel_ann_format["categories"]["label"]["label_groups"].append(
{"name": str(class_name), "group_type": "exclusive", "labels": [str(class_name)]}
{"name": f"___{str(class_name)}", "group_type": "exclusive", "labels": [str(class_name)]}
)

multilabel_ann_format["categories"]["label"]["labels"].append(
Expand Down