From 3e9ac43e8877c216d2c98a45ad4669d65a2aceb4 Mon Sep 17 00:00:00 2001 From: ueta-eisuke Date: Sun, 13 Jun 2021 10:45:27 +0900 Subject: [PATCH 1/2] add annotations option to video api --- fastlabel/__init__.py | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index 0ad2517..411868e 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -393,6 +393,7 @@ def create_video_task( name: str, file_path: str, status: str = None, + annotations: list = [], tags: list = [], ) -> str: """ @@ -402,6 +403,7 @@ def create_video_task( name is an unique identifier of task in your project. (Required) file_path is a path to data. Supported extensions are png, jpg, jpeg. (Required) status can be 'registered', 'in_progress', 'completed', 'skipped', 'in_review', 'send_backed', 'approved', 'customer_in_review', 'customer_send_backed', 'customer_approved'. (Optional) + annotations is a list of annotation to be set in advance. (Optional) tags is a list of tag to be set in advance. (Optional) """ endpoint = "tasks/video" @@ -412,6 +414,10 @@ def create_video_task( payload = {"project": project, "name": name, "file": file} if status: payload["status"] = status + if annotations: + for annotation in annotations: + annotation["content"] = name + payload["annotations"] = annotations if tags: payload["tags"] = tags return self.api.post_request(endpoint, payload=payload) diff --git a/setup.py b/setup.py index c98c6fe..d1bdbb4 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="fastlabel", - version="0.9.0", + version="0.9.1", author="eisuke-ueta", author_email="eisuke.ueta@fastlabel.ai", description="The official Python SDK for FastLabel API, the Data Platform for AI", From cd0b18317990447e5d85ce24407bf9ae98fb66e1 Mon Sep 17 00:00:00 2001 From: ueta-eisuke Date: Sun, 13 Jun 2021 10:52:17 +0900 Subject: [PATCH 2/2] add docs --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index fe7b41d..1ac723b 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,51 @@ task_id = client.create_video_task( ) ``` +- Create a new task with pre-defined annotations. (Class should be configured on your project in advance) + +```python +task_id = client.create_video_task( + project="YOUR_PROJECT_SLUG", + name="sample.mp4", + file_path="./sample.mp4", + annotations=[{ + "type": "bbox", + "value": "person", + "points": { + "1": { # number of frame + "value": [ + 100, # top-left x + 100, # top-left y + 200, # bottom-right x + 200 # bottom-right y + ], + # Make sure to set `autogenerated` False for the first and last frame. "1" and "3" frames in this case. + # Otherwise, annotation is auto-completed for rest of frames when you edit. + "autogenerated": False + }, + "2": { + "value": [ + 110, + 110, + 220, + 220 + ], + "autogenerated": True + }, + "3": { + "value": [ + 120, + 120, + 240, + 240 + ], + "autogenerated": False + } + } + }] +) +``` + #### Find Task - Find a single task.