The official Python SDK for FastLabel API, the Data Platform for AI
Project description
FastLabel Python SDK
Installation
$ pip install --upgrade fastlabel
Python version 3.7 or greater is required
Usage
Configure API Key in environment variable.
export FASTLABEL_API_KEY="YOUR_API_KEY"
Initialize fastlabel client.
import fastlabel
client = fastlabel.Client()
Limitation
API is allowed to call 5000 times per hour. If you create/delete a large size of tasks, please wait a second for every requests.
Task
Create Task
- Create a new task.
task = client.create_image_task(
project_id="YOUR_PROJECT_ID",
key="sample.jpg",
url="https://sample.com/sample.jpg"
)
- Create a new task with pre-defined labels. (Class should be configured on your project in advance)
task = client.create_image_task(
project_id="YOUR_PROJECT_ID",
key="sample.jpg",
url="https://sample.com/sample.jpg",
labels=[
{
"type": "bbox",
"value": "bbox",
"points": [
{ "x": 100, "y": 100}, # top-left
{ "x": 200, "y": 200} # bottom-right
]
}
]
)
Check examples/create_image_task.py for other label types, such as line, keyPoint and polygon.
Find Task
- Find a single task.
task = client.find_task(task_id="YOUR_TASK_ID")
Get Tasks
- Get tasks. (Up to 100 tasks)
tasks = client.get_tasks(project_id="YOUR_PROJECT_ID")
- Filter and Get tasks. (Up to 100 tasks)
tasks = client.get_tasks(
project_id="YOUR_PROJECT_ID",
status="submitted", # status can be 'registered', 'registered', 'submitted' or 'skipped'
review_status="accepted" # review_status can be 'notReviewed', 'inProgress', 'accepted' or 'declined'
)
- Get a large size of tasks. (Over 100 tasks)
import time
# Iterate pages until new tasks are empty.
all_tasks = []
start_after = None
while True:
time.sleep(1)
tasks = client.get_tasks(project_id="YOUR_PROJECT_ID", start_after=start_after)
all_tasks.extend(tasks)
if len(tasks) > 0:
start_after = tasks[-1]["id"] # Set the last task id to start_after
else:
break
Please wait a second before sending another requests!
Delete Task
client.delete_task(task_id="YOUR_TASK_ID")
Task Response
- Example of a single task object
{
"id": "YOUR_TASK_ID",
"key": "sample.png",
"assigneeId": null,
"assigneeName": null,
"status": "registered",
"reviewAssigneeId": null,
"reviewAssigneeName": null,
"reviewStatus": "notReviewed",
"projectId": "YOUR_PROJECT_ID",
"datasetId": "YOUR_DATASET_ID",
"labels": [
{
"id": "YOUR_LABEL_ID",
"type": "bbox",
"value": "window",
"title": "窓",
"color": "#d9713e",
"metadata": [],
"points": [
{ "x": 100, "y": 100}, # top-left
{ "x": 200, "y": 200} # bottom-right
]
}
],
"duration": 0,
"image": {
"width": 1500,
"height": 1200
},
"createdAt": "2020-12-25T15:02:00.513",
"updatedAt": "2020-12-25T15:02:00.513"
}
Model Analysis
Upload Predictions
# Create your model predictions
predictions = [
{
"fileKey": "sample.jpg", # file name exists in your project
"labels": [
{
"value": "bbox_a", # class value exists in your project
"points": [
{ "x": 10, "y": 10 }, # top-left
{ "x": 20, "y": 20 }, # botom-right
]
},
{
"value": "bbox_b",
"points": [
{ "x": 30, "y": 30 },
{ "x": 40, "y": 40 },
]
}
]
}
]
# Upload predictions
client.upload_predictions(
project_id="YOUR_PROJECT_ID", # your fastlabel project id
analysis_type="bbox", # annotation type to be analyze (Only "bbox" or "line" are supported)
threshold=80, # IoU percentage/pixel distance to check labels are correct. (Ex: 0 - 100)
predictions=predictions
)
API Docs
Check this for further information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastlabel-0.2.2.tar.gz.
File metadata
- Download URL: fastlabel-0.2.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e6df3bb7362b8b8761080b6c454dbf5e955fb3c5fcceac96ca4862b9d810c59
|
|
| MD5 |
2b0efb28e10ecc0f8d017be2706812d2
|
|
| BLAKE2b-256 |
1b0d4dffdf58d65f4eb78ad64a6fdd34473e82f29c7f9ea792ef239cc6272997
|
File details
Details for the file fastlabel-0.2.2-py3-none-any.whl.
File metadata
- Download URL: fastlabel-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b88b7be67bfc9c552c874f5de195f1a88273b939169b347846860bcf21313f9e
|
|
| MD5 |
3f55766a6c654681d3b4da583a98f8cd
|
|
| BLAKE2b-256 |
12373c4a901b4debfffdfc5cb25b78301902bb02d21f800c6e54454175100d61
|