Skip to content

Commit 528fda7

Browse files
authored
Merge pull request #164 from fastlabel/feature/dataset-new-api
feat: dataset public api
2 parents 3b273c2 + b4bd87a commit 528fda7

11 files changed

+516
-0
lines changed

README.md

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,47 @@ Delete a single dataset.
24172417
client.delete_dataset(dataset_id="YOUR_DATASET_ID")
24182418
```
24192419

2420+
### Get Dataset Attribute
2421+
2422+
Get all dataset attributes in the workspace.
2423+
2424+
```python
2425+
client.get_dataset_attributes()
2426+
```
2427+
2428+
You can filter by dataset_version_id.
2429+
2430+
```python
2431+
client.get_dataset_attributes(
2432+
dataset_version_id="YOUR_DATASET_VERSION_ID"
2433+
)
2434+
```
2435+
2436+
#### Response Dataset Attribute
2437+
2438+
See API docs for details.
2439+
2440+
```python
2441+
[
2442+
{
2443+
'name': {
2444+
'id': 'YOUR_DATASET_ATTRIBUTE_NAME_ID',
2445+
'name': 'Name',
2446+
'createdAt': '2022-10-31T02:20:00.248Z',
2447+
'updatedAt': '2022-10-31T02:20:00.248Z'
2448+
},
2449+
'values': [
2450+
{
2451+
'id': 'YOUR_DATASET_ATTRIBUTE_VALUE_ID',
2452+
'value': 'Value',
2453+
'createdAt': '2022-10-31T02:20:00.248Z',
2454+
'updatedAt': '2022-10-31T02:20:00.248Z'
2455+
}
2456+
]
2457+
}
2458+
]
2459+
```
2460+
24202461
### Create Dataset Object
24212462

24222463
Create object in the dataset.
@@ -2527,6 +2568,227 @@ See API docs for details.
25272568
]
25282569
```
25292570

2571+
### Get Dataset Object Annotation
2572+
2573+
Get dataset object annotations.
2574+
2575+
```python
2576+
client.get_dataset_object_annotations(
2577+
dataset_object_id="YOUR_DATASET_OBJECT_ID"
2578+
)
2579+
```
2580+
2581+
#### Response Dataset Object Annotation
2582+
2583+
See API docs for details.
2584+
2585+
```python
2586+
[
2587+
{
2588+
'id': 'YOUR_DATASET_OBJECT_ANNOTATION_ID',
2589+
"datasetVersionId": "YOUR_DATASET_VERSION_ID",
2590+
"datasetObjectId": "YOUR_DATASET_OBJECT_ID",
2591+
"datasetAnnotationClass": {
2592+
'id': 'YOUR_DATASET_ANNOTATION_CLASS_ID',
2593+
'datasetVersionId': 'YOUR_DATASET_VERSION_ID',
2594+
'type': 'bbox',
2595+
'value': 'value',
2596+
'title': 'title',
2597+
'color': '#FF0000',
2598+
'order': 1,
2599+
'createdAt': '2022-10-30T08:31:31.588Z',
2600+
'updatedAt': '2022-11-02T07:36:07.636Z'
2601+
},
2602+
'createdAt': '2022-10-30T08:31:31.588Z',
2603+
'updatedAt': '2022-11-02T07:36:07.636Z'
2604+
}
2605+
]
2606+
```
2607+
2608+
### Get Dataset Usage
2609+
2610+
Get dataset usages. (Up to 1000 usages)
2611+
2612+
```python
2613+
client.get_dataset_usages()
2614+
```
2615+
2616+
#### Response Dataset Usage
2617+
2618+
See API docs for details.
2619+
2620+
```python
2621+
[
2622+
{
2623+
'datasetId': 'YOUR_DATASET_ID',
2624+
'datasetName': 'YOUR_DATASET_NAME',
2625+
'datasetSlug': 'YOUR_DATASET_SLUG',
2626+
'datasetVersionId': 'YOUR_DATASET_VERSION_ID',
2627+
'datasetVersionName': 'YOUR_DATASET_VERSION_NAME',
2628+
'downloadCount': 1,
2629+
'id': 'YOUR_DATASET_USAGE_ID'
2630+
}
2631+
]
2632+
```
2633+
2634+
### Count Dataset Download
2635+
2636+
Count dataset download.
2637+
2638+
```python
2639+
client.count_dataset_download()
2640+
```
2641+
2642+
### Get Dataset Download Requests
2643+
2644+
Get dataset download requests. (Up to 1000 usages)
2645+
2646+
```python
2647+
client.get_dataset_download_requests()
2648+
```
2649+
2650+
You can filter by status.
2651+
2652+
```python
2653+
client.get_dataset_download_requests(
2654+
status="approvalPending" # status can be 'running', 'completed', 'failed', 'approvalPending', 'approved', 'rejected'
2655+
)
2656+
```
2657+
2658+
#### Response Dataset Download Requests
2659+
2660+
See API docs for details.
2661+
2662+
```python
2663+
[
2664+
{
2665+
'datasetName': 'YOUR_DATASET_NAME',
2666+
'exportDetail': {
2667+
'conditions': '{}',
2668+
'createdAt': '2023-07-28T07:02:27.736Z',
2669+
'datasetId': 'YOUR_DATASET_ID',
2670+
'datasetVersionId': 'YOUR_DATASET_VERSION_ID',
2671+
'datasetVersionName': 'YOUR_DATASET_VERSION_NAME',
2672+
'exportType': 'json',
2673+
'id': 'YOUR_DATASET_EXPORT_ID',
2674+
'msgCode': 'none',
2675+
'name': '2023-07-28-16-02-27',
2676+
'requestUserName': 'DOWNLOAD_REQUEST_USER_NAME',
2677+
'status': 'approvalPending',
2678+
'storageType': 'local'
2679+
},
2680+
'requestUserEmail': '[email protected]',
2681+
'requestUserWorkspaceName': 'fastlabel'
2682+
}
2683+
]
2684+
```
2685+
2686+
### Create Dataset Version
2687+
2688+
Create a new dataset version.
2689+
2690+
```python
2691+
client.create_dataset_version(
2692+
dataset_id="YOUR_DATASET_ID",
2693+
version="1.1" # Only numeric characters + dot is available
2694+
)
2695+
```
2696+
2697+
#### Response Dataset Version
2698+
2699+
See API docs for details.
2700+
2701+
```python
2702+
{
2703+
'id': 'YOUR_DATASET_VERSION_ID',
2704+
'version': '1.1',
2705+
'clusters': None,
2706+
'createdBy': '[email protected]',
2707+
'datasetId': 'YOUR_DATASET_ID',
2708+
'description': [],
2709+
'tags': [],
2710+
'attributes': [],
2711+
'createdAt': '2023-07-28T09:54:28.147Z',
2712+
'updatedAt': '2023-07-28T09:54:28.147Z'
2713+
}
2714+
```
2715+
2716+
### Find Dataset Version
2717+
2718+
Find a dataset version.
2719+
2720+
```python
2721+
client.find_dataset_version(
2722+
id="YOUR_DATASET_VERSION_ID"
2723+
)
2724+
```
2725+
2726+
Success response is the same as when created.
2727+
2728+
### Get Dataset Versions
2729+
2730+
Get dataset versions. (Up to 1000 versions)
2731+
2732+
```python
2733+
client.get_dataset_versions(
2734+
dataset_id="YOUR_DATASET_ID"
2735+
)
2736+
```
2737+
2738+
#### Response Dataset Versions
2739+
2740+
Success response is the same as when created.
2741+
2742+
### Get Dataset Version Create Histories
2743+
2744+
Get dataset version create histories. (Up to 1000 histories)
2745+
2746+
```python
2747+
client.get_dataset_version_create_histories(
2748+
dataset_id="YOUR_DATASET_ID"
2749+
)
2750+
```
2751+
2752+
#### Response Dataset Version Create Histories
2753+
2754+
See API docs for details.
2755+
2756+
```python
2757+
[
2758+
{
2759+
'id': 'YOUR_DATASET_CREATE_HISTORY_ID',
2760+
'status': 'completed',
2761+
'userName': '[email protected]',
2762+
'datasetId': 'YOUR_DATASET_ID',
2763+
'createdAt': '2023-07-28T05:29:34.618Z',
2764+
'destDatasetVersion': {
2765+
'attributes': [],
2766+
'clusters': None,
2767+
'createdAt': '2023-07-28T05:29:34.615Z',
2768+
'createdBy': '[email protected]',
2769+
'datasetId': 'YOUR_DATASET_ID',
2770+
'description': [],
2771+
'id': 'YOUR_DATASET_VERSION_ID',
2772+
'tags': [],
2773+
'updatedAt': '2023-07-28T05:29:34.615Z',
2774+
'version': '1.1'
2775+
},
2776+
'srcDatasetVersion': {
2777+
'attributes': [],
2778+
'clusters': None,
2779+
'createdAt': '2023-07-28T05:21:53.114Z',
2780+
'createdBy': '[email protected]',
2781+
'datasetId': 'YOUR_DATASET_ID',
2782+
'description': [],
2783+
'id': 'YOUR_DATASET_VERSION_ID',
2784+
'tags': [],
2785+
'updatedAt': '2023-07-28T05:21:53.114Z',
2786+
'version': '1'
2787+
}
2788+
},
2789+
]
2790+
```
2791+
25302792
## Converter
25312793

25322794
### FastLabel To COCO

examples/count_dataset_download.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
count = client.count_dataset_download()
8+
pprint(count)

examples/create_dataset_version.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_version = client.create_dataset_version(
8+
dataset_id="YOUR_DATASET_ID",
9+
version="version",
10+
)
11+
pprint(dataset_version)

examples/find_dataset_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_version = client.find_dataset_version(id="YOUR_DATASET_VERSION_ID")
8+
pprint(dataset_version)

examples/get_dataset_attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_attributes = client.get_dataset_attributes(
8+
dataset_version_id="YOUR_DATASET_VERSION_ID",
9+
)
10+
pprint(dataset_attributes)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_download_requests = client.get_dataset_download_requests()
8+
pprint(dataset_download_requests)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_object_annotations = client.get_dataset_object_annotations(
8+
dataset_object_id="YOUR_DATASET_OBJECT_ID",
9+
)
10+
pprint(dataset_object_annotations)

examples/get_dataset_usages.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_usages = client.get_dataset_usages()
8+
pprint(dataset_usages)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
histories = client.get_dataset_version_create_histories(dataset_id="YOUR_DATASET_ID")
8+
pprint(histories)

examples/get_dataset_versions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pprint import pprint
2+
3+
import fastlabel
4+
5+
client = fastlabel.Client()
6+
7+
dataset_versions = client.get_dataset_versions(dataset_id="YOUR_DATASET_ID")
8+
pprint(dataset_versions)

0 commit comments

Comments
 (0)