@@ -23,30 +23,159 @@ import fastlabel
2323client = fastlabel.Client()
2424```
2525
26- ## Model Analysis
26+ ## Limitation
2727
28- ### Upload Predictions
28+ 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.
29+
30+ ## Task
31+
32+ ### Create Task
33+
34+ - Create a new task.
2935
3036``` python
31- import fastlabel
37+ task = client.create_image_task(
38+ project_id = " YOUR_PROJECT_ID" ,
39+ key = " sample.jpg" ,
40+ url = " https://sample.com/sample.jpg"
41+ )
42+ ```
3243
33- # Initialize client
34- client = fastlabel.Client()
44+ - Create a new task with pre-defined labels. (Class should be configured on your project in advance)
45+
46+ ``` python
47+ task = client.create_image_task(
48+ project_id = " YOUR_PROJECT_ID" ,
49+ key = " sample.jpg" ,
50+ url = " https://sample.com/sample.jpg" ,
51+ labels = [
52+ {
53+ " type" : " bbox" ,
54+ " value" : " bbox" ,
55+ " points" : [
56+ { " x" : 100 , " y" : 100 }, # top-left
57+ { " x" : 200 , " y" : 200 } # bottom-right
58+ ]
59+ }
60+ ]
61+ )
62+ ```
3563
36- # Create predictions
64+ > Check [ examples/create_image_task.py] ( /examples/create_image_task.py ) for other label types, such as line, keyPoint and polygon.
65+
66+ ### Find Task
67+
68+ - Find a single task.
69+
70+ ``` python
71+ task = client.find_task(task_id = " YOUR_TASK_ID" )
72+ ```
73+
74+ ### Get Tasks
75+
76+ - Get tasks. (Up to 100 tasks)
77+
78+ ``` python
79+ tasks = client.get_tasks(project_id = " YOUR_PROJECT_ID" )
80+ ```
81+
82+ - Filter and Get tasks. (Up to 100 tasks)
83+
84+ ``` python
85+ tasks = client.get_tasks(
86+ project_id = " YOUR_PROJECT_ID" ,
87+ status = " submitted" , # status can be 'registered', 'registered', 'submitted' or 'skipped'
88+ review_status = " accepted" # review_status can be 'notReviewed', 'inProgress', 'accepted' or 'declined'
89+ )
90+ ```
91+
92+ - Get a large size of tasks. (Over 100 tasks)
93+
94+ ``` python
95+ import time
96+
97+ # Iterate pages until new tasks are empty.
98+ all_tasks = []
99+ start_after = None
100+ while True :
101+ time.sleep(1 )
102+
103+ tasks = client.get_tasks(project_id = " YOUR_PROJECT_ID" , start_after = start_after)
104+ all_tasks.extend(tasks)
105+
106+ if len (tasks) > 0 :
107+ start_after = tasks[- 1 ][" id" ] # Set the last task id to start_after
108+ else :
109+ break
110+ ```
111+
112+ > Please wait a second before sending another requests!
113+
114+ ### Delete Task
115+
116+ ``` python
117+ client.delete_task(task_id = " YOUR_TASK_ID" )
118+ ```
119+
120+ ### Task Response
121+
122+ - Example of a single task object
123+
124+ ``` python
125+ {
126+ " id" : " YOUR_TASK_ID" ,
127+ " key" : " sample.png" ,
128+ " assigneeId" : null,
129+ " assigneeName" : null,
130+ " status" : " registered" ,
131+ " reviewAssigneeId" : null,
132+ " reviewAssigneeName" : null,
133+ " reviewStatus" : " notReviewed" ,
134+ " projectId" : " YOUR_PROJECT_ID" ,
135+ " datasetId" : " YOUR_DATASET_ID" ,
136+ " labels" : [
137+ {
138+ " id" : " YOUR_LABEL_ID" ,
139+ " type" : " bbox" ,
140+ " value" : " window" ,
141+ " title" : " 窓" ,
142+ " color" : " #d9713e" ,
143+ " metadata" : [],
144+ " points" : [
145+ { " x" : 100 , " y" : 100 }, # top-left
146+ { " x" : 200 , " y" : 200 } # bottom-right
147+ ]
148+ }
149+ ],
150+ " duration" : 0 ,
151+ " image" : {
152+ " width" : 1500 ,
153+ " height" : 1200
154+ },
155+ " createdAt" : " 2020-12-25T15:02:00.513" ,
156+ " updatedAt" : " 2020-12-25T15:02:00.513"
157+ }
158+ ```
159+
160+ ## Model Analysis
161+
162+ ### Upload Predictions
163+
164+ ``` python
165+ # Create your model predictions
37166predictions = [
38167 {
39- " fileKey" : " sample1 .jpg" , # file name exists in your project
168+ " fileKey" : " sample .jpg" , # file name exists in your project
40169 " labels" : [
41170 {
42- " value" : " line_a " , # class value exists in your project
171+ " value" : " bbox_a " , # class value exists in your project
43172 " points" : [
44- { " x" : 10 , " y" : 10 },
45- { " x" : 20 , " y" : 20 },
173+ { " x" : 10 , " y" : 10 }, # top-left
174+ { " x" : 20 , " y" : 20 }, # botom-right
46175 ]
47176 },
48177 {
49- " value" : " line_b " ,
178+ " value" : " bbox_b " ,
50179 " points" : [
51180 { " x" : 30 , " y" : 30 },
52181 { " x" : 40 , " y" : 40 },
@@ -58,9 +187,9 @@ predictions = [
58187
59188# Upload predictions
60189client.upload_predictions(
61- project_id = " project_id " , # your fastlabel project id
62- analysis_type = " line " , # annotation type to be analyze ("bbox" or "line" are supported)
63- threshold = 25 , # IoU percentage/pixel to analyze labels. (Ex: 0 - 100)
190+ project_id = " YOUR_PROJECT_ID " , # your fastlabel project id
191+ analysis_type = " bbox " , # annotation type to be analyze (Only "bbox" or "line" are supported)
192+ threshold = 80 , # IoU percentage/pixel distance to check labels are correct . (Ex: 0 - 100)
64193 predictions = predictions
65194)
66195```
0 commit comments