Skip to content

Commit 2e4f596

Browse files
authored
Merge pull request #113 from fastlabel/enhancement/1912-merge-splitted-task-annotation
feat: add integrate audio task
2 parents 537b447 + 437f2be commit 2e4f596

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,56 @@ Example of a single audio task object
11081108
}
11091109
```
11101110

1111+
#### Integrate Task
1112+
1113+
Integration is possible only when tasks are registered from the objects divided by the dataset.
1114+
1115+
In the case of a task divided under the following conditions.
1116+
1117+
dataset slug: audio
1118+
object name: voice.mp3
1119+
split count: 3
1120+
1121+
Objects are registered in the data set in the following form.
1122+
1123+
- audio/voice/1.mp3
1124+
- audio/voice/2.mp3
1125+
- audio/voice/3.mp3
1126+
1127+
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.
1128+
1129+
In this case, SPLIT_AUDIO_TASK_NAME_PREFIX specifies `audio/voice`.
1130+
1131+
```python
1132+
task = client.find_integrated_audio_task_by_prefix(
1133+
project="YOUR_PROJECT_SLUG",
1134+
prefix="SPLIT_AUDIO_TASK_NAME_PREFIX",
1135+
)
1136+
```
1137+
1138+
##### Response
1139+
1140+
Example of a integrated audio task object
1141+
1142+
```python
1143+
{
1144+
'groupId': 'eda3ba5b-082c-4813-ad6c-0479b72a27d5',
1145+
'name': 'audio/voice.mp3',
1146+
"annotations": [
1147+
{
1148+
"attributes": [],
1149+
"color": "#b36d18",
1150+
"start": 0.4,
1151+
"end": 0.5,
1152+
"title": "Bird",
1153+
"type": "segmentation",
1154+
"value": "bird"
1155+
}
1156+
],
1157+
}
1158+
```
1159+
1160+
11111161
### Audio Classification
11121162

11131163
Supported following project types:

fastlabel/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,25 @@ def delete_task(self, task_id: str) -> None:
15731573
endpoint = "tasks/" + task_id
15741574
self.api.delete_request(endpoint)
15751575

1576+
# Integrate Task
1577+
1578+
def find_integrated_audio_task_by_prefix(
1579+
self,
1580+
project: str,
1581+
prefix: str,
1582+
) -> dict:
1583+
"""
1584+
Returns a integrate audio task.
1585+
1586+
project is slug of your project (Required).
1587+
prefix is a prefix of task name (Required).
1588+
"""
1589+
endpoint = "tasks/integrate/audios"
1590+
params = {"project": project, "prefix": prefix}
1591+
1592+
return self.api.get_request(endpoint, params=params)
1593+
1594+
15761595
# Convert to Fastlabel
15771596

15781597
def convert_coco_to_fastlabel(self, file_path: str) -> dict:

0 commit comments

Comments
 (0)