Skip to content

Commit b950230

Browse files
authored
Merge pull request #26 from fastlabel/develop
Merge to main
2 parents 134917a + 87b7081 commit b950230

File tree

4 files changed

+382
-71
lines changed

4 files changed

+382
-71
lines changed

README.md

Lines changed: 221 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ API is allowed to call 10000 times per 10 minutes. If you create/delete a large
3535

3636
Supported following project types:
3737

38-
- Bounding Box
39-
- Polygon
40-
- Keypoint
41-
- Line
42-
- Segmentation
38+
- Image - Bounding Box
39+
- Image - Polygon
40+
- Image - Keypoint
41+
- Image - Line
42+
- Image - Segmentation
43+
- Image - All
4344

4445
#### Create Task
4546

4647
- Create a new task.
4748

4849
```python
49-
task_id = client.create_task(
50+
task_id = client.create_image_task(
5051
project="YOUR_PROJECT_SLUG",
5152
name="sample.jpg",
5253
file_path="./sample.jpg"
@@ -56,7 +57,7 @@ task_id = client.create_task(
5657
- Create a new task with pre-defined annotations. (Class should be configured on your project in advance)
5758

5859
```python
59-
task_id = client.create_task(
60+
task_id = client.create_image_task(
6061
project="YOUR_PROJECT_SLUG",
6162
name="sample.jpg",
6263
file_path="./sample.jpg",
@@ -79,40 +80,28 @@ task_id = client.create_task(
7980
)
8081
```
8182

82-
> Check [examples/create_task.py](/examples/create_task.py).
83-
84-
#### Update Task
85-
86-
- Update a single task status and tags.
87-
88-
```python
89-
task_id = client.update_task(
90-
task_id="YOUR_TASK_ID",
91-
status="approved",
92-
tags=["tag1", "tag2"]
93-
)
94-
```
83+
> Check [examples/create_image_task.py](/examples/create_image_task.py).
9584
9685
#### Find Task
9786

9887
- Find a single task.
9988

10089
```python
101-
task = client.find_task(task_id="YOUR_TASK_ID")
90+
task = client.find_image_task(task_id="YOUR_TASK_ID")
10291
```
10392

10493
#### Get Tasks
10594

10695
- Get tasks. (Up to 1000 tasks)
10796

10897
```python
109-
tasks = client.get_tasks(project="YOUR_PROJECT_SLUG")
98+
tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG")
11099
```
111100

112101
- Filter and Get tasks. (Up to 1000 tasks)
113102

114103
```python
115-
tasks = client.get_tasks(
104+
tasks = client.get_image_tasks(
116105
project="YOUR_PROJECT_SLUG",
117106
status="approved", # status can be 'registered', 'in_progress', 'completed', 'skipped', 'in_review', 'send_backed', 'approved', 'customer_in_review', 'customer_send_backed', 'customer_approved'
118107
tags=["tag1", "tag2"] # up to 10 tags
@@ -130,8 +119,7 @@ offset = None
130119
while True:
131120
time.sleep(1)
132121

133-
tasks = client.get_tasks(
134-
project="YOUR_PROJECT_SLUG", offset=offset)
122+
tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG", offset=offset)
135123
all_tasks.extend(tasks)
136124

137125
if len(tasks) > 0:
@@ -142,25 +130,22 @@ while True:
142130

143131
> Please wait a second before sending another requests!
144132
145-
#### Delete Task
133+
#### Response
146134

147-
- Delete a single task.
148-
149-
```python
150-
client.delete_task(task_id="YOUR_TASK_ID")
151-
```
152-
153-
#### Task Response
154-
155-
- Example of a single task object
135+
- Example of a single image task object
156136

157137
```python
158138
{
159139
"id": "YOUR_TASK_ID",
160140
"name": "cat.jpg",
141+
"width": 100, # image width
142+
"height": 100, # image height
161143
"url": "YOUR_TASK_URL",
162144
"status": "registered",
163145
"tags": [],
146+
"assignee": "ASSIGNEE_NAME",
147+
"reviewer": "REVIEWER_NAME",
148+
"customerReviewer": "CUSTOMER_REVIEWER_NAME",
164149
"annotations": [
165150
{
166151
"attributes": [
@@ -183,15 +168,84 @@ client.delete_task(task_id="YOUR_TASK_ID")
183168
}
184169
```
185170

171+
### Image Classification
172+
173+
Supported following project types:
174+
175+
- Image - Classification
176+
177+
#### Create Task
178+
179+
- Create a new task.
180+
181+
```python
182+
task_id = client.create_image_classification_task(
183+
project="YOUR_PROJECT_SLUG",
184+
name="sample.jpg",
185+
file_path="./sample.jpg",
186+
attributes=[
187+
{
188+
"key": "attribute-key",
189+
"value": "attribute-value"
190+
}
191+
],
192+
)
193+
```
194+
195+
#### Find Task
196+
197+
- Find a single task.
198+
199+
```python
200+
task = client.find_image_classification_task(task_id="YOUR_TASK_ID")
201+
```
202+
203+
#### Get Tasks
204+
205+
- Get tasks. (Up to 1000 tasks)
206+
207+
```python
208+
tasks = client.get_image_classification_tasks(project="YOUR_PROJECT_SLUG")
209+
```
210+
211+
#### Response
212+
213+
- Example of a single image classification task object
214+
215+
```python
216+
{
217+
"id": "YOUR_TASK_ID",
218+
"name": "cat.jpg",
219+
"width": 100, # image width
220+
"height": 100, # image height
221+
"url": "YOUR_TASK_URL",
222+
"status": "registered",
223+
"tags": [],
224+
"assignee": "ASSIGNEE_NAME",
225+
"reviewer": "REVIEWER_NAME",
226+
"customerReviewer": "CUSTOMER_REVIEWER_NAME",
227+
"attributes": [
228+
{
229+
"key": "kind",
230+
"name": "Kind",
231+
"type": "text",
232+
"value": "Scottish field"
233+
}
234+
],
235+
"createdAt": "2021-02-22T11:25:27.158Z",
236+
"updatedAt": "2021-02-22T11:25:27.158Z"
237+
}
238+
```
239+
186240
### Multi Image
187241

188242
Supported following project types:
189243

190-
- Bounding Box
191-
- Polygon
192-
- Keypoint
193-
- Line
194-
- Segmentation
244+
- Multi Image - Bounding Box
245+
- Multi Image - Polygon
246+
- Multi Image - Keypoint
247+
- Multi Image - Line
248+
- Multi Image - Segmentation
195249

196250
#### Create Task
197251

@@ -228,10 +282,6 @@ task = client.create_multi_image_task(
228282
)
229283
```
230284

231-
#### Update Task
232-
233-
- Same as image task.
234-
235285
#### Find Task
236286

237287
- Find a single task.
@@ -248,11 +298,7 @@ task = client.find_multi_image_task(task_id="YOUR_TASK_ID")
248298
tasks = client.get_multi_image_tasks(project="YOUR_PROJECT_SLUG")
249299
```
250300

251-
#### Delete Task
252-
253-
- Same as image task.
254-
255-
#### Task Response
301+
#### Response
256302

257303
- Example of a single task object
258304

@@ -264,12 +310,15 @@ tasks = client.get_multi_image_tasks(project="YOUR_PROJECT_SLUG")
264310
{
265311
"name": "content-name",
266312
"url": "content-url",
267-
"width": "content-width",
268-
"height": "content-height",
313+
"width": 100,
314+
"height": 100,
269315
}
270316
],
271317
"status": "registered",
272318
"tags": [],
319+
"assignee": "ASSIGNEE_NAME",
320+
"reviewer": "REVIEWER_NAME",
321+
"customerReviewer": "CUSTOMER_REVIEWER_NAME",
273322
"annotations": [
274323
{
275324
"content": "content-name"
@@ -297,14 +346,134 @@ tasks = client.get_multi_image_tasks(project="YOUR_PROJECT_SLUG")
297346
}
298347
```
299348

349+
### Video
350+
351+
Supported following project types:
352+
353+
- Video - Bounding Box
354+
355+
#### Create Task
356+
357+
- Create a new task.
358+
359+
```python
360+
task_id = client.create_video_task(
361+
project="YOUR_PROJECT_SLUG",
362+
name="sample.mp4",
363+
file_path="./sample.mp4"
364+
)
365+
```
366+
367+
#### Find Task
368+
369+
- Find a single task.
370+
371+
```python
372+
task = client.find_video_task(task_id="YOUR_TASK_ID")
373+
```
374+
375+
#### Get Tasks
376+
377+
- Get tasks. (Up to 10 tasks)
378+
379+
```python
380+
tasks = client.get_video_tasks(project="YOUR_PROJECT_SLUG")
381+
```
382+
383+
#### Response
384+
385+
- Example of a single image classification task object
386+
387+
```python
388+
{
389+
"id": "YOUR_TASK_ID",
390+
"name": "cat.jpg",
391+
"width": 100, # image width
392+
"height": 100, # image height
393+
"fps": 30.0, # frame per seconds
394+
"frameCount": 480, # total frame count of video
395+
"duration": 16.0, # total duration of video
396+
"url": "YOUR_TASK_URL",
397+
"status": "registered",
398+
"tags": [],
399+
"assignee": "ASSIGNEE_NAME",
400+
"reviewer": "REVIEWER_NAME",
401+
"customerReviewer": "CUSTOMER_REVIEWER_NAME",
402+
"annotations": [
403+
{
404+
"attributes": [],
405+
"color": "#b36d18",
406+
"points": {
407+
"1": { # number of frame
408+
"value": [
409+
100, # top-left x
410+
100, # top-left y
411+
200, # bottom-right x
412+
200 # bottom-right y
413+
],
414+
"autogenerated": False # False when annotated manually. True when auto-generated by system.
415+
},
416+
"2": {
417+
"value": [
418+
110,
419+
110,
420+
220,
421+
220
422+
],
423+
"autogenerated": True
424+
},
425+
"3": {
426+
"value": [
427+
120,
428+
120,
429+
240,
430+
240
431+
],
432+
"autogenerated": False
433+
}
434+
},
435+
"title": "Cat",
436+
"type": "bbox",
437+
"value": "cat"
438+
}
439+
],
440+
"createdAt": "2021-02-22T11:25:27.158Z",
441+
"updatedAt": "2021-02-22T11:25:27.158Z"
442+
}
443+
```
444+
445+
### Common
446+
447+
APIs for update and delete are same over all tasks.
448+
449+
#### Update Task
450+
451+
- Update a single task status and tags.
452+
453+
```python
454+
task_id = client.update_task(
455+
task_id="YOUR_TASK_ID",
456+
status="approved",
457+
tags=["tag1", "tag2"]
458+
)
459+
```
460+
461+
#### Delete Task
462+
463+
- Delete a single task.
464+
465+
```python
466+
client.delete_task(task_id="YOUR_TASK_ID")
467+
```
468+
300469
## Converter
301470

302471
### COCO
303472

304473
- Get tasks and convert to [COCO format](https://cocodataset.org/#format-data) (supporting bbox or polygon annotation type).
305474

306475
```python
307-
tasks = client.get_tasks(project="YOUR_PROJECT_SLUG")
476+
tasks = client.get_image_tasks(project="YOUR_PROJECT_SLUG")
308477
pprint(client.to_coco(tasks))
309478
```
310479

examples/create_task.py renamed to examples/create_image_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
]
2626
}]
2727

28-
task_id = client.create_task(
28+
task_id = client.create_image_task(
2929
project=project,
3030
name=name,
3131
file_path=file_path,

0 commit comments

Comments
 (0)