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()
# Stream the export using a callback function
def json_stream_handler(output: labelbox.BufferedJsonConverterOutput):
print(output.json)
export_task.get_buffered_stream(stream_type=labelbox.StreamType.RESULT).start(stream_handler=json_stream_handler)
# Collect all exported data into a list
export_json = [data_row.json for data_row in export_task.get_buffered_stream()]
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
Global and temporal classifications share the same export format for each type. In the export JSON file, temporal classifications are nested under a timestamp
field, while global classifications appear directly under the classifications
field. See the Sample project export to learn how each type is organized in the export.
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": "clzc6xfbealyn0713j929vdch",
"external_id": "example.mp3",
"row_data": "https://storage.googleapis.com/labelbox-datasets/audio-sample-data/sample-audio-1.mp3"
},
"media_attributes": {
"asset_type": "audio",
"mime_type": "audio/mpeg"
},
"projects": {
"clzc89nk900l707zmamti5zi0": {
"name": "Example audio project",
"labels": [
{
"label_kind": "Audio",
"version": "1.0.0",
"id": "cm8x9w1xj00h307ev0jmh8648",
"annotations": {
"classifications": [
{
"feature_id": "cm8xa12hd00023b6t0t3zirna",
"feature_schema_id": "cm8x9zz4d04ed071363gvhh5j",
"name": "Example global free text",
"value": "example_global_free_text",
"text_answer": {
"content": "Example global free text label",
"classifications": []
}
},
{
"feature_id": "cm8xa164700043b6t7wyqo0vv",
"feature_schema_id": "cm8x9zz4e04ef0713db9vea0f",
"name": "Example global radio",
"value": "example_global_radio",
"radio_answer": {
"feature_id": "cm8xa164600033b6tvz63hfqi",
"feature_schema_id": "cm8x9zz4e04eg0713hsxe3t0d",
"name": "Option 1",
"value": "option_1",
"classifications": []
}
},
{
"feature_id": "cm8xa17ps00063b6txb4g30fw",
"feature_schema_id": "cm8x9zz4e04er0713fc6fcs2r",
"name": "Example global checklist",
"value": "example_global_checklist",
"checklist_answers": [
{
"feature_id": "cm8xa17ps00053b6tc2skf6oh",
"feature_schema_id": "cm8x9zz4f04es0713g860a82c",
"name": "Option 1",
"value": "option_1",
"classifications": []
},
{
"feature_id": "cm8xa181c00083b6t7i9pixsb",
"feature_schema_id": "cm8x9zz4f04eu0713b95l1u2f",
"name": "Option 2",
"value": "option_2",
"classifications": []
}
]
}
],
"timestamp": {
"90697": {
"classifications": [
{
"feature_id": "cm8xa1k8600093b6tnrzpuq1n",
"feature_schema_id": "cm3jdcfpg0m6m07081ju276sz",
"name": "Example temporal free text",
"value": "free_text",
"text_answer": {
"content": "Example temporal free text label 1",
"classifications": []
}
},
{
"feature_id": "cm8xa2d2u000a3b6tk29o8u48",
"feature_schema_id": "cm8x9zz4e04el07135zmghx1q",
"name": "Example temporal radio",
"value": "example_temporal_radio",
"radio_answer": {
"feature_id": "cm8xa2d2u000b3b6ti9kszxcg",
"feature_schema_id": "cm8x9zz4e04em07132athat2z",
"name": "Option 1",
"value": "option_1",
"classifications": []
}
},
{
"feature_id": "cm8xa2hhh000c3b6tzeluuhpt",
"feature_schema_id": "cm8x9zz4f04ex0713f5rehhp0",
"name": "Example temporal checklist",
"value": "example_temporal_checklist",
"radio_answer": {
"feature_id": "cm8xa2ila000e3b6t410j19ir",
"feature_schema_id": "cm8x9zz4f04f00713drwj6qpb",
"name": "Option 2",
"value": "option_2",
"classifications": []
}
}
]
},
"23890": {
"classifications": [
{
"feature_id": "cm8xa1k8600093b6tnrzpuq1n",
"feature_schema_id": "cm3jdcfpg0m6m07081ju276sz",
"name": "Example temporal free text",
"value": "free_text",
"text_answer": {
"content": "Example temporal free text label 1",
"classifications": []
}
}
]
},
"6157": {
"classifications": [
{
"feature_id": "cm8xa1k8600093b6tnrzpuq1n",
"feature_schema_id": "cm3jdcfpg0m6m07081ju276sz",
"name": "Example temporal free text",
"value": "free_text",
"text_answer": {
"content": "Example temporal free text label 2",
"classifications": []
}
}
]
},
"33496": {
"classifications": [
{
"feature_id": "cm8xa2d2u000a3b6tk29o8u48",
"feature_schema_id": "cm8x9zz4e04el07135zmghx1q",
"name": "Example temporal radio",
"value": "example_temporal_radio",
"radio_answer": {
"feature_id": "cm8xa2d2u000b3b6ti9kszxcg",
"feature_schema_id": "cm8x9zz4e04em07132athat2z",
"name": "Option 1",
"value": "option_1",
"classifications": []
}
}
]
},
"60711": {
"classifications": [
{
"feature_id": "cm8xa2hhh000c3b6tzeluuhpt",
"feature_schema_id": "cm8x9zz4f04ex0713f5rehhp0",
"name": "Example temporal checklist",
"value": "example_temporal_checklist",
"radio_answer": {
"feature_id": "cm8xa2ila000e3b6t410j19ir",
"feature_schema_id": "cm8x9zz4f04f00713drwj6qpb",
"name": "Option 2",
"value": "option_2",
"classifications": []
}
}
]
}
},
"segments": {
"cm8xa1k8600093b6tnrzpuq1n": [
[
6157,
90697
]
],
"cm8xa2d2u000b3b6ti9kszxcg": [
[
33496,
90697
]
],
"cm8xa2ila000e3b6t410j19ir": [
[
60711,
90697
]
]
}
}
}
],
"project_tags": []
}
}
}
]