otx.algorithms.action.utils.convert_public_data_to_cvat#

Convert dataset: Public dataset (Jester[RawFrames], AVA) –> Datumaro dataset (CVAT).

This script contains a lot of hardcoding to create an.xml file that Datumaro can consume.

Current Datumaro format for video (CVAT)

root
|- video_0
|    |- images
|       |- frames_001.png
|    |- frames_002.png
|    |- annotations.xml
|- video_1
|    |- images
|    |- annotations.xml
|- video_2

Functions

convert_action_cls_dataset_to_datumaro(...)

Convert a public dataset to multi-video CVAT (Datumaro) format.

convert_ava_dataset_to_datumaro(src_path, ...)

Convert AVA dataset to multi-video CVAT (Datumaro) format.

generate_default_cvat_xml_fields(i, ...)

Generate default CVAT xml fields required to make multi-video CVAT format by using Jester, and AVA dataset.

main()

Main function.

parse_args()

Parses command line arguments.

read_ava_csv(csv_path)

Read ava format annotation csv file.

rename_and_copy(_src, _dst)

Change frame name to cvat format.

otx.algorithms.action.utils.convert_public_data_to_cvat.convert_action_cls_dataset_to_datumaro(src_path: str, dst_path: str, ann_file: str, label_map=None)[source]#

Convert a public dataset to multi-video CVAT (Datumaro) format.

Supported datasets are: Jester, HMDB51, UCF101

Parameters:
  • src_path (str) – The path to the directory containing the video files as rawframe folder.

  • dst_path (str) – The path to the directory where the multi-video CVAT (Datumaro) format dataset will be saved.

  • ann_file (str) – The path to the file containing the annotations for the videos.

  • label_map (optional) – The path to the file containing the mapping between class IDs and class names.

Returns:

None

Examples

src_path = “./data/hmdb51/rawframes” dst_path = “./data/hmdb51/CVAT/train” ann_file = “./data/hmdb51/hmdb51_train_split_1_rawframes.txt” label_map = “./data/hmdb51/label_map.txt” convert_public_dataset_to_datumaro(src_path, dst_path, ann_file, label_map=label_map)

otx.algorithms.action.utils.convert_public_data_to_cvat.convert_ava_dataset_to_datumaro(src_path: str, dst_path: str, ann_file: str)[source]#

Convert AVA dataset to multi-video CVAT (Datumaro) format.

Parameters:
  • src_path (str) – The path to the directory containing the video files as rawframe folder.

  • dst_path (str) – The path to the directory where the multi-video CVAT (Datumaro) format dataset will be saved.

  • ann_file (str) – The path to the file containing the annotations for the videos.

Returns:

None

Examples

src_path = “./data/ava_dataset/frames” dst_path = “./data/ava_dataset/CVAT/train” ann_file = “./data/ava_dataset/annotations/train.csv” convert_ava_dataset_to_datumaro(src_path, dst_path, ann_file)

otx.algorithms.action.utils.convert_public_data_to_cvat.generate_default_cvat_xml_fields(i, video_path, frame_list)[source]#

Generate default CVAT xml fields required to make multi-video CVAT format by using Jester, and AVA dataset.

otx.algorithms.action.utils.convert_public_data_to_cvat.main()[source]#

Main function.

otx.algorithms.action.utils.convert_public_data_to_cvat.parse_args()[source]#

Parses command line arguments.

otx.algorithms.action.utils.convert_public_data_to_cvat.read_ava_csv(csv_path)[source]#

Read ava format annotation csv file.

otx.algorithms.action.utils.convert_public_data_to_cvat.rename_and_copy(_src, _dst)[source]#

Change frame name to cvat format.