Export audio annotations

How to export audio annotations and sample export formats.

Open this Colab for an interactive tutorial on exporting annotations.

📘

Deprecating Export V1

Starting in April 2024, we will begin sunsetting Export V1 for customers on a rolling basis. For more details, see this guide.

Export JSON annotations

# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed 
export_params= {
  "attachments": True,
  "metadata_fields": True,
  "data_row_details": True,
  "project_details": True,
  "label_details": True,
  "performance_details": True
}

# You can set the range for last_activity_at and label_created_at. 
# For context, last_activity_at captures the creation and modification of labels, metadata, status, comments and reviews.
# Note: This is an AND logic between the filters, so usually using one filter is sufficient.

filters= {
  "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
  "workflow_status": "Done"
}

export_task = project.export_v2(params=export_params, filters=filters)
export_task.wait_till_done()

if export_task.errors:
  print(export_task.errors)

export_json = export_task.result
print("results: ", export_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>"
}

client.enable_experimental = True

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.JsonConverterOutput):
  print(output.json_str)


if export_task.has_errors():
  export_task.get_stream(
  
  converter=lb.JsonConverter(),
  stream_type=lb.StreamType.ERRORS
  ).start(stream_handler=lambda error: print(error))

if export_task.has_result():
  export_json = export_task.get_stream(
    converter=lb.JsonConverter(),
    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": []
      }
    }
  }
}