Custom Models API

Creating your dataset

In this guide we’ll walk you through the process of creating a dataset using the Hume API. In future sections you’ll use a dataset to train your own model.

Uploading media files to Hume

Upload media files to Hume that you want to exist in your custom dataset. These should be images, videos, audio, or text files.

cURL
$curl --location 'https://api.hume.ai/v0/registry/files'
>--request POST
>--header 'X-Hume-Api-Key: <YOUR API KEY>'
>--header 'Content-Type: application/json'
>--data '[
> {
> "file": {
> "name": "<NAME OF FILE>",
> "uri": "<URI OF FILE>",
> "hume_storage": true,
> "data_type": "image/png",
> "metadata": {}
> }
> },
> {
> "file": {
> "name": "<NAME OF FILE>",
> "uri": "<URI OF FILE>",
> "hume_storage": true,
> "data_type": "image/png",
> "metadata": {}
> }
> }
>]'

The API response will show an array of files newly registered with the Hume.

Response
1[
2 {
3 "file": {
4 "id": "9f045781-3ecd-4f34-ba9c-969139c32256",
5 "name": "<NAME OF FILE>",
6 "uri": "<URI OF FILE>",
7 "upload_uri": null,
8 "thumbnail_uri": null,
9 "user_id": "<YOUR USER ID>",
10 "data_type": "image/png",
11 "created_on": 1695851622,
12 "modified_on": 1695851622,
13 "metadata": {},
14 "hume_storage": true,
15 "hume_storage_upload_timestamp": null
16 },
17 "attributes": []
18 },
19 {
20 "file": {
21 "id": "7f02f481-4sf4-dsf3-ba9c-345639c32256",
22 "name": "<NAME OF FILE>",
23 ...
24 }
25 }
26]

Making your dataset file

We will create a CSV file that has a column for media file IDs and another column for labels. The file ID column is required and must be named file_id. The label column can be named whatever you want. And you can even have multiple label columns, but only one will be used for training your model.

Here we’ll add a label column called expressions and an extra column just for housekeeping called file_name.

file_namefile_idexpressions
neutral_face.jpegb3cd5662-ea89-4f00-8eae-86218a556027Neutral
positive_face.jpeg44bc2ac8-41d5-401e-8c88-df179b993be7Positive

Registering your dataset

Now that we have our media files registered and a CSV associating those files with labels, we can register our dataset.

$curl --location 'https://api.hume.ai/v0/registry/datasets'
>--request POST
>--header 'X-Hume-Api-Key: <YOUR API KEY>'
>--form 'name="Negative, Neutral, & Positive Facial Expressions"'
>--form 'labels_file=@"<PATH TO LABEL FILE>/labels-file.csv"'

Success! Your dataset is registered.

Response
1{
2 "id": "8d6ddf39-d9ff-4f9c-9dbe-d6e288d8ddd7", // Dataset ID
3 "name": "Negative, Neutral, & Positive Facial Expressions",
4 "latest_version": {
5 "id": "d153f723-8a13-48d2-ba74-2a6c333ff0db", // Dataset Version ID
6 "labels_file_uri": "<URI TO DATASET FILE>",
7 "dataset_id": "8d6ddf39-d9ff-4f9c-9dbe-d6e288d8ddd7",
8 "dataset_version": 0,
9 "created_on": 1695854279
10 },
11 "modified_on": 1695854279,
12 "metadata": null
13}