diff --git a/e2e_tests/cli/test_full_cycle.py b/e2e_tests/cli/test_full_cycle.py index 01f1df25f..09cad16c9 100644 --- a/e2e_tests/cli/test_full_cycle.py +++ b/e2e_tests/cli/test_full_cycle.py @@ -1,12 +1,32 @@ +import os import shutil from pathlib import Path from e2e_tests.helpers import assert_cli, run_cli_command, export_release from e2e_tests.objects import E2EDataset, ConfigValues from e2e_tests.cli.test_import import compare_annotations_export +from e2e_tests.cli.test_push import extract_and_push -def test_full_cycle( +def copy_files_to_flat_directory(source_dir, target_dir): + """ + Multi-source file items are pulled in a structure where every file is contained in a + folder named after the slot it's in. Multi-file push only considers files in the + top-level of the passed directory, so to push pulled multi-file items as multi-file + items, we need to copy the files into a flat directory + """ + if not os.path.exists(target_dir): + os.makedirs(target_dir) + for root, dirs, files in os.walk(source_dir): + for file in files: + if file.endswith(".jpg"): + shutil.copy( + os.path.join(root, file), + os.path.join(target_dir, file), + ) + + +def test_full_cycle_images( local_dataset: E2EDataset, config_values: ConfigValues, ): @@ -103,3 +123,293 @@ def test_full_cycle( item_type, unzip=False, ) + + +def test_full_cycle_video( + local_dataset: E2EDataset, + config_values: ConfigValues, +): + """ + This test performs the following steps: + - 1: Pushes a video to the dataset + - 2: Imports some annotations + - 3: Creates and pulls a release of the dataset + - 4: Deletes all items from the dataset + - 5: Pushes and imports the pulled files & annotations to the dataset + - 6: Deletes locally pulled copies of the dataset files + - 7: Creates and pulls a new release of the dataset + - 8: Assert that the pulled data is as expected + + It is designed to catch errors that may arise from changes to exported Darwin JSON + """ + item_type = "single_slotted_video" + annotation_format = "darwin" + first_release_name = "first_release" + second_release_name = "second_release" + zipped_video_dir = "25_frame_video" + push_dir = Path(__file__).parents[1] / "data" / "push" / f"{zipped_video_dir}.zip" + pull_dir = Path( + f"{Path.home()}/.darwin/datasets/{config_values.team_slug}/{local_dataset.slug}" + ) + annotations_import_dir = ( + Path(__file__).parents[1] / "data" / "import" / "video_annotations_small_video" + ) + expected_filepaths = [ + f"{pull_dir}/images/small_video.mp4", + ] + + # Push a video to the dataset + extract_and_push(push_dir, local_dataset, config_values, zipped_video_dir) + + # Upload annotations to the dataset + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {annotations_import_dir}" + ) + assert_cli(result, 0) + + # Pull a first release of the dataset + original_release = export_release( + annotation_format, local_dataset, config_values, release_name=first_release_name + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{original_release.name}" + ) + assert_cli(result, 0) + + # Delete all items in the dataset + local_dataset.delete_items(config_values) + + # Push and import the pulled files and annotations to the dataset + result = run_cli_command( + f"darwin dataset push {local_dataset.name} {pull_dir}/images --preserve-folders" + ) + assert_cli(result, 0) + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {pull_dir}/releases/{first_release_name}/annotations" + ) + assert_cli(result, 0) + + # Delete local copies of the dataset files for the dataset + shutil.rmtree(f"{pull_dir}/images") + + # Pull a second release of the dataset + new_release = export_release( + annotation_format, + local_dataset, + config_values, + release_name=second_release_name, + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{new_release.name}" + ) + assert_cli(result, 0) + + # Check that all expected files have been downloaded + all_filepaths = list(pull_dir.rglob("*")) + for expected_file in expected_filepaths: + assert Path(expected_file) in all_filepaths + + # Check that all downloaded annotations are as expected + compare_annotations_export( + Path(f"{pull_dir}/releases/{first_release_name}/annotations"), + Path(f"{pull_dir}/releases/{second_release_name}/annotations"), + item_type, + unzip=False, + ) + + +def test_full_cycle_multi_slotted_item( + local_dataset: E2EDataset, + config_values: ConfigValues, +): + """ + This test performs the following steps: + - 1: Registers a multi-slotted item from external storage to a dataset + - 2: Imports some annotations + - 3: Creates and pulls a release of the dataset + - 4: Deletes all items from the dataset + - 5: Pushes and imports the pulled files & annotations to the dataset + - 6: Deletes locally pulled copies of the dataset files + - 7: Creates and pulls a new release of the dataset + - 8: Assert that the pulled data is as expected + + It is designed to catch errors that may arise from changes to exported Darwin JSON + """ + item_type = "multi_slotted" + annotation_format = "darwin" + first_release_name = "first_release" + second_release_name = "second_release" + pull_dir = Path( + f"{Path.home()}/.darwin/datasets/{config_values.team_slug}/{local_dataset.slug}" + ) + annotations_import_dir = ( + Path(__file__).parents[1] + / "data" + / "import" + / "multi_slotted_annotations_with_slots_defined" + ) + expected_filepaths = [ + f"{pull_dir}/images/multi_slotted_item/0/image_1.jpg", + f"{pull_dir}/images/multi_slotted_item/1/image_2.jpg", + f"{pull_dir}/images/multi_slotted_item/2/image_3.jpg", + ] + + # Populate the dataset with items and annotations + local_dataset.register_read_only_items(config_values, item_type) + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {annotations_import_dir}" + ) + assert_cli(result, 0) + + # Pull a first release of the dataset + original_release = export_release( + annotation_format, local_dataset, config_values, release_name=first_release_name + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{original_release.name}" + ) + assert_cli(result, 0) + + # Delete all items in the dataset + local_dataset.delete_items(config_values) + + # Create a temporary directory for pushing files + tmp_push_dir = f"{pull_dir}/multi_slotted_item" + copy_files_to_flat_directory(f"{pull_dir}/images", tmp_push_dir) + + # Push and import the pulled files and annotations to the dataset + result = run_cli_command( + f"darwin dataset push {local_dataset.name} {tmp_push_dir} --item-merge-mode slots" + ) + assert_cli(result, 0) + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {pull_dir}/releases/{first_release_name}/annotations" + ) + assert_cli(result, 0) + + # Delete local copies of the dataset files for the dataset + shutil.rmtree(f"{pull_dir}/images") + + # Pull a second release of the dataset + new_release = export_release( + annotation_format, + local_dataset, + config_values, + release_name=second_release_name, + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{new_release.name}" + ) + assert_cli(result, 0) + + # Check that all expected files have been downloaded + all_filepaths = list(pull_dir.rglob("*")) + for expected_file in expected_filepaths: + assert Path(expected_file) in all_filepaths + + # Check that all downloaded annotations are as expected + compare_annotations_export( + Path(f"{pull_dir}/releases/{first_release_name}/annotations"), + Path(f"{pull_dir}/releases/{second_release_name}/annotations"), + item_type, + unzip=False, + ) + + +def test_full_cycle_multi_channel_item( + local_dataset: E2EDataset, + config_values: ConfigValues, +): + """ + This test performs the following steps: + - 1: Registers a multi-channel from external storage item to the dataset + - 2: Imports some annotations + - 3: Creates and pulls a release of the dataset + - 4: Deletes all items from the dataset + - 5: Pushes and imports the pulled files & annotations to the dataset + - 6: Deletes locally pulled copies of the dataset files + - 7: Creates and pulls a new release of the dataset + - 8: Assert that the pulled data is as expected + + It is designed to catch errors that may arise from changes to exported Darwin JSON + """ + item_type = "multi_channel" + annotation_format = "darwin" + first_release_name = "first_release" + second_release_name = "second_release" + pull_dir = Path( + f"{Path.home()}/.darwin/datasets/{config_values.team_slug}/{local_dataset.slug}" + ) + annotations_import_dir = ( + Path(__file__).parents[1] + / "data" + / "import" + / "multi_channel_annotations_with_slots_defined" + ) + expected_filepaths = [ + f"{pull_dir}/images/multi_channel_item/image_1.jpg/image_1.jpg", + f"{pull_dir}/images/multi_channel_item/image_2.jpg/image_2.jpg", + f"{pull_dir}/images/multi_channel_item/image_3.jpg/image_3.jpg", + ] + + # Populate the dataset with items and annotations + local_dataset.register_read_only_items(config_values, item_type) + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {annotations_import_dir}" + ) + assert_cli(result, 0) + + # Pull a first release of the dataset + original_release = export_release( + annotation_format, local_dataset, config_values, release_name=first_release_name + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{original_release.name}" + ) + assert_cli(result, 0) + + # Delete all items in the dataset + local_dataset.delete_items(config_values) + + # Create a temporary directory for pushing files + tmp_push_dir = f"{pull_dir}/multi_channel_item" + copy_files_to_flat_directory(f"{pull_dir}/images", tmp_push_dir) + + # Push and import the pulled files and annotations to the dataset + result = run_cli_command( + f"darwin dataset push {local_dataset.name} {tmp_push_dir} --item-merge-mode channels" + ) + assert_cli(result, 0) + result = run_cli_command( + f"darwin dataset import {local_dataset.name} {annotation_format} {pull_dir}/releases/{first_release_name}/annotations" + ) + assert_cli(result, 0) + + # Delete local copies of the dataset files for the dataset + shutil.rmtree(f"{pull_dir}/images") + + # Pull a second release of the dataset + new_release = export_release( + annotation_format, + local_dataset, + config_values, + release_name=second_release_name, + ) + result = run_cli_command( + f"darwin dataset pull {local_dataset.name}:{new_release.name}" + ) + assert_cli(result, 0) + + # Check that all expected files have been downloaded + all_filepaths = list(pull_dir.rglob("*")) + for expected_file in expected_filepaths: + assert Path(expected_file) in all_filepaths + + # Check that all downloaded annotations are as expected + compare_annotations_export( + Path(f"{pull_dir}/releases/{first_release_name}/annotations"), + Path(f"{pull_dir}/releases/{second_release_name}/annotations"), + item_type, + base_slot="image_1.jpg", + unzip=False, + ) diff --git a/e2e_tests/cli/test_push.py b/e2e_tests/cli/test_push.py index fd7a38272..84bbaf846 100644 --- a/e2e_tests/cli/test_push.py +++ b/e2e_tests/cli/test_push.py @@ -7,7 +7,7 @@ wait_until_items_processed, list_items, ) -from e2e_tests.objects import E2EDataset, ConfigValues +from e2e_tests.objects import E2EDataset, E2EItem, ConfigValues import tempfile import zipfile @@ -25,12 +25,24 @@ def extract_and_push( ) assert_cli(result, 0) wait_until_items_processed(config_values, local_dataset.id) - return list_items( + items = list_items( config_values.api_key, local_dataset.id, config_values.team_slug, config_values.server, ) + for item in items: + local_dataset.add_item( + E2EItem( + name=item["name"], + id=item["id"], + path=item["path"], + file_name=item["name"], + slot_name=item["slots"][0]["file_name"], + annotations=[], + ) + ) + return items def test_push_mixed_filetypes( diff --git a/e2e_tests/data/import/video_annotations_small_video/mini_uct.json b/e2e_tests/data/import/video_annotations_small_video/mini_uct.json new file mode 100644 index 000000000..3cbfcde1a --- /dev/null +++ b/e2e_tests/data/import/video_annotations_small_video/mini_uct.json @@ -0,0 +1,904 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "small_video.mp4", + "path": "/", + "source_info": { + "item_id": "01927880-0b20-0006-97b0-4f41cfbd0ebd", + "dataset": { + "name": "test_dataset_3ccaab8e-3de2-467d-b75f-7b7b5776bd8a", + "slug": "test_dataset_3ccaab8e-3de2-467d-b75f-7b7b5776bd8a", + "dataset_management_url": "https://staging.v7labs.com/datasets/386252/dataset-management" + }, + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=386252&item=01927880-0b20-0006-97b0-4f41cfbd0ebd" + }, + "slots": [ + { + "type": "video", + "slot_name": "0", + "width": 1920, + "height": 1080, + "fps": 1, + "thumbnail_url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/thumbnail", + "source_files": [ + { + "file_name": "small_video.mp4", + "storage_key": "darwin-py/videos/small_video.mp4", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/18e0b4da-bb5f-4b24-beac-f2520bd4cf23" + } + ], + "frame_count": 10, + "frame_urls": [ + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/0", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/1", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/2", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/3", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/4", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/5", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/6", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/7", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/8", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/9" + ] + } + ] + }, + "annotations": [ + { + "frames": { + "1": { + "instance_id": { + "value": 14 + }, + "keyframe": true, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "2": { + "instance_id": { + "value": 14 + }, + "keyframe": false, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "3": { + "instance_id": { + "value": 14 + }, + "keyframe": true, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "5a00aa6d-64ee-47ba-a030-9b8bb6129fa9", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_skeleton_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 1, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 1, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 1, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 1, + 4 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "8": { + "instance_id": { + "value": 15 + }, + "keyframe": true, + "line": { + "path": [ + { + "x": 8.4804, + "y": 9.0196 + }, + { + "x": 13.0882, + "y": 5.1471 + }, + { + "x": 12.451, + "y": 13.4804 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "9": { + "instance_id": { + "value": 15 + }, + "keyframe": true, + "line": { + "path": [ + { + "x": 8.4804, + "y": 9.0196 + }, + { + "x": 13.0882, + "y": 5.1471 + }, + { + "x": 12.451, + "y": 13.4804 + } + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "cae4fce9-50bc-46db-a71a-1e76b43edc92", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_line_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 8, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 8, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 8, + "name": "single_select-1", + "value": "1" + } + ], + "ranges": [ + [ + 8, + 10 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "8": { + "instance_id": { + "value": 16 + }, + "keyframe": true, + "keypoint": { + "x": 8.2353, + "y": 19.951 + }, + "text": { + "text": "test_text" + } + }, + "9": { + "instance_id": { + "value": 16 + }, + "keyframe": true, + "keypoint": { + "x": 8.2353, + "y": 19.951 + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "1538874f-fe2e-4a65-8f42-7ce31339842c", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_keypoint_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 8, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 8, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 8, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 8, + 10 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + }, + "6": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": false, + "text": { + "text": "test_text" + } + }, + "7": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "1a50ad19-6516-4bfb-aba9-81d4313f242a", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_ellipse_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "single_select-1", + "value": "1" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + }, + "6": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + }, + "7": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "7642a105-42d5-4b2c-ac07-f5230da1afb2", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_polygon_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + }, + "6": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": false, + "text": { + "text": "test_text" + } + }, + "7": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "57e9c6dc-50d2-44a6-8dc1-f7ce0ef422ee", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_bounding_box_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "multi_select-1", + "value": null + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "keyframe": true, + "mask": {} + }, + "5": { + "keyframe": true, + "mask": {}, + "text": { + "text": "test_text" + } + }, + "6": { + "keyframe": true, + "mask": {} + } + }, + "id": "54e70102-7c0f-46b8-ac39-9fb4960fbc6d", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_with_subtypes_and_properties", + "only_keyframes": true, + "properties": [ + { + "frame_index": 4, + "name": "multi_select-1", + "value": null + }, + { + "frame_index": 4, + "name": "single_select-1", + "value": null + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 4, + 7 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "0": { + "keyframe": true, + "tag": {}, + "text": { + "text": "test_text" + } + }, + "1": { + "keyframe": false, + "tag": {}, + "text": { + "text": "test_text" + } + }, + "2": { + "keyframe": true, + "tag": {}, + "text": { + "text": "test_text" + } + } + }, + "id": "49d7eb79-4c71-45ee-b518-99c1f90c4be4", + "name": "test_tag_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 0, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 0, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 0, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 0, + 3 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + }, + "5": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + }, + "6": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + } + }, + "id": "d87c4c88-5fc4-4fb4-ae93-e88c38c4bf34", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 10 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/video_annotations_with_subtypes/mini_uct.json b/video_annotations_with_subtypes/mini_uct.json new file mode 100644 index 000000000..cf6a3c709 --- /dev/null +++ b/video_annotations_with_subtypes/mini_uct.json @@ -0,0 +1,904 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "mini_uct.mp4", + "path": "/", + "source_info": { + "item_id": "01927880-0b20-0006-97b0-4f41cfbd0ebd", + "dataset": { + "name": "test_dataset_3ccaab8e-3de2-467d-b75f-7b7b5776bd8a", + "slug": "test_dataset_3ccaab8e-3de2-467d-b75f-7b7b5776bd8a", + "dataset_management_url": "https://staging.v7labs.com/datasets/386252/dataset-management" + }, + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=386252&item=01927880-0b20-0006-97b0-4f41cfbd0ebd" + }, + "slots": [ + { + "type": "video", + "slot_name": "0", + "width": 1920, + "height": 1080, + "fps": 1, + "thumbnail_url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/thumbnail", + "source_files": [ + { + "file_name": "mini_uct.mp4", + "storage_key": "darwin-py/videos/mini_uct.mp4", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/18e0b4da-bb5f-4b24-beac-f2520bd4cf23" + } + ], + "frame_count": 10, + "frame_urls": [ + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/0", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/1", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/2", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/3", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/4", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/5", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/6", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/7", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/8", + "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/8a6d5f0a-dd31-44bc-b719-5a9a0c2febbd/sections/9" + ] + } + ] + }, + "annotations": [ + { + "frames": { + "1": { + "instance_id": { + "value": 14 + }, + "keyframe": true, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "2": { + "instance_id": { + "value": 14 + }, + "keyframe": false, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "3": { + "instance_id": { + "value": 14 + }, + "keyframe": true, + "skeleton": { + "nodes": [ + { + "name": "node", + "occluded": false, + "x": 14.7549, + "y": 12.402 + }, + { + "name": "2", + "occluded": false, + "x": 10.1667, + "y": 9.3824 + } + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "5a00aa6d-64ee-47ba-a030-9b8bb6129fa9", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_skeleton_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 1, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 1, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 1, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 1, + 4 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "8": { + "instance_id": { + "value": 15 + }, + "keyframe": true, + "line": { + "path": [ + { + "x": 8.4804, + "y": 9.0196 + }, + { + "x": 13.0882, + "y": 5.1471 + }, + { + "x": 12.451, + "y": 13.4804 + } + ] + }, + "text": { + "text": "test_text" + } + }, + "9": { + "instance_id": { + "value": 15 + }, + "keyframe": true, + "line": { + "path": [ + { + "x": 8.4804, + "y": 9.0196 + }, + { + "x": 13.0882, + "y": 5.1471 + }, + { + "x": 12.451, + "y": 13.4804 + } + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "cae4fce9-50bc-46db-a71a-1e76b43edc92", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_line_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 8, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 8, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 8, + "name": "single_select-1", + "value": "1" + } + ], + "ranges": [ + [ + 8, + 10 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "8": { + "instance_id": { + "value": 16 + }, + "keyframe": true, + "keypoint": { + "x": 8.2353, + "y": 19.951 + }, + "text": { + "text": "test_text" + } + }, + "9": { + "instance_id": { + "value": 16 + }, + "keyframe": true, + "keypoint": { + "x": 8.2353, + "y": 19.951 + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "1538874f-fe2e-4a65-8f42-7ce31339842c", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_keypoint_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 8, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 8, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 8, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 8, + 10 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + }, + "6": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": false, + "text": { + "text": "test_text" + } + }, + "7": { + "ellipse": { + "angle": 0.2019, + "center": { + "x": 8.799, + "y": 6.8627 + }, + "radius": { + "x": 5.3788, + "y": 5.3788 + } + }, + "instance_id": { + "value": 17 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "1a50ad19-6516-4bfb-aba9-81d4313f242a", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_ellipse_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "single_select-1", + "value": "1" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + }, + "6": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": false, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + }, + "7": { + "bounding_box": { + "h": 4.607799999999999, + "w": 6.0783999999999985, + "x": 16.2255, + "y": 3.3824 + }, + "instance_id": { + "value": 18 + }, + "keyframe": true, + "polygon": { + "paths": [ + [ + { + "x": 18.4804, + "y": 3.3824 + }, + { + "x": 16.2255, + "y": 7.451 + }, + { + "x": 22.3039, + "y": 7.9902 + }, + { + "x": 21.8137, + "y": 7.3529 + } + ] + ] + }, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "7642a105-42d5-4b2c-ac07-f5230da1afb2", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_polygon_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "5": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + }, + "6": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": false, + "text": { + "text": "test_text" + } + }, + "7": { + "bounding_box": { + "h": 2.402, + "w": 3.3824, + "x": 20.4902, + "y": 12.1569 + }, + "instance_id": { + "value": 19 + }, + "keyframe": true, + "text": { + "text": "test_text" + } + } + }, + "global_sub_types": {}, + "id": "57e9c6dc-50d2-44a6-8dc1-f7ce0ef422ee", + "interpolate_algorithm": "linear-1.1", + "interpolated": true, + "name": "test_bounding_box_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 5, + "name": "multi_select-1", + "value": null + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 5, + 8 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "keyframe": true, + "mask": {} + }, + "5": { + "keyframe": true, + "mask": {}, + "text": { + "text": "test_text" + } + }, + "6": { + "keyframe": true, + "mask": {} + } + }, + "id": "54e70102-7c0f-46b8-ac39-9fb4960fbc6d", + "interpolate_algorithm": "linear-1.1", + "name": "test_mask_with_subtypes_and_properties", + "only_keyframes": true, + "properties": [ + { + "frame_index": 4, + "name": "multi_select-1", + "value": null + }, + { + "frame_index": 4, + "name": "single_select-1", + "value": null + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 5, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 5, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 4, + 7 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "0": { + "keyframe": true, + "tag": {}, + "text": { + "text": "test_text" + } + }, + "1": { + "keyframe": false, + "tag": {}, + "text": { + "text": "test_text" + } + }, + "2": { + "keyframe": true, + "tag": {}, + "text": { + "text": "test_text" + } + } + }, + "id": "49d7eb79-4c71-45ee-b518-99c1f90c4be4", + "name": "test_tag_with_subtypes_and_properties", + "properties": [ + { + "frame_index": 0, + "name": "multi_select-1", + "value": "1" + }, + { + "frame_index": 0, + "name": "multi_select-1", + "value": "2" + }, + { + "frame_index": 0, + "name": "single_select-1", + "value": "2" + } + ], + "ranges": [ + [ + 0, + 3 + ] + ], + "slot_names": [ + "0" + ] + }, + { + "frames": { + "4": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + }, + "5": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + }, + "6": { + "keyframe": true, + "raster_layer": { + "dense_rle": [ + 0, + 24970, + 1, + 4, + 0, + 1914, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1911, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1910, + 1, + 10, + 0, + 1911, + 1, + 8, + 0, + 1912, + 1, + 8, + 0, + 1914, + 1, + 4, + 0, + 2031346 + ], + "mask_annotation_ids_mapping": { + "54e70102-7c0f-46b8-ac39-9fb4960fbc6d": 1 + }, + "total_pixels": 2073600 + } + } + }, + "id": "d87c4c88-5fc4-4fb4-ae93-e88c38c4bf34", + "name": "__raster_layer__", + "only_keyframes": true, + "properties": [], + "ranges": [ + [ + 0, + 10 + ] + ], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file