معرفی شرکت ها


fastlabel-0.9.9


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

The official Python SDK for FastLabel API, the Data Platform for AI
ویژگی مقدار
سیستم عامل -
نام فایل fastlabel-0.9.9
نام fastlabel
نسخه کتابخانه 0.9.9
نگهدارنده []
ایمیل نگهدارنده []
نویسنده eisuke-ueta
ایمیل نویسنده eisuke.ueta@fastlabel.ai
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/fastlabel/
مجوز -
# FastLabel Python SDK _If you are using FastLabel prototype, please install version 0.2.2._ ## Table of Contents - [Installation](#installation) - [Usage](#usage) - [Limitation](#limitation) - [Task](#task) - [Image](#image) - [Image Classification](#image-classification) - [Multi Image](#multi-image) - [Video](#video) - [Video Classification](#video-classification) - [Text](#text) - [Text Classification](#text-classification) - [Audio](#audio) - [Audio Classification](#audio-classification) - [PCD](#pcd) - [Sequential PCD](#sequential-pcd) - [Common](#common) - [Annotation](#annotation) - [Project](#project) - [Dataset](#dataset) - [Converter](#converter) - [FastLabel To COCO](#fastlabel-to-coco) - [FastLabel To YOLO](#fastlabel-to-yolo) - [FastLabel To Pascal VOC](#fastlabel-to-pascal-voc) - [FastLabel To labelme](#fastlabel-to-labelme) - [FastLabel To Segmentation](#fastlabel-to-segmentation) - [COCO To FastLabel](#coco-to-fastlabel) - [YOLO To FastLabel](#yolo-to-fastlabel) - [Pascal VOC To FastLabel](#pascal-voc-to-fastlabel) - [labelme To FastLabel](#labelme-to-fastlabel) - [API Docs](#api-docs) ## Installation ```bash pip install --upgrade fastlabel ``` > Python version 3.7 or greater is required ## Usage Configure API Key in environment variable. ```bash export FASTLABEL_ACCESS_TOKEN="YOUR_ACCESS_TOKEN" ``` Initialize fastlabel client. ```python import fastlabel client = fastlabel.Client() ``` ### Limitation API is allowed to call 10000 times per 10 minutes. If you create/delete a large size of tasks, please wait a second for every requests. ## Task ### Image Supported following project types: - Image - Bounding Box - Image - Polygon - Image - Keypoint - Image - Line - Image - Segmentation - Image - Pose Estimation - Image - All #### Create Task Create a new task. ```python task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./sample.jpg" ) ``` Create a new task with pre-defined annotations. (Class should be configured on your project in advance) ```python task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./sample.jpg", annotations=[{ "type": "bbox", "value": "annotation-value", "attributes": [ { "key": "attribute-key", "value": "attribute-value" } ], "points": [ 100, # top-left x 100, # top-left y 200, # bottom-right x 200 # bottom-right y ] }] ) ``` > Check [examples/create_image_task.py](/examples/create_image_task.py). ##### Limitation - You can upload up to a size of 20 MB. #### Find Task Find a single task. ```python task = client.find_image_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_image_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG") ``` - Filter and Get tasks. (Up to 1000 tasks) ```python tasks = client.get_image_tasks( project="YOUR_PROJECT_SLUG", status="approved", # status can be 'pending', 'registered', 'completed', 'skipped', 'reviewed' 'sent_back', 'approved', 'declined' tags=["tag1", "tag2"] # up to 10 tags ) ``` Get a large size of tasks. (Over 1000 tasks) ```python import time # Iterate pages until new tasks are empty. all_tasks = [] offset = None while True: time.sleep(1) tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG", offset=offset) all_tasks.extend(tasks) if len(tasks) > 0: offset = len(all_tasks) # Set the offset else: break ``` > Please wait a second before sending another requests! #### Update Tasks Update a single task. ```python task_id = client.update_image_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[ { "type": "bbox", "value": "cat" "attributes": [ { "key": "kind", "value": "Scottish field" } ], "points": [ 100, # top-left x 100, # top-left y 200, # bottom-right x 200 # bottom-right y ] } ], ) ``` #### Response Example of a single image task object ```python { "id": "YOUR_TASK_ID", "name": "cat.jpg", "width": 100, # image width "height": 100, # image height "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations": [ { "attributes": [ { "key": "kind", "name": "Kind", "type": "text", "value": "Scottish field" } ], "color": "#b36d18", "points": [ 100, # top-left x 100, # top-left y 200, # bottom-right x 200 # bottom-right y ], "rotation": 0, "title": "Cat", "type": "bbox", "value": "cat" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` Example when the project type is Image - Pose Estimation ```python { "id": "YOUR_TASK_ID", "name": "person.jpg", "width": 255, # image width "height": 255, # image height "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations":[ { "type":"pose_estimation", "title":"jesture", "value":"jesture", "color":"#10c414", "attributes": [], "keypoints":[ { "name":"頭", "key":"head", "value":[ 102.59, # x 23.04, # y 1 # 0:invisible, 1:visible ], "edges":[ "right_shoulder", "left_shoulder" ] }, { "name":"右肩", "key":"right_shoulder", "value":[ 186.69, 114.11, 1 ], "edges":[ "head" ] }, { "name":"左肩", "key":"left_shoulder", "value":[ 37.23, 109.29, 1 ], "edges":[ "head" ] } ] } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` #### Export Image With Annotations Get tasks and export images with annotations. Only support the following image extension. - jpeg - jpg - png - tif - tiff - bmp ```python tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG") client.export_image_with_annotations( tasks=tasks, image_dir="IMAGE_DIR", output_dir="OUTPUT_DIR" ) ``` #### Integrate Task This function is alpha version. It is subject to major changes in the future. Integration is possible only when tasks are registered from the objects divided by the dataset. Only bbox and polygon annotation types are supported. In the case of a task divided under the following conditions. - Dataset slug: `image` - Object name: `cat.jpg` - Split count: `3×3` Objects are registered in the data set in the following form. - image/cat/1.jpg - image/cat/2.jpg - image/cat/3.jpg - (omit) - image/cat/9.jpg The annotations at the edges of the image are combined. However, annotations with a maximum length of 300px may not work. In this case, SPLIT_IMAGE_TASK_NAME_PREFIX specifies `image/cat`. ```python task = client.find_integrated_image_task_by_prefix( project="YOUR_PROJECT_SLUG", prefix="SPLIT_IMAGE_TASK_NAME_PREFIX", ) ``` ##### Response Example of a integrated image task object ```python { 'name': 'image/cat.jpg', "annotations": [ { "attributes": [], "color": "#b36d18", "confidenceScore"; -1, "keypoints": [], "points": [200,200,300,400], "rotation": 0, "title": "Bird", "type": "polygon", "value": "bird" } ], } ``` ### Image Classification Supported following project types: - Image - Classification #### Create Task Create a new task. ```python task_id = client.create_image_classification_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./sample.jpg", attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ##### Limitation - You can upload up to a size of 20 MB. #### Find Task Find a single task. ```python task = client.find_image_classification_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_image_classification_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_image_classification_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Tasks Update a single task. ```python task_id = client.update_image_classification_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` #### Response Example of a single image classification task object ```python { "id": "YOUR_TASK_ID", "name": "cat.jpg", "width": 100, # image width "height": 100, # image height "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "attributes": [ { "key": "kind", "name": "Kind", "type": "text", "value": "Scottish field" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` ### Multi Image Supported following project types: - Multi Image - Bounding Box - Multi Image - Polygon - Multi Image - Keypoint - Multi Image - Line - Multi Image - Segmentation #### Create Task Create a new task. ```python task = client.create_multi_image_task( project="YOUR_PROJECT_SLUG", name="sample", folder_path="./sample", annotations=[{ "type": "segmentation", "value": "annotation-value", "attributes": [ { "key": "attribute-key", "value": "attribute-value" } ], "content": "01.jpg", "points": [[[ 100, 100, 300, 100, 300, 300, 100, 300, 100, 100 ]]] # clockwise rotation }] ) ``` ##### Limitation - You can upload up to a size of 20 MB. - You can upload up to a total size of 512 MB. - You can upload up to 250 files in total. #### Find Task Find a single task. ```python task = client.find_multi_image_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_multi_image_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. ```python tasks = client.get_multi_image_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Task Update a single task. ```python task_id = client.update_multi_image_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[ { "type": "bbox", "value": "cat", "content": "cat1.jpg", "attributes": [ { "key": "key", "value": "value1" } ], "points": [990, 560, 980, 550] } ] ) ``` #### Response Example of a single task object ```python { "id": "YOUR_TASK_ID", "name": "cat.jpg", "contents": [ { "name": "content-name", "url": "content-url", "width": 100, "height": 100, } ], "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations": [ { "content": "content-name" "attributes": [], "color": "#b36d18", "points": [[[ 100, 100, 300, 100, 300, 300, 100, 300, 100, 100 ]]] "title": "Cat", "type": "bbox", "value": "cat" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` ### Video Supported following project types: - Video - Bounding Box - Video - Keypoint - Video - Line #### Create Task Create a new task. ```python task_id = client.create_video_task( project="YOUR_PROJECT_SLUG", name="sample.mp4", file_path="./sample.mp4" ) ``` 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 } } }] ) ``` ##### Limitation - You can upload up to a size of 250 MB. #### Find Task Find a single task. ```python task = client.find_video_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_video_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 10 tasks) ```python tasks = client.get_video_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Task Update a single task. ```python task_id = client.update_video_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[{ "type": "bbox", "value": "bird", "points": { "1": { "value": [ 100, 100, 200, 200 ], "autogenerated": False }, "2": { "value": [ 110, 110, 220, 220 ], "autogenerated": True }, "3": { "value": [ 120, 120, 240, 240 ], "autogenerated": False } } }] ) ``` #### Integrate Video This function is alpha version. It is subject to major changes in the future. Integration is possible only when tasks are registered from the objects divided by the dataset. In the case of a task divided under the following conditions. - Dataset slug: `video` - Object name: `cat.mp4` - Split count: `3` Objects are registered in the data set in the following form. - video/cat/1.mp4 - video/cat/2.mp4 - video/cat/3.mp4 In this case, SPLIT_VIDEO_TASK_NAME_PREFIX specifies `video/cat`. ```python task = client.find_integrated_video_task_by_prefix( project="YOUR_PROJECT_SLUG", prefix="SPLIT_VIDEO_TASK_NAME_PREFIX", ) ``` #### Response Example of a single vide task object ```python { "id": "YOUR_TASK_ID", "name": "cat.jpg", "width": 100, # image width "height": 100, # image height "fps": 30.0, # frame per seconds "frameCount": 480, # total frame count of video "duration": 16.0, # total duration of video "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations": [ { "attributes": [], "color": "#b36d18", "points": { "1": { # number of frame "value": [ 100, # top-left x 100, # top-left y 200, # bottom-right x 200 # bottom-right y ], "autogenerated": False # False when annotated manually. True when auto-generated by system. }, "2": { "value": [ 110, 110, 220, 220 ], "autogenerated": True }, "3": { "value": [ 120, 120, 240, 240 ], "autogenerated": False } }, "title": "Cat", "type": "bbox", "value": "cat" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` ### Video Classification Supported following project types: - Video - Classification (Single) #### Create Task Create a new task. ```python task_id = client.create_video_classification_task( project="YOUR_PROJECT_SLUG", name="sample.mp4", file_path="./sample.mp4", attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ##### Limitation - You can upload up to a size of 250 MB. #### Find Task Find a single task. ```python task = client.find_video_classification_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_video_classification_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_video_classification_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Tasks Update a single task. ```python task_id = client.update_video_classification_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ### Text Supported following project types: - Text - NER #### Create Task Create a new task. ```python task_id = client.create_text_task( project="YOUR_PROJECT_SLUG", name="sample.txt", file_path="./sample.txt" ) ``` Create a new task with pre-defined annotations. (Class should be configured on your project in advance) ```python task_id = client.create_text_task( project="YOUR_PROJECT_SLUG", name="sample.txt", file_path="./sample.txt", annotations=[{ "type": "ner", "value": "person", "start": 0, "end": 10, "text": "1234567890" }] ) ``` ##### Limitation - You can upload up to a size of 2 MB. #### Find Task Find a single task. ```python task = client.find_text_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_text_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 10 tasks) ```python tasks = client.get_text_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Task Update a single task. ```python task_id = client.update_text_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[{ "type": "bbox", "value": "bird", "start": 0, "end": 10, "text": "0123456789" }] ) ``` #### Response Example of a single text task object ```python { "id": "YOUR_TASK_ID", "name": "cat.txt", "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations": [ { "attributes": [], "color": "#b36d18", "text": "0123456789", "start": 0, "end": 10, "title": "Cat", "type": "ner", "value": "cat" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` ### Text Classification Supported following project types: - Text - Classification (Single) #### Create Task Create a new task. ```python task_id = client.create_text_classification_task( project="YOUR_PROJECT_SLUG", name="sample.txt", file_path="./sample.txt", attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ##### Limitation - You can upload up to a size of 2 MB. #### Find Task Find a single task. ```python task = client.find_text_classification_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_text_classification_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_text_classification_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Tasks Update a single task. ```python task_id = client.update_text_classification_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ### Audio Supported following project types: - Audio - Segmentation #### Create Task Create a new task. ```python task_id = client.create_audio_task( project="YOUR_PROJECT_SLUG", name="sample.mp3", file_path="./sample.mp3" ) ``` Create a new task with pre-defined annotations. (Class should be configured on your project in advance) ```python task_id = client.create_audio_task( project="YOUR_PROJECT_SLUG", name="sample.mp3", file_path="./sample.mp3", annotations=[{ "type": "segmentation", "value": "person", "start": 0.4, "end": 0.5 }] ) ``` ##### Limitation - You can upload up to a size of 120 MB. #### Find Task Find a single task. ```python task = client.find_audio_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_audio_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 10 tasks) ```python tasks = client.get_audio_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Task Update a single task. ```python task_id = client.update_audio_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[{ "type": "segmentation", "value": "bird", "start": 0.4, "end": 0.5 }] ) ``` #### Response Example of a single audio task object ```python { "id": "YOUR_TASK_ID", "name": "cat.mp3", "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": [], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "annotations": [ { "attributes": [], "color": "#b36d18", "start": 0.4, "end": 0.5, "title": "Bird", "type": "segmentation", "value": "bird" } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` #### Integrate Task This function is alpha version. It is subject to major changes in the future. Integration is possible only when tasks are registered from the objects divided by the dataset. In the case of a task divided under the following conditions. - Dataset slug: `audio` - Object name: `voice.mp3` - Split count: `3` Objects are registered in the data set in the following form. - audio/voice/1.mp3 - audio/voice/2.mp3 - audio/voice/3.mp3 Annotations are combined when the end point specified in the annotation is the end time of the task and the start point of the next task is 0 seconds. In this case, SPLIT_AUDIO_TASK_NAME_PREFIX specifies `audio/voice`. ```python task = client.find_integrated_audio_task_by_prefix( project="YOUR_PROJECT_SLUG", prefix="SPLIT_AUDIO_TASK_NAME_PREFIX", ) ``` ##### Response Example of a integrated audio task object ```python { 'name': 'audio/voice.mp3', "annotations": [ { "attributes": [], "color": "#b36d18", "start": 0.4, "end": 0.5, "title": "Bird", "type": "segmentation", "value": "bird" } ], } ``` ### Audio Classification Supported following project types: - Audio - Classification (Single) #### Create Task Create a new task. ```python task_id = client.create_audio_classification_task( project="YOUR_PROJECT_SLUG", name="sample.mp3", file_path="./sample.mp3", attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ##### Limitation - You can upload up to a size of 120 MB. #### Find Task Find a single task. ```python task = client.find_audio_classification_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_audio_classification_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_audio_classification_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Tasks Update a single task. ```python task_id = client.update_audio_classification_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], attributes=[ { "key": "attribute-key", "value": "attribute-value" } ], ) ``` ### PCD Supported following project types: - PCD - Cuboid - PCD - Segmentation #### Create Task Create a new task. ```python task_id = client.create_pcd_task( project="YOUR_PROJECT_SLUG", name="sample.pcd", file_path="./sample.pcd" ) ``` Create a new task with pre-defined annotations. (Class should be configured on your project in advance) Annotation Type: cuboid ```python task_id = client.create_pcd_task( project="YOUR_PROJECT_SLUG", name="sample.pcd", file_path="./sample.pcd", annotations=[ { "type": "cuboid", "value": "car", "points": [ # For cuboid, it is a 9-digit number. 1, # Coordinate X 2, # Coordinate Y 3, # Coordinate Z 1, # Rotation x 1, # Rotation Y 1, # Rotation Z 2, # Length X 2, # Length Y 2 # Length Z ], } ], ) ``` Annotation Type: segmentation ```python task_id = client.create_pcd_task( project="YOUR_PROJECT_SLUG", name="sample.pcd", file_path="./sample.pcd", annotations=[ { "type": "segmentation", "value": "car", "points": [1, 2, 3, 4, 5], # For segmentation, it is an arbitrary numeric array. } ], ) ``` ##### Limitation - You can upload up to a size of 30 MB. #### Find Task Find a single task. ```python task = client.find_pcd_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python tasks = client.find_pcd_task_by_name(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 1000 tasks) ```python tasks = client.get_pcd_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Task Update a single task. ```python task_id = client.update_pcd_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[ { "type": "cuboid", "value": "car", "points": [ # For cuboid, it is a 9-digit number. 1, # Coordinate X 2, # Coordinate Y 3, # Coordinate Z 1, # Rotation x 1, # Rotation Y 1, # Rotation Z 2, # Length X 2, # Length Y 2 # Length Z ], } ], ) ``` #### Response Example of a single PCD task object ```python { "id": "YOUR_TASK_ID", "name": "sample.pcd", "url": "YOUR_TASK_URL", "status": "registered", "externalStatus": "registered", "tags": ["tag1", "tag2"], "assignee": "ASSIGNEE_NAME", "reviewer": "REVIEWER_NAME", "approver": "APPROVER_NAME", "externalAssignee": "EXTERNAL_ASSIGNEE_NAME", "externalReviewer": "EXTERNAL_REVIEWER_NAME", "externalApprover": "EXTERNAL_APPROVER_NAME", "annotations": [ { "attributes": [], "color": "#b36d18", "title": "Car", "type": "segmentation", "value": "car", "points": [1, 2, 3, 1, 1, 1, 2, 2, 2], } ], "createdAt": "2021-02-22T11:25:27.158Z", "updatedAt": "2021-02-22T11:25:27.158Z" } ``` ### Sequential PCD Supported following project types: - Sequential PCD - Cuboid #### Create Tasks Create a new task. ```python task_id = client.create_sequential_pcd_task( project="YOUR_PROJECT_SLUG", name="drive_record", folder_path="./drive_record/", # Path where sequence PCD files are directory ) ``` The order of frames is determined by the ascending order of PCD file names located in the specified directory. File names are optional, but we recommend naming them in a way that makes the order easy to understand. ``` ./drive_record/ ├── 0001.pcd => frame 1 ├── 0002.pcd => frame 2 ... └── xxxx.pcd => frame n ``` Create a new task with pre-defined annotations. (Class should be configured on your project in advance) ```python task_id = client.create_sequential_pcd_task( project="YOUR_PROJECT_SLUG", name="drive_record", folder_path="./drive_record/", annotations=[ { "type": "cuboid", # annotation class type "value": "human", # annotation class value "points": { "1": { # number of frame "value": [ # For cuboid, it is a 9-digit number. 1, # Coordinate X 2, # Coordinate Y 3, # Coordinate Z 1, # Rotation x 1, # Rotation Y 1, # Rotation Z 2, # Length X 2, # Length Y 2 # Length Z ], # 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": [ 11, 12, 13, 11, 11, 11, 12, 12, 12 ], "autogenerated": True, }, "3": { "value": [ 21, 22, 23, 21, 21, 21, 22, 22, 22 ], "autogenerated": False, }, }, }, ] ) ``` ##### Limitation You can upload up to a size of 30 MB per file. #### Find Tasks Find a single task. ```python task = client.find_sequential_pcd_task(task_id="YOUR_TASK_ID") ``` Find a single task by name. ```python task = client.find_sequential_pcd_task(project="YOUR_PROJECT_SLUG", task_name="YOUR_TASK_NAME") ``` #### Get Tasks Get tasks. (Up to 10 tasks) ```python tasks = client.get_sequential_pcd_tasks(project="YOUR_PROJECT_SLUG") ``` #### Update Tasks Update a single task. ```python task_id = client.update_sequential_pcd_task( task_id="YOUR_TASK_ID", status="approved", assignee="USER_SLUG", tags=["tag1", "tag2"], annotations=[ { "type": "cuboid", "value": "human", "points": { "1": { "value": [ 1, 2, 3, 1, 1, 1, 2, 2, 2 ], "autogenerated": False, }, "2": { "value": [ 11, 12, 13, 11, 11, 11, 12, 12, 12 ], "autogenerated": False, }, }, }, ] ) ``` #### Response Example of a single Sequential PCD task object ```python { "id": "YOUR_TASK_ID", "name": "YOUR_TASK_NAME", "status": "registered", "externalStatus": "registered", "annotations": [ { "id": "YOUR_TASK_ANNOTATION_ID", "type": "cuboid", "title": "human", "value": "human", "color": "#4bdd62", "attributes": [], "points": { "1": { "value": [2.61, 5.07, 0, 0, 0, 0, 2, 2, 2], "autogenerated": False, }, "2": { "value": [2.61, 5.07, 0, 0, 0, 0, 2, 2, 2], "autogenerated": True, }, "3": { "value": [2.61, 5.07, 0, 0, 0, 0, 2, 2, 2], "autogenerated": False, }, }, }, { "id": "YOUR_TASK_ANNOTATION_ID", "type": "cuboid", "title": "building", "value": "building", "color": "#223543", "attributes": [], "points": { "1": { "value": [2.8, -8.64, 0.15, 0, 0, 0, 4.45, 4.2, 2], "autogenerated": False, }, "2": { "value": [2.8, -8.64, 0.15, 0, 0, 0, 4.45, 4.2, 2], "autogenerated": True, }, "3": { "value": [2.8, -8.64, 0.15, 0, 0, 0, 4.45, 4.2, 2], "autogenerated": True, }, "4": { "value": [2.8, -8.64, 0.15, 0, 0, 0, 4.45, 4.2, 2], "autogenerated": True, }, "5": { "value": [2.8, -8.64, 0.15, 0, 0, 0, 4.45, 4.2, 2], "autogenerated": True, }, }, }, ], "tags": [], "assignee": None, "reviewer": None, "approver": None, "externalAssignee": None, "externalReviewer": None, "externalApprover": None, "createdAt": "2023-03-24T08:39:08.524Z", "updatedAt": "2023-03-24T08:39:08.524Z", } ``` ### Common APIs for update and delete are same over all tasks. #### Update Task Update a single task status, tags and assignee. ```python task_id = client.update_task( task_id="YOUR_TASK_ID", status="approved", tags=["tag1", "tag2"], assignee="USER_SLUG" ) ``` #### Delete Task Delete a single task. ```python client.delete_task(task_id="YOUR_TASK_ID") ``` #### Delete Task Annotation Delete annotations in a task. ```python client.delete_task_annotations(task_id="YOUR_TASK_ID") ``` #### Get Tasks Id and Name map ```python id_name_map = client.get_task_id_name_map(project="YOUR_PROJECT_SLUG") ``` #### Create Task from S3 Task creation from S3. - Support project - Image - Video - Audio - Text - To use it, you need to set the contents of the following link. <https://docs.fastlabel.ai/docs/integrations-aws-s3> - Setup AWS S3 properties ```python status = client.update_aws_s3_storage( project="YOUR_PROJECT_SLUG", bucket_name="S3_BUCKET_NAME", bucket_region="S3_REGIONS", ) ``` - Run create task from AWS S3 ```python history = client.create_task_from_aws_s3( project="YOUR_PROJECT_SLUG", ) ``` - Get AWS S3 import status ```python history = client.get_aws_s3_import_status_by_project( project="YOUR_PROJECT_SLUG", ) ``` ## Annotation ### Create Annotation Create a new annotation. ```python annotation_id = client.create_annotation( project="YOUR_PROJECT_SLUG", type="bbox", value="cat", title="Cat") ``` Create a new annotation with color and attributes. ```python attributes = [ { "type": "text", "name": "Kind", "key": "kind" }, { "type": "select", "name": "Size", "key": "size", "options": [ # select, radio and checkbox type requires options { "title": "Large", "value": "large" }, { "title": "Small", "value": "small" }, ] }, ] annotation_id = client.create_annotation( project="YOUR_PROJECT_SLUG", type="bbox", value="cat", title="Cat", color="#FF0000", attributes=attributes) ``` Create a new classification annotation. ```python annotation_id = client.create_classification_annotation( project="YOUR_PROJECT_SLUG", attributes=attributes) ``` ### Find Annotation Find an annotation. ```python annotation = client.find_annotation(annotation_id="YOUR_ANNOTATION_ID") ``` Find an annotation by value. ```python annotation = client.find_annotation_by_value(project="YOUR_PROJECT_SLUG", value="cat") ``` Find an annotation by value in classification project. ```python annotation = client.find_annotation_by_value( project="YOUR_PROJECT_SLUG", value="classification") # "classification" is fixed value ``` ### Get Annotations Get annotations. (Up to 1000 annotations) ```python annotations = client.get_annotations(project="YOUR_PROJECT_SLUG") ``` ### Response Example of an annotation object ```python { "id": "YOUR_ANNOTATION_ID", "type": "bbox", "value": "cat", "title": "Cat", "color": "#FF0000", "order": 1, "vertex": 0, "attributes": [ { "id": "YOUR_ATTRIBUTE_ID", "key": "kind", "name": "Kind", "options": [], "order": 1, "type": "text", "value": "" }, { "id": "YOUR_ATTRIBUTE_ID", "key": "size", "name": "Size", "options": [ {"title": "Large", "value": "large"}, {"title": "Small", "value": "small"} ], "order": 2, "type": "select", "value": "" } ], "createdAt": "2021-05-25T05:36:50.459Z", "updatedAt": "2021-05-25T05:36:50.459Z" } ``` Example when the annotation type is Pose Estimation ```python { "id":"b12c81c3-ddec-4f98-b41b-cef7f77d26a4", "type":"pose_estimation", "title":"jesture", "value":"jesture", "color":"#10c414", "order":1, "attributes": [], "keypoints":[ { "id":"b03ea998-a2f1-4733-b7e9-78cdf73bd38a", "name":"頭", "key":"head", "color":"#0033CC", "edges":[ "195f5852-c516-498b-b392-24513ce3ea67", "06b5c968-1786-4d75-a719-951e915e5557" ], "value": [] }, { "id":"195f5852-c516-498b-b392-24513ce3ea67", "name":"右肩", "key":"right_shoulder", "color":"#0033CC", "edges":[ "b03ea998-a2f1-4733-b7e9-78cdf73bd38a" ], "value": [] }, { "id":"06b5c968-1786-4d75-a719-951e915e5557", "name":"左肩", "key":"left_shoulder", "color":"#0033CC", "edges":[ "b03ea998-a2f1-4733-b7e9-78cdf73bd38a" ], "value": [] } ], "createdAt":"2021-11-21T09:59:46.714Z", "updatedAt":"2021-11-21T09:59:46.714Z" } ``` ### Update Annotation Update an annotation. ```python annotation_id = client.update_annotation( annotation_id="YOUR_ANNOTATION_ID", value="cat2", title="Cat2", color="#FF0000") ``` Update an annotation with attributes. ```python attributes = [ { "id": "YOUR_ATTRIBUTE_ID", # check by sdk get methods "type": "text", "name": "Kind2", "key": "kind2" }, { "id": "YOUR_ATTRIBUTE_ID", "type": "select", "name": "Size2", "key": "size2", "options": [ { "title": "Large2", "value": "large2" }, { "title": "Small2", "value": "small2" }, ] }, ] annotation_id = client.update_annotation( annotation_id="YOUR_ANNOTATION_ID", value="cat2", title="Cat2", color="#FF0000", attributes=attributes) ``` Update a classification annotation. ```python annotation_id = client.update_classification_annotation( project="YOUR_PROJECT_SLUG", attributes=attributes) ``` ### Delete Annotation Delete an annotation. ```python client.delete_annotation(annotation_id="YOUR_ANNOTATION_ID") ``` ## Project ### Create Project Create a new project. ```python project_id = client.create_project( type="image_bbox", name="ImageNet", slug="image-net") ``` ### Find Project Find a project. ```python project = client.find_project(project_id="YOUR_PROJECT_ID") ``` Find a project by slug. ```python project = client.find_project_by_slug(slug="YOUR_PROJECT_SLUG") ``` ### Get Projects Get projects. (Up to 1000 projects) ```python projects = client.get_projects() ``` ### Response Example of a project object ```python { "id": "YOUR_PROJECT_ID", "type": "image_bbox", "slug": "YOUR_PROJECT_SLUG", "name": "YOUR_PROJECT_NAME", "isPixel": False, "jobSize": 10, "status": "active", "createdAt": "2021-04-20T03:20:41.427Z", "updatedAt": "2021-04-20T03:20:41.427Z", } ``` ### Update Project Update a project. ```python project_id = client.update_project( project_id="YOUR_PROJECT_ID", name="NewImageNet", slug="new-image-net", job_size=20) ``` ### Delete Project Delete a project. ```python client.delete_project(project_id="YOUR_PROJECT_ID") ``` ### Copy Project Copy a project. ```python project_id = client.copy_project(project_id="YOUR_PROJECT_ID") ``` ## Dataset ### Create Dataset Create a new dataset. ```python dataset = client.create_dataset( name="Japanese Dogs", slug="japanese-dogs", type="image" ) ``` #### Response Dataset See API docs for details. ```python { 'id': 'YOUR_DATASET_ID', 'name': 'Japanese Dogs', 'slug': 'japanese-dogs', 'type': 'image', 'createdAt': '2022-10-31T02:20:00.248Z', 'updatedAt': '2022-10-31T02:20:00.248Z' } ``` ### Find Dataset Find a single dataset. ```python dataset = client.find_dataset(dataset_id="YOUR_DATASET_ID") ``` Success response is the same as when created. ### Get Dataset Get all datasets in the workspace. (Up to 1000 tasks) ```python datasets = client.get_datasets() ``` The success response is the same as when created, but it is an array. You can filter by type and keywords. ```python datasets = client.get_datasets( type="image", # 'image', 'video', 'audio' keyword="dog" ) ``` If you wish to retrieve more than 1000 data sets, please refer to the Task [sample code](#get-tasks). ### Update Dataset Update a single dataset. ```python dataset = client.update_dataset( dataset_id="YOUR_DATASET_ID", name="World dogs" ) ``` Success response is the same as when created. ### Delete Dataset Delete a single dataset. **⚠️ The dataset object and its associated tasks that dataset has will also be deleted, so check carefully before executing.** ```python client.delete_dataset(dataset_id="YOUR_DATASET_ID") ``` ### Create Dataset Object Create object in the dataset. The types of objects that can be created are "image", "video", and "audio". There are type-specific methods. but they can be used in the same way. ```python dataset_object = client.create_image_dataset_object( dataset_id="YOUR_DATASET_ID", name="brushwood_dog.jpg", file_path="./brushwood_dog.jpg", ) ``` #### Response Dataset Object See API docs for details. ```python { 'id': 'YOUR_DATASET_OBJECT_ID', 'name': 'brushwood_dog.jpg', 'size': 6717, 'height': 225, 'width': 225, 'groupId': None, 'createdAt': '2022-10-30T08:32:20.748Z', 'updatedAt': '2022-10-30T08:32:20.748Z' } ``` ### Find Dataset Object Find a single dataset object. ```python dataset_object = client.find_dataset_object( dataset_object_id="YOUR_DATASET_OBJECT_ID" ) ``` Success response is the same as when created. ### Get Dataset Object Get all dataset object in the dataset. (Up to 1000 tasks) ```python dataset_objects = client.get_dataset_objects(dataset_id="YOUR_DATASET_ID") ``` The success response is the same as when created, but it is an array. You can filter by keywords. ```python dataset_objects = client.get_dataset_objects( dataset_id="YOUR_DATASET_ID", keyword="dog" ) ``` If you wish to retrieve more than 1000 data sets, please refer to the Task [sample code](#get-tasks). ### Delete Dataset Object Delete a multi dataset objects. **⚠️ Related tasks will also be deleted, so please check them carefully before execution.** ```python client.delete_dataset_objects( dataset_id="YOUR_DATASET_ID", dataset_object_ids=[ "YOUR_DATASET_OBJECT_ID_1", "YOUR_DATASET_OBJECT_ID_2", ], ) ``` ### Get Import Histories For Dataset Object Get all import histories in the dataset. (Up to 1000 tasks) ```python datasets = client.get_dataset_object_import_histories( dataset_id="YOUR_DATASET_ID" ) ``` #### Response Dataset Object Import Histories See API docs for details. ```python [ { 'id': 'YOUR_DATASET_OBJECT_IMPORT_HISTORY_ID', 'type': 'local', 'status': 'completed', 'msgCode': 'none', 'msgLevel': 'none', 'userName': 'admin', 'count': 1, 'createdAt': '2022-10-30T08:31:31.588Z', 'updatedAt': '2022-11-02T07:36:07.636Z' } ] ``` ## Converter ### FastLabel To COCO Support the following annotation types. - bbox - polygon - pose estimation Get tasks and export as a [COCO format](https://cocodataset.org/#format-data) file. ```python project_slug = "YOUR_PROJECT_SLUG" tasks = client.get_image_tasks(project=project_slug) client.export_coco(project=project_slug, tasks=tasks) ``` Export with specifying output directory and file name. ```python client.export_coco(project="YOUR_PROJECT_SLUG", tasks=tasks, output_dir="YOUR_DIRECTROY", output_file_name="YOUR_FILE_NAME") ``` If you would like to export pose estimation type annotations, please pass annotations. ```python project_slug = "YOUR_PROJECT_SLUG" tasks = client.get_image_tasks(project=project_slug) annotations = client.get_annotations(project=project_slug) client.export_coco(project=project_slug, tasks=tasks, annotations=annotations, output_dir="YOUR_DIRECTROY", output_file_name="YOUR_FILE_NAME") ``` ### FastLabel To YOLO Support the following annotation types. - bbox - polygon Get tasks and export as YOLO format files. ```python project_slug = "YOUR_PROJECT_SLUG" tasks = client.get_image_tasks(project=project_slug) client.export_yolo(project=project_slug, tasks=tasks, output_dir="YOUR_DIRECTROY") ``` Get tasks and export as YOLO format files with classes.txt You can use fixed classes.txt and arrange order of each annotaiton file's order ```python project_slug = "YOUR_PROJECT_SLUG" tasks = client.get_image_tasks(project=project_slug) annotations = client.get_annotations(project=project_slug) classes = list(map(lambda annotation: annotation["value"], annotations)) client.export_yolo(project=project_slug, tasks=tasks, classes=classes, output_dir="YOUR_DIRECTROY") ``` ### FastLabel To Pascal VOC Support the following annotation types. - bbox - polygon Get tasks and export as Pascal VOC format files. ```python project_slug = "YOUR_PROJECT_SLUG" tasks = client.get_image_tasks(project=project_slug) client.export_pascalvoc(project=project_slug, tasks=tasks) ``` ### FastLabel To labelme Support the following annotation types. - bbox - polygon - points - line Get tasks and export as labelme format files. ```python tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG") client.export_labelme(tasks) ``` ### FastLabel To Segmentation Get tasks and export index color instance/semantic segmentation (PNG files). Only support the following annotation types. - bbox - polygon - segmentation (Hollowed points are not supported.) ```python tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG") client.export_instance_segmentation(tasks) ``` ```python tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG") client.export_semantic_segmentation(tasks) ``` ### COCO To FastLabel Supported bbox , polygon or pose_estimation annotation type. Convert annotation file of [COCO format](https://cocodataset.org/#format-data) as a Fastlabel format and create task. file_path: COCO annotation json file path ```python annotations_map = client.convert_coco_to_fastlabel(file_path="./sample.json", annotation_type="bbox") # annotation_type = "bbox", "polygon" or "pose_estimation task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./sample.jpg", annotations=annotations_map.get("sample.jpg") ) ``` Example of converting annotations to create multiple tasks. In the case of the following tree structure. ``` dataset ├── annotation.json ├── sample1.jpg └── sample2.jpg ``` Example source code. ```python import fastlabel project = "YOUR_PROJECT_SLUG" input_file_path = "./dataset/annotation.json" input_dataset_path = "./dataset/" annotations_map = client.convert_coco_to_fastlabel(file_path=input_file_path) for image_file_path in glob.iglob(os.path.join(input_dataset_path, "**/**.jpg"), recursive=True): time.sleep(1) name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "") file_path = image_file_path annotations = annotations_map.get(name) if annotations_map.get(name) is not None else [] task_id = client.create_image_task( project=project, name=name, file_path=file_path, annotations=annotations ) ``` ### YOLO To FastLabel Supported bbox annotation type. Convert annotation file of YOLO format as a Fastlabel format and create task. classes_file_path: YOLO classes text file path dataset_folder_path: Folder path containing YOLO Images and annotation ```python annotations_map = client.convert_yolo_to_fastlabel( classes_file_path="./classes.txt", dataset_folder_path="./dataset/" ) task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./dataset/sample.jpg", annotations=annotations_map.get("sample.jpg") ) ``` Example of converting annotations to create multiple tasks. In the case of the following tree structure. ``` yolo ├── classes.txt └── dataset ├── sample1.jpg ├── sample1.txt ├── sample2.jpg └── sample2.txt ``` Example source code. ```python import fastlabel project = "YOUR_PROJECT_SLUG" input_file_path = "./classes.txt" input_dataset_path = "./dataset/" annotations_map = client.convert_yolo_to_fastlabel( classes_file_path=input_file_path, dataset_folder_path=input_dataset_path ) for image_file_path in glob.iglob(os.path.join(input_dataset_path, "**/**.jpg"), recursive=True): time.sleep(1) name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "") file_path = image_file_path annotations = annotations_map.get(name) if annotations_map.get(name) is not None else [] task_id = client.create_image_task( project=project, name=name, file_path=file_path, annotations=annotations ) ``` ### Pascal VOC To FastLabel Supported bbox annotation type. Convert annotation file of Pascal VOC format as a Fastlabel format and create task. folder_path: Folder path including pascal VOC format annotation files ```python annotations_map = client.convert_pascalvoc_to_fastlabel(folder_path="./dataset/") task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./dataset/sample.jpg", annotations=annotations_map.get("sample.jpg") ) ``` Example of converting annotations to create multiple tasks. In the case of the following tree structure. ``` dataset ├── sample1.jpg ├── sample1.xml ├── sample2.jpg └── sample2.xml ``` Example source code. ```python import fastlabel project = "YOUR_PROJECT_SLUG" input_dataset_path = "./dataset/" annotations_map = client.convert_pascalvoc_to_fastlabel(folder_path=input_dataset_path) for image_file_path in glob.iglob(os.path.join(input_dataset_path, "**/**.jpg"), recursive=True): time.sleep(1) name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "") file_path = image_file_path annotations = annotations_map.get(name) if annotations_map.get(name) is not None else [] task_id = client.create_image_task( project=project, name=name, file_path=file_path, annotations=annotations ) ``` ### labelme To FastLabel Support the following annotation types. - bbox - polygon - points - line Convert annotation file of labelme format as a Fastlabel format and create task. folder_path: Folder path including labelme format annotation files ```python annotations_map = client.convert_labelme_to_fastlabel(folder_path="./dataset/") task_id = client.create_image_task( project="YOUR_PROJECT_SLUG", name="sample.jpg", file_path="./sample.jpg", annotations=annotations_map.get("sample.jpg") ) ``` Example of converting annotations to create multiple tasks. In the case of the following tree structure. ``` dataset ├── sample1.jpg ├── sample1.json ├── sample2.jpg └── sample2.json ``` Example source code. ```python import fastlabel project = "YOUR_PROJECT_SLUG" input_dataset_path = "./dataset/" annotations_map = client.convert_labelme_to_fastlabel(folder_path=input_dataset_path) for image_file_path in glob.iglob(os.path.join(input_dataset_path, "**/**.jpg"), recursive=True): time.sleep(1) name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "") file_path = image_file_path annotations = annotations_map.get(name) if annotations_map.get(name) is not None else [] task_id = client.create_image_task( project=project, name=name, file_path=file_path, annotations=annotations ) ``` > Please check const.COLOR_PALLETE for index colors. ## Execute endpoint Create the endpoint from the screen at first. Currently, the feature to create endpoints is in alpha and is not available to users. If you would like to try it out, please contact a FastLabel representative. ```python import fastlabel import numpy as np import cv2 import base64 client = fastlabel.Client() ENDPOINT_NAME = "YOUR ENDPOINT NAME" IMAGE_FILE_PATH = "YOUR IMAGE FILE PATH" RESULT_IMAGE_FILE_PATH = "YOUR RESULT IMAGE FILE PATH" def base64_to_cv(img_str): if "base64," in img_str: img_str = img_str.split(",")[1] img_raw = np.frombuffer(base64.b64decode(img_str), np.uint8) img = cv2.imdecode(img_raw, cv2.IMREAD_UNCHANGED) return img if __name__ == '__main__': # Execute endpoint response = client.execute_endpoint( endpoint_name=ENDPOINT_NAME, file_path=IMAGE_PATH) # Show result print(response["json"]) # Save result img = base64_to_cv(response["file"]) cv2.imwrite(RESULT_IMAGE_FILE_PATH, img) ``` ## API Docs Check [this](https://api.fastlabel.ai/docs/) for further information.


نیازمندی

مقدار نام
==2.25.1 requests
>=1.21.2 numpy
==2.5.0 geojson
==0.12.0 xmltodict
==9.0.1 Pillow
==4.7.0.72 opencv-python


زبان مورد نیاز

مقدار نام
>=3.7 Python


نحوه نصب


نصب پکیج whl fastlabel-0.9.9:

    pip install fastlabel-0.9.9.whl


نصب پکیج tar.gz fastlabel-0.9.9:

    pip install fastlabel-0.9.9.tar.gz