How to export audio annotations and sample export formats.
Export as JSON
# Set the export params to include/exclude certain fields.
export_params= {
"attachments": True,
"metadata_fields": True,
"data_row_details": True,
"project_details": True,
"label_details": True,
"performance_details": True,
"interpolated_frames": True
}
# Note: Filters follow AND logic, so typically using one filter is sufficient.
filters= {
"last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
"workflow_status": "<wkf-status>"
}
export_task = project.export(params=export_params, filters=filters)
export_task.wait_till_done()
# Return JSON output strings from export task results/errors, one by one:
# Callback used for JSON Converter
def json_stream_handler(output: lb.BufferedJsonConverterOutput):
print(output.json)
if export_task.has_errors():
export_task.get_buffered_stream(
stream_type=lb.StreamType.ERRORS
).start(stream_handler=lambda error: print(error))
if export_task.has_result():
export_json = export_task.get_buffered_stream(
stream_type=lb.StreamType.RESULT
).start(stream_handler=json_stream_handler)
print("file size: ", export_task.get_total_file_size(stream_type=lb.StreamType.RESULT))
print("line count: ", export_task.get_total_lines(stream_type=lb.StreamType.RESULT))
Annotation export formats
Classification - radio
{
"feature_id": "clnus73114gc4143u2dux654s",
"feature_schema_id": "clnus6slv06xo07yja7l47gtw",
"name": "radio_audio",
"value": "radio_audio",
"radio_answer": {
"feature_id": "clnus73114gc5143u2jadnt6r",
"feature_schema_id": "clnus6slv06xr07yj24yp1gdk",
"name": "second_radio_answer",
"value": "second_radio_answer",
"classifications": []
}
}
Classification - checklist
{
"feature_id": "clnus73114gc1143u7fzf4ebv",
"feature_schema_id": "clnus6slu06xi07yj7m9d7rft",
"name": "checklist_audio",
"value": "checklist_audio",
"checklist_answers": [
{
"feature_id": "clnus73114gc2143u6ah5wdhn",
"feature_schema_id": "clnus6slu06xj07yj9eb7dpvp",
"name": "first_checklist_answer",
"value": "first_checklist_answer",
"classifications": []
},
{
"feature_id": "clnus73114gc3143uq755vkzi",
"feature_schema_id": "clnus6slu06xl07yjdab4gxe8",
"name": "second_checklist_answer",
"value": "second_checklist_answer",
"classifications": []
}
]
}
Classification - free-form text
{
"feature_id": "clnus73114gc0143urjlfk558",
"feature_schema_id": "clnus6slu06xg07yjcg87apa0",
"name": "text_audio",
"value": "text_audio",
"text_answer": {
"content": "free text audio annotation"
}
}
Sample project export
{
"data_row": {
"id": "clftvvbln01cb07343mpx8n1l",
"global_key": "sample-audio-1.mp3",
"row_data": "https://storage.googleapis.com/labelbox-datasets/audio-sample-data/sample-audio-1.mp3",
"details": {
"dataset_id": "clftvva210b5t070d0no12z0v",
"dataset_name": "audio_annotation_import_demo_dataset",
"created_at": "2023-03-29T16:10:29.000+00:00",
"updated_at": "2024-02-10T20:36:56.174+00:00",
"last_activity_at": "2023-10-17T20:33:05.000+00:00",
"created_by": "[email protected]"
}
},
"media_attributes": {
"mime_type": "audio/mpeg"
},
"attachments": [],
"metadata_fields": [],
"projects": {
"clnus6sqx08k607yd0d33gfld": {
"name": "audio_project",
"labels": [
{
"label_kind": "Default",
"version": "1.0.0",
"id": "clnus731g4gc6143uyfqfbjth",
"label_details": {
"created_at": "2023-10-17T20:33:05.000+00:00",
"updated_at": "2023-10-17T20:33:05.000+00:00",
"created_by": "[email protected]",
"content_last_updated_at": "2023-10-17T20:33:05.001+00:00",
"reviews": []
},
"performance_details": {
"seconds_to_create": 0,
"seconds_to_review": 0,
"skipped": false
},
"annotations": {
"objects": [],
"classifications": [
{
"feature_id": "clnus73114gc0143urjlfk558",
"feature_schema_id": "clnus6slu06xg07yjcg87apa0",
"name": "text_audio",
"value": "text_audio",
"text_answer": {
"content": "free text audio annotation"
}
},
{
"feature_id": "clnus73114gc1143u7fzf4ebv",
"feature_schema_id": "clnus6slu06xi07yj7m9d7rft",
"name": "checklist_audio",
"value": "checklist_audio",
"checklist_answers": [
{
"feature_id": "clnus73114gc2143u6ah5wdhn",
"feature_schema_id": "clnus6slu06xj07yj9eb7dpvp",
"name": "first_checklist_answer",
"value": "first_checklist_answer",
"classifications": []
},
{
"feature_id": "clnus73114gc3143uq755vkzi",
"feature_schema_id": "clnus6slu06xl07yjdab4gxe8",
"name": "second_checklist_answer",
"value": "second_checklist_answer",
"classifications": []
}
]
},
{
"feature_id": "clnus73114gc4143u2dux654s",
"feature_schema_id": "clnus6slv06xo07yja7l47gtw",
"name": "radio_audio",
"value": "radio_audio",
"radio_answer": {
"feature_id": "clnus73114gc5143u2jadnt6r",
"feature_schema_id": "clnus6slv06xr07yj24yp1gdk",
"name": "second_radio_answer",
"value": "second_radio_answer",
"classifications": []
}
}
],
"relationships": []
}
}
],
"project_details": {
"ontology_id": "clnus6sl206xf07yj7md9cbg0",
"task_name": "Done",
"batch_id": "58ad3900-6d2c-11ee-a344-51974336e7ee",
"batch_name": "first-batch-audio-demo",
"workflow_status": "DONE",
"priority": 5,
"consensus_expected_label_count": 1,
"workflow_history": []
},
"project_tags": []
}
}
}