# Universal Data Tool Docs

Learn install, use, and build datasets with the Universal Data Tool.

## Mission

The Universal Data Tool exists to empower anyone, even those without a data science or engineering background, to build the next generation of powerful, useful and impactful Artificial Intelligence applications by providing tooling and standards for the creation, collaboration, labeling and formatting of datasets. **The Universal Data Tool is built to be accessible, easy-to-use, human-friendly and developer-friendly.**

![Some of the dataset types available with the UDT](/files/-MIFm-xyd-D_rKcy7qo6)

## Editing these Docs

You can edit this documentation by opening a [PR to the markdown docs on Github](https://github.com/UniversalDataTool/docs). Contributions are welcome and very appreciated!

## Getting Help

We have a [Slack channel](https://universaldatatool.slack.com)! Feel free to come in and ask questions. You can also [open an issue on Github](https://github.com/UniversalDataTool/universal-data-tool/issues).


# Installation

## Usage on Web

Just go to [universaldatatool.com/app](https://universaldatatool.com/app)!

## Using on Desktop (Windows, Mac, Linux)

You can download the latest releases of the Universal Data Tool from the [Github Releases page](https://github.com/UniversalDataTool/universal-data-tool/releases).

{% hint style="info" %}
Our Windows Desktop application needs contributors! If you run into any issues, or better yet manage to resolve them, [send us a contribution!](https://github.com/UniversalDataTool/universal-data-tool/tree/master/CONTRIBUTING.md)
{% endhint %}

## Using with Python or Jupyter Notebook

If you use [Fast.ai](/machine-learning/fastai) or [Tensorflow](/installation), [Pytorch](/installation), brat etc. look at the respective guides in the Machine Learning section of these docs.

```python
import universaldatatool as udt

ds = udt.Dataset(
    interface="image_classification",
    image_urls=["https://example.com/image1.png"],
    labels=["cat", "dog"]
)

ds.to_json() # Outputs .udt.json

udt.open() # Opens the Universal Data Tool in Jupyter Notebooks
```

You can do much more! Check out the [Getting Started with Python](/machine-learning/jupyter-notebooks) for more details!

## Using with React or Embedded on Webpage

Check out the guide for [Getting Started with React](/integrate-with-any-web-page/getting-started-with-react) or [Integrate the Javascript Library](/integrate-with-any-web-page/integrate-with-the-javascript-library).

{% hint style="info" %}
I recommend trying out the web tool before integrating. For many use cases, you can avoid the integration all together just by [using the online tool](https://universaldatatool.com/app)!
{% endhint %}


# Running On-Premise

Run the Universal Data Tool on your infrastructure.

> For small companies or projects, you might want to consider just using the [Desktop Application](/installation#using-on-desktop-windows-mac-linux) or [udt.dev](https://udt.dev), which requires less setup!

The Universal Data Tool can be run and customized on your own infrastructure easily. This is best for users who want to keep their version of Universal Data Tool stable, and don't need new features from weekly releases. You may also want to keep your data within your network.

## Run via Docker

The Universal Data Tool builds docker containers on every new release. You can run the Universal Data Tool using...

```bash
# Starts the Universal Data Tool on port 3000 and a collaborative server on 3001
docker run -d -p 3000:3000 -p 3001:3001 \
             -e UDT_collaborationServer_url=http://localhost:3001 \
             universaldatatool/universaldatatool
```

You can provide different options to the docker container to control various aspects of Universal Data Tool. Below is a table of a few of the configuration parameters can customize. You'll know if a configuration value is used because it will appear in the starting logs like the following image...

![Configuration values are shown in a table on start](/files/-MJrN8ol7xf6Mo-pdnLA)

| Environment Var                         | Description                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------------------- |
| `UDT_collaborationServer_url`           | Collaboration server URL                                                              |
| `UDT_pluginUrls`                        | Comma-delimited URLs to plugins that should be loaded by default                      |
| `UDT_auth_proxy_corsproxy`              | Proxy to use for CORS requests, e.g. to make api requests that are disallowed by CORs |
| `UDT_auth_s3iam_accessKeyId`            | Access Key for uploading/importing from AWS S3 buckets                                |
| `UDT_auth_s3iam_secretAccessKey`        | Secret Access Key for uploading/importing from AWS S3 buckets                         |
| `UDT_s3iam_region`                      | Region of S3 Bucket                                                                   |
| `UDT_auth_cognito_identityPoolId`       | Cognito Identity Pool Id                                                              |
| `UDT_auth_cognito_region`               | Cognito Region                                                                        |
| `UDT_auth_cognito_userPoolId`           | Cognito user pool id                                                                  |
| `UDT_auth_cognito_userPoolWebClientId`  | Cognito user pool web client id                                                       |
| `UDT_auth_cognito_storage_awsS3_bucket` | Bucket to use for Cognito object storage                                              |
| `UDT_auth_cognito_storage_awsS3_region` | Region of bucket to use for Cognito                                                   |
| `UDT_labelhelp_disabled`                | Disable remote paid collaboration requests                                            |
| `UDT_labelhelp_apikey`                  | API Key for requesting work from Label Help                                           |

These are the most common configuration values, but you can also customize hotkeys or any other attribute the appears in the [AppConfig](https://github.com/UniversalDataTool/universal-data-tool/blob/master/src/components/AppConfig/index.js).

## Independent Collaboration Server

Sometimes, you may want to run the Collaboration Server on a different machine than the Client Application, you can do this by using the npm module.

```
# via npm
npm install -g udt-collaboration-server

udt-collaboration-server --port 3001
```


# Collaborative Labeling

Label a dataset with a team of labellers or friends.

## Start a Collaborative Session

You can start a collaborative session at any time by clicking the Collaborate icon at the top of the screen.

![Create a collaborative session](/files/-MIBE8L8GdtwrXdfYKQq)

After starting a collaborative session, your url will change to a link you can share with anyone to join your session. Whenever a sample is saved, the dataset will update for everyone in the session and a notification will appear at the bottom right indicating a collaborative sample was saved.

![Your share link should be visible at the top](/files/-MIBG2B8YHW0gA-wN1c_)


# Image Segmentation

Segment instances on image datasets using the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Image Segmentation button from the `Setup > Data Type` page.

![](/files/-MI5yZO_K24uUxEykcwf)

You can configure the Image Segmentation to create the right interface for your dataset. Use the `Setup > Preview` button to see your interface against either an example image or a sample from your dataset.

![Image Segmentation with Bounding Box Classification](/files/-MI62IzcaVvt6pVMSitu)

#### Configuring Regions and Labels

The Image Segmentation interface allows different types of regions, the options for regions are:

* bounding-box
* polygon
* point

Each region can any number of labels, which can be configured under "Available Labels"

![](/files/-MI619VeDw1PxdldrLTz)

## Import Data

You can use any of the following methods to import image data. If you're just getting started, you can quickly create a dataset using the COCO Images method!

* [Import COCO Dialog](/importing-data/coco-images)
* [Import from Google Drive](/importing-data/import-from-google-drive)
* [Import from AWS S3 Bucket](/importing-data/import-from-aws-s3-bucket)
* [Import from List of URLs](/importing-data/import-file-urls)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)
* [Upload or Open Directory](/importing-data/upload-or-open-directories)

## Label your Data!

Use the `Label` tab to label your data. Look at the [Collaborative Labeling Guide](/collaborative-labeling) to label with others.

## Export and Use

You can download your data using the download icon at the top.

![Download your data in CSV or JSON format to use the annotations](/files/-MIC16UN_c6e0nF3J9QH)

You can use the [Universal Data Tool Converter](https://universaldatatool.com/convert) to convert UDT files into PNG masks, or other formats that are helpful for machine learning datasets.

![It's very common to convert into PNGs](/files/-MIC289RAzqgyoTZQ1u4)


# Image Classification

Classify or tag images using the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Image Segmentation button from the `Setup > Data Type` page.

![](/files/-MIBB8b2peYagzSg1Cbq)

## Import Data

You can use any of the following methods to import image data. If you're just getting started, you can quickly create a dataset using the COCO Images method!

* [Import COCO Dialog](/importing-data/coco-images)
* [Import from Google Drive](/importing-data/import-from-google-drive)
* [Import from AWS S3 Bucket](/importing-data/import-from-aws-s3-bucket)
* [Import from List of URLs](/importing-data/import-file-urls)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)
* [Upload or Open Directory](/importing-data/upload-or-open-directories)

## Label your Data (with friends!)

Use the `Label` tab to label your data. Look at the [Collaborative Labeling Guide](/collaborative-labeling) to label with others.

![An example Image Classification labeling task](/files/-MIFT4BKQXTIVczYsLNp)

## Export and Use

The image classification format is easy to use. If you'd like the data in a tabular format, download as CSV and consider taking a look at the [Pandas Usage Guide](/machine-learning/import-datasets-into-pandas) (which makes it easy to load into python). You can also download the images into folders using the [Fast.ai Image Classification Guide](/machine-learning/fastai/import-datasets-for-fast.ai-image-classification).


# Text Classification

Classify text using the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Text Classification button from the `Setup > Data Type` page.

![](/files/-MI5yZO_K24uUxEykcwf)

You can now configure the interface you'd like for you Text Classification dataset by adding any classifications you'd like to display per sample, as well as configure if multiple classifications are allowed to be selected.

![Text Classification Configuration](/files/-MIFU5MD1KVnohP5VBoN)

## Import Data

You can use any of the following methods to import text data. If you're just getting started, you can quickly create a dataset using the COCO Images method!

* [Import Text Snippets](/importing-data/import-text-snippets)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

Go to the `Label` tab to begin labeling data. See the [Collaborative Labeling Guide](/collaborative-labeling) to label with friends or a team of your labelers.

![An example Text Classification interface](/files/-MIFV5dbhH1wW0OYFTDt)

## Export and Use

Text Classification can easily be exported and read as a CSV or JSON file.

For example, if you export as a CSV you'll get a table that looks like the following:

| path      | document                              | annotation          |
| --------- | ------------------------------------- | ------------------- |
| samples.0 | This has made me so happy. I love it. | positive\_sentiment |
| samples.1 | I hate this thing. It's so bad.       | negative\_sentiment |


# Named Entity Recognition

Label words or phrases within text using the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Named Entity Recognition button from the `Setup > Data Type` page.

![Select Named Entity Recognition when choosing an interface](/files/-MI5yZO_K24uUxEykcwf)

You can now configure the interface you'd like for you Named Entity Recognition dataset by adding any labels you'd like to display per sample.

![Named Entity Recognition Configuration](/files/-MIFVmniU3vVkbNe1m3I)

## Import Data

You can use any of the following methods to import text data.

* [Import Text Snippets](/importing-data/import-text-snippets)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

Go to the `Label` tab to begin labeling data. See the [Collaborative Labeling Guide](/collaborative-labeling) to label with friends or a team of your labelers.

![Named Entity Recognition Example Interface](/files/-MIFWlymn4iqkDZ76fyI)

## Export and Use

The easiest way to use a Named Entity Recognition dataset is using the JSON format. Use the "Download JSON" button at the top when you're done labeling and check out the [Named Entity Recognition JSON Specification](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/text_entity_recognition.md).

Here's what a JSON sample looks like in the resultant dataset:

```javascript
{
  "document": "This strainer makes a great hat, I'll wear it while I serve spaghetti",
  "annotation": {
    "entities": [
      { text: "strainer", label: "hat", start: 5, end: 12 },
      { text: "spaghetti", label: "food", start: 60, end: 68 }
    ]
  }
}
```


# Entity Relations / Part of Speech Tagging

Named Entity Linking (PoS tagging) with the Universal Data Tool. Draw relationships between words or phrases within text.

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Text Entity Relations button from the `Setup > Data Type` page.

![Select Text Relations when choosing an interface](/files/-MI5yZO_K24uUxEykcwf)

You can now configure the interface you'd like for you Text Entity Relations dataset by adding any labels you'd like to display per sample.

![Text Entity Relation Configuration](/files/-MIFcVB12LBF9awB5auV)

## Import Data

You can use any of the following methods to import text data.

* [Import Text Snippets](/importing-data/import-text-snippets)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

Go to the `Label` tab to begin labeling data. See the [Collaborative Labeling Guide](/collaborative-labeling) to label with friends or a team of your labelers.

![Example of Text Entity Relations labeling](/files/-MIFcEbcT2Cr0trAMY5Q)

## Export and Use

The easiest way to use a Entity Relations dataset is using the JSON format. Use the "Download JSON" button at the top when you're done labeling and check out the [Text Entity Relations JSON Specification](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/text_entity_relations.md).

Here's what a JSON sample looks like in the resultant dataset:

```javascript
{
  "document": "This strainer makes a great hat, I'll wear it while I serve spaghetti!",
  "annotation": {
    "entities": [
      {
        "text": "strainer",
        "label": "hat",
        "start": 5,
        "end": 13,
        "textId": "id1"
      },
      {
        "text": "spaghetti",
        "label": "food",
        "start": 60,
        "end": 69,
        "textId": "id2"
      },
      {
        "text": "I'll",
        "start": 33,
        "end": 37,
        "textId": "id3"
      },
      {
        "text": "wear",
        "start": 38,
        "end": 42,
        "textId": "id4"
      }
    ],
    "relations": [
      {
        "from": "id3",
        "to": "id4",
        "label": "subject-doing"
      }
    ]
  }
}
```


# Audio Transcription

Transcribe audio with the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Audio Transcription button from the `Setup > Data Type` page.

![Select Audio Transcription when choosing an interface](/files/-MI5yZO_K24uUxEykcwf)

You can now configure the interface you'd like for you Audio Transcription dataset.

![Configuration for Audio Transcription](/files/-MIFi2J5dUeAyke6s6cn)

## Import Data

You can use any of the following methods to import text data.

* [Import File URLs](/importing-data/import-file-urls)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

![Example Audio Transcription Sample](/files/-MIFii1RmEdDltA0rRwc)

## Export and Use

The easiest way to use a Audio Transcription dataset is using the JSON or CSV format. Use the "Download JSON" or "Download CSV" button at the top when you're done labeling.


# Data Entry

Do any type of data entry with the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Data Entry button from the `Setup > Data Type` page.

![](/files/-MI5yZO_K24uUxEykcwf)

You can configure the Data Entry to create the right interface for your dataset. Use the `Setup > Preview` button to see your interface against either an example image or a sample from your dataset.

![Configure the Data Entry interface](/files/-MIFm_U-R1l6Jb2SOLbq)

You can add a variety of different inputs by clicking the "Add Input" button.

![Input types available when you click Add Input](/files/-MIFmm52NyogL6FHLP43)

## Import Data

You can use virtually any method of importing for data entry datasets, here is a list of common import methods.

* [Import from AWS S3 Bucket](/importing-data/import-from-aws-s3-bucket)
* [Import from List of URLs](/importing-data/import-file-urls)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)
* [Upload or Open Directory](/importing-data/upload-or-open-directories)
* [Import from Google Drive](/importing-data/import-from-google-drive)

## Label your Data (with friends!)

![Example Data Entry Sample](/files/-MIFnU55VSkNY24xr-Jz)

## Export and Use

You can use either JSON or CSV to export the Data Entry type. See the full [Data Entry JSON Specification](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/data_entry.md) for how the Data Entry JSON is formatted.

Each JSON sample looks like the following:

```javascript
{
    "pdfUrl": "https://...", // or imageUrl, document etc.
    
    "annotation": { "FieldName": "..." }
}
```


# Video Segmentation

Segment objects or parts of a video with the Universal Data Tool

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

Then select the Video Segmentation button from the `Setup > Data Type` page.

![](/files/-MI5yZO_K24uUxEykcwf)

You can configure the Video Segmentation to create the right labels or segmentation region types for your dataset. Use the `Setup > Preview` button to see your interface against either an example image or a sample from your dataset.

#### Configuring Regions and Labels

The Video Segmentation interface allows different types of regions, the options for regions are:

* bounding-box
* polygon
* point

Each region can any number of labels, which can be configured under "Available Labels"

![Configure Video Segmentation Interface](/files/-MIFkkxJ1GV0foSAjuDl)

## Import Data

You can use any of the following methods to import video data.

* [Import File URLs](/importing-data/import-file-urls)
* [Import from CSV or JSON](/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

The easiest way to use a Video Segmentation dataset is using the JSON or CSV format. You can use the timeline at the top to go to different frames of the video. Regions will automatically interpolate between frames.

![](/files/-MIFlcz3Lwuvk-MW-VKN)

## Export and Use

Use the "Download JSON" or "Download CSV" button at the top when you're done labeling.


# Composite Interfaces

Use multiple UDT interfaces together with a Composite Interface.

## What is a Composite Interface?

A composite interface is an interface that contains other interfaces within in. It's very helpful if you're doing multiple operations on an image. For example, you might need to do some data entry on an image, such as doing Optical Character Recognition.

## Setup the Dataset

Select "Composite" from `Setup > Data Type`, then select Configure to create additional interfaces, and configure each one individually.

![](/files/-MIFjeUS_rA2scbTob31)

## Labeling Composite Interfaces

When labeling a composite interface, you'll be prompted to select any of the sub-interfaces on each sample.

![Select each sub-interface when labeling to add data for that sample](/files/-MIFk09lbG00WahRxICs)

## Exporting JSON

When exporting a composite interface, it's best to use the JSON format. Check out the [Composite Interface JSON Format ](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/composite.md)Specification.

The resultant JSON for each sample looks like this:

```javascript
{
  /* ... same information as sample, e.g. imageUrl ... */

  // Expected annotation
  "annotation": {
    // Each key is a fieldName, the annotation is the annotation from that interface
    "some_field_name": {/*... whatever annotation goes with the interface defined for this field ...*/}
  }
}
```


# Landmark / Pose Annotation

Pose / Landmark / Keypoints annotation in the Universal Data Tool

Landmark or pose annotation can be used to annotate human bodies or any object with connected keypoints.

![Select Image Landmark Annotation on the Setup > Data Type](/files/-MIBghSucvylg1njGOws)

You can configure the connections and the number of points to create different pose configurations. Go to the JSON tab to edit the points.

![The preview screen allows you to see your landmarks](/files/-MIC0ZmGXOv1zbE3kxAw)


# Upload or Open Directories

Open directories or upload files to your Universal Data Tool dataset

## Uploading Files

The best way to upload files is via the "Upload to S3" dialog, which requires that you connect your S3 bucket to the Universal Data Tool. You can find details on how to do that in the [Import from S3 guide](/importing-data/import-from-aws-s3-bucket).

![Import files Dialog](/files/-MIB5bHOxfvw9iTffM8Q)

## Opening Files

You can only open files in the desktop application, because web apps aren't allowed to access filesystem directories. To select a directory full of files, use the `Samples > Import from Directory` button.

{% hint style="warning" %}
If you Import files from Directory your UDT dataset will use "links" to files on your system, this means they won't be very accessible if you're sharing your dataset or using it on multiple computers.
{% endhint %}


# Import File URLs

You can import a list of urls or paste urls directly into the Universal Data Tool

Use the "Paste URLs" dialog to paste or upload a list of urls to files, such as images, audio files.

![](/files/-MIBJtf_WqZlBzejdEVa)


# Import COCO Images

Easily import the COCO dataset from within the UDT

You can quickly import images and annotations from the [Common Objects in Context dataset](https://cocodataset.org) from within the Universal Data Tool.

## 1. Create a New Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](/files/-MI11H2GNT530d7n2r1Q)

## 2. Import from COCO using Dialog

Go to Samples > Import > Import from COCO.

![Select "Import from COCO" on the Samples > Import page](/files/-MI11dzYZT2SBd89ERP9)

Type in any classifications you want. Select "Replace Interface" if you want to replace the interface from the Setup Page with an interface compatible with your labels.

![Add any labels you want, look at the preview images, and click Add Samples](/files/-MI129u50zhImeSruatC)

## 3. (optional) Add more labels!

You can now go to "Samples > Label" and view labels, edit labels or delete samples.

![Example interface from the Cat and Dog dataset created above](/files/-MI12qdjR9VFS8oKuXsy)


# Import from Google Drive

Import folders from Google Drive directly for dataset labeling and annotation

After creating a new file on [udt.dev](https://udt.dev), navigate to `Samples > Import > Import from Google Drive`

![](/files/-MIAqOAICg9N2SFU3htw)

You'll be prompted to log in with google. After signing in, you can browse and search for files and folders within Google Drive.

![You can select and search for any data within Google Drive](/files/-MIArVJIpoENdM13pDw4)

Make sure that files have public share links, this will allow you or anyone you send your UDT file to to access the files without logging in to your Google Account.

![Every file should have permissions set as viewable to anyone with link!](/files/-MIAs_bCmOYQuH5LdEgo)

After importing, your files will be converted to Samples. Check out the Samples or Labels page to view them!


# Import from AWS S3 Bucket

Import samples from an S3 bucket directly into the Universal Data Tool!

## Overview

If you have an S3 Bucket full of data to label, we'll need to do a couple of things to make that data accessible to UDT.

1. Configure the bucket so the files can be loaded
2. Create a user (or use an existing user) that can access the bucket
3. Import the data into S3

It should only take a couple minutes, let's do it!

## 1. Configure Bucket

First we need to make sure our files can be loaded from the web. To do this, we need to add a CORs policy in our Bucket Permissions. We can do this from the web on the [AWS Buckets page](https://s3.console.aws.amazon.com/s3/buckets/).

You can paste these CORs permissions in to make files web-accessible.

```
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>DELETE</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
```

![Paste the CORs configuration in here](/files/-MIB0Uwhl2KAROovr362)

After you save that, you can pick the directories you'd like to be accessible by clicking on the directory, then clicking `Actions > Make Public` If your entire bucket is public, you can skip this step.

![This will create URLs for each item in your S3 bucket.](/files/-MIAxwdABnyd2IjWtM0l)

## 2. Add IAM Credentials

Next, we need to get the keys to allow the UDT to browse for the S3 bucket files. We can do this by copying our AWS Access Key and Secret Access Key.

{% hint style="warning" %}
It's a good idea to limit the permissions of the user you're getting the access keys from, that way this key can only be used for it's intended purpose!
{% endhint %}

Navigate to the IAM service and select (or create) a user. The user must have permissions to access S3 buckets. Then click Create Access Key to create your keys!

{% hint style="danger" %}
One simple, but dangerous way to give the AWS permissions is to give the S3FullAccess permission, as show below. Fine-grained permissions are more secure!

<img src="/files/-MIAzIvAu-lNemcIorGf" alt="" data-size="original">
{% endhint %}

![Clicking Create Access Key will create the keys you need](/files/-MIB-3tZHZk-yWb1_nXi)

## 3. Add Keys to the Universal Data Tool

Navigate to [udt.dev](https://udt.dev) or open the UDT. Click "Add Authentication" and paste your keys.&#x20;

![Add Authentication Dialog](/files/-MIB0m-CJxkCCl35_4Y3)

## 4. Browse Buckets and Import

You can now create a new UDT Dataset and navigate to `Samples > Import from S3` (which will be enabled). You'll be able to select from all the buckets accessible to this user.

![You can select any buckets accessible to that user.](/files/-MIB2I5hEXhI0GCbEu0h)

![You can then import files from S3 directories.](/files/-MIB3cWVpcszPfBqtAaO)

## Bonus: Import via Uploading to S3

You can also upload to S3 directly from the UDT, after doing so, your files will automatically be added to your UDT dataset.

![Use the Upload to S3 to directly add files to UDT!](/files/-MIB46BfbFKb0ojQQ50j)


# Import from CSV or JSON

Import files from CSV or JSON

You can add samples to a dataset using a CSV or JSON file. Make sure your file is formatted in either the [UDT JSON format](/the-format-.udt-json/what-is-the-.udt.json-format) or the [UDT CSV format](/the-format-.udt-json/what-is-the-.udt.csv-format).

Navigate to `Samples > Import > Import from CSV / JSON` and upload or paste the contents of your file.

![Import from CSV / JSON button](/files/-MIDDV5LFiYk9eQKEXWf)

![Import from CSV / JSON dialog](/files/-MIDD_QBN-Yvg1BZFbRg)


# Import using AWS Cognito

Import and save samples to S3 buckets using AWS Cognito

### 1. Create a User Pool

Navigate to `Cognito` in AWS and click create Manage User Pools. Use whatever password settings are best for your organization.

![user pool](https://user-images.githubusercontent.com/1910070/82127422-5e7c4800-9781-11ea-96d3-ee12e97fbbda.png)

### 1.1 Create App Client

After creating the user pool, go to "App Clients" in the sidebar. Create an App Client, but make sure to do the following:

* Uncheck "Generate Client Secret"
* Check "Enable user password based authentication

![app client](https://user-images.githubusercontent.com/1910070/82192862-8f17cb00-98c2-11ea-8831-36166dfe78e7.png)

### 2. Create an Identity Pool

Navigate to Federated Idenitities in AWS and create an identity pool.

Create a new IAM role. Then review this role in IAM.

### 3. Create S3 Bucket

Create a bucket with public read permissions. In the "Permissions" tab, allow everyone to read and write objects to the S3 bucket.

Copy the [CORs configuration from the Amplify docs](https://docs.amplify.aws/lib/storage/getting-started/q/platform/js#using-amazon-s3)

### 4. Configure IAM Roles

Navigate to IAM panel by searching for the IAM service. You'll have a bunch of newly created Cognito roles. Use the instructions on the Amplify docs [getting started page and create an Auth and Unauth policy](https://docs.amplify.aws/lib/storage/getting-started/q/platform/js#using-amazon-s3) for your new IAM users.

Add each policy you copied with "Attach Policy" to the User Role. Make sure to replace the "example bucket name" with the name of your bucket.

Create the policy, give it a name like "UDTTestBucketRole".

### 5. Create Example User

In Cognito page click "Create User", enter the username and password. Mark the account as verified. You'll then be prompted with Complete your Sign Up.


# Import Text Snippets

Upload text data by pasting or importing a file of text snippets

You can import text snippets to quickly set up an NLP dataset.

Start by navigating to `Samples > Import > Import Text Snippets`

{% hint style="info" %}
Import Text Snippets will only appear if you have a Text Interface as your dataset's interface e.g. `Text Classification`
{% endhint %}

![Import Text Snippets Button](/files/-MIBXymwSYwCM8jHWrq5)

You can now paste in text snippets to load them as samples to your dataset.

![Paste text snippets (one per line) or drag and drop a file](/files/-MIBYdZsrbbatrLH72Ec)


# What is the .udt.json format?

The UDT JSON format is an [open-source format](https://github.com/UniversalDataTool/udt-format) for specifying human annotation tasks. For example, you might use the .udt.json format to store the labels and specification for transcribing audio or labeling images.&#x20;

{% hint style="info" %}
The UDT JSON format can be [converted to and from an equivalent CSV format](/the-format-.udt-json/what-is-the-.udt.csv-format) easily.
{% endhint %}

The basic structure of a UDT JSON file is this:

```javascript
{
    "interface": {
        "type": "<some_interface>"
        // ... more interface details
    },
    "samples": [
        { /* sample json object */ },
        // ...
    ]
}
```

Here's an example for an [image segmentation](/building-and-labeling-datasets/image-segmentation) dataset...

```javascript
{
  "interface": {
    "type": "image_segmentation",
    "labels": [
      {
        "id": "cat",
        "description": "Feline Mammal"
      },
      {
        "id": "dog",
        "description": "Canine Mammal"
      }
    ],
    "regionTypesAllowed": ["bounding-box"],
    "multipleRegions": true
  },
  "samples": [
    {
      "imageUrl": "https://media.gettyimages.com/photos/dog-and-cat-picture-id151350785"
    },
    {
      "imageUrl": "https://media.gettyimages.com/photos/guess-who-rules-the-roost-in-that-house-picture-id500927195"
    },
    {
      "imageUrl": "https://media.gettyimages.com/photos/she-simply-loves-animals-picture-id499806311"
    }
  ]
}
```

### Principles

The principles that drive the UDT format are...

* **Complete Specificity** such that no additional documents or conversations are required to perform the task.
* **Simplicity and Human Readability** so that datasets can be easily examined in the JSON format and understood
* **Specificity** such that no additional documents or conversations are required to start labeling


# What is the .udt.csv format?

The .udt.csv format is another representation of the .udt.json object that allows easier viewing and editing of data in spreadsheet software.&#x20;

![A udt.csv file has easy to understand columns!](/files/-MHs7p0X2wwpnrnN5DOG)

{% hint style="info" %}
[Check out this example .udt.csv file!](https://github.com/UniversalDataTool/udt-format/blob/master/SAMPLE.udt.csv)
{% endhint %}

{% hint style="info" %}
The UDT CSV format is capable of specifying all the same things as the UDT JSON format, but the UDT JSON format is the "canonical form" because the .udt.csv files are very flexible, and can be written in different but equivalent ways.
{% endhint %}

{% hint style="info" %}
UDT CSV files are generating by converting the JSON format into a CSV using [JSON as CSV (JAC)](https://github.com/UniversalDataTool/jac-format). They can be converted back to JSON using the [jac-format npm module](https://www.npmjs.com/package/jac-format) or [jac\_format pip module](https://pypi.org/project/jac-format/).
{% endhint %}

The UDT CSV format is really easy to use with libraries like [pandas](https://pandas.pydata.org/).


# Jupyter Notebook Integration

Use the Universal Data Tool directly within a Jupyter Notebook

## Installation

To get started, we'll need to install the [Universal Data Tool python module](https://pypi.org/project/universaldatatool/).

```bash
pip install universaldatatool
```

## Creating a Dataset

Creating datasets inside python is really easy!

```python
import universaldatatool as udt

ds = udt.Dataset(
    type="image_segmentation",
    image_paths=["/path/to/birds/good_bird.jpg","/path/to/birds/bird2.jpg"],
    labels=["good bird", "bad bird"]
)

# Opens dataset directly in jupyter notebook
ds.open()
```

![The Universal Data Tool will open inside of your Jupyter Notebook](/files/-MI0qFop7_jrQcZHIAjC)

## Loading a udt.json or udt.csv file

```python
import universaldatatool as udt

ds = udt.load("path/to/dataset.udt.json")

# Opens dataset directly in jupyter notebook
ds.open()
```


# Import Datasets into Pandas

Pandas gives you a nice way to view, filter and convert UDT datasets.

## Exporting UDT Dataset as CSV

You can export any UDT dataset into a CSV file using the download button at the top of the page.

![Download CSV from the Universal Data Tool](/files/-MI13nBG3-BxFomTGUBy)

## Import CSV Into Pandas Dataframe

We can begin by importing the pandas, and our udt.csv file.&#x20;

```python
import pandas as pd

url_or_filepath_to_csv = "https://raw.githubusercontent.com/UniversalDataTool/udt-dataset-cats-and-dogs/master/coco_dogs_and_cats.udt.csv"
udt_csv = pd.read_csv(url_or_filepath_to_csv)
```

{% hint style="info" %}
You can use the udt.json format too, tables are just a nice way to visualize the data!
{% endhint %}

If you view the udt\_csv object, you should now see a breakdown of your CSV, ready to be imported!

![coco\_dogs\_and\_cats.udt.csv](/files/-MHs7p0X2wwpnrnN5DOG)

## Downloading Images

UDT Datasets just have links to images, so we'll need to download the actual images. Check out the [fast.ai Image classification tutorial](/machine-learning/fastai/import-datasets-for-fast.ai-image-classification), where we show how to easily download images using the fast.ai download\_images function.


# Fast.ai


# Fast.ai Image Classification

Quickly import \*.udt.csv files into fast.ai for image classification.

## Example Dataset

We're going to use [udt-dataset-cats-and-dogs](https://github.com/UniversalDataTool/udt-dataset-cats-and-dogs), a dataset of labeled images of cats and dogs created from [COCO](https://cocodataset.org/). For this guide you don't need to download it directly, because we'll load it in right from our notebook.

{% hint style="info" %}
Don't like cats and dogs? You can also use any classification from the [Common Objects in Context with the Import COCO button](/importing-data/coco-images)! Maybe try to classify bears vs cats!
{% endhint %}

![coco\_dogs\_and\_cats.udt.csv](/files/-MHs7p0X2wwpnrnN5DOG)

## Import CSV Into Pandas Dataframe

We can begin by importing the fastai library, pandas, and our udt.csv file.

```python
from fastai.vision import *
import pandas as pd

url_to_csv = "https://raw.githubusercontent.com/UniversalDataTool/udt-dataset-cats-and-dogs/master/coco_dogs_and_cats.udt.csv"
udt_csv = pd.read_csv(url_to_csv)
```

{% hint style="info" %}
You can use the udt.json format too, tables are just a nice way to visualize the data!
{% endhint %}

## Download Images

UDT Datasets just have links to images, so we'll need to download the actual images. Let's do that using the [fast.ai download\_images function](https://docs.fast.ai/vision.utils#download_images).

```python
# Get the lines of our CSV that have sample data
samples = udt_csv[udt_csv["path"].str.contains("samples.")]

# Create two csvs that just have
# our cat image urls and dog image curls

dog_samples = samples[samples["annotation"] == "dog"]
cat_samples = samples[samples["annotation"] == "cat"]

dog_samples.to_csv("dog_urls.csv", columns=["imageUrl"], header=False, index=False)
cat_samples.to_csv("cat_urls.csv", columns=["imageUrl"], header=False, index=False)
```

![dog\_urls.csv](/files/-MHsA2usrUlYyKf_qWqB)

```python
# Now we can download the images!
download_images("dog_urls.csv", "images/dog" , max_pics=500)
download_images("cat_urls.csv", "images/cat" , max_pics=500)

# Let's make sure all the images are readable
verify_images("images/dog", delete=True, max_size=500)
verify_images("images/cat", delete=True, max_size=500)
```

## Create an ImageDataBunch

From here, everything should should seem pretty normal. We can create an ImageDataBunch from our `images` directory.

```python
data = ImageDataBunch.from_folder("images", train=".", valid_pct=0.2, ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)

# Let's take a look at the data
data.show_batch(rows=3, figsize=(7,8))
```

![show\_batch output](/files/-MHsAoB-zlbMSEeMQy3O)

## Train a Model

We can now train a model! This is just a simple one, don't forget to fine tune!

```python
learn = cnn_learner(data, models.resnet34, metrics=error_rate)
learn.fit_one_cycle(4)
```

![fit\_one\_cycle output](/files/-MHsB42Ekb2tBjoBTYFW)


# Fast.ai Image Segmentation

## This page isn't ready!

We're still waiting on a contributor to write this page. If you'd like to help out, click the Edit on Github button above!


# Integrate with the Javascript Library

Use the Universal Data Tool in any javascript application using a \<script /> import tage.

## Quick Start: UDT in Static HTML Page

{% embed url="<https://codesandbox.io/s/universal-data-tool-in-any-web-page-s8mh6>" %}

## Installation

Put a script tag at the top of your page importing the Universal Data Tool "vanilla" library.

{% hint style="info" %}
The vanilla library bundles all the Universal Data Tool dependencies together into a single file, making it easy to use anywhere!
{% endhint %}

```markup
<script
    type="application/javascript"
    src="https://unpkg.com/universal-data-tool@0.13.2/vanilla.js"
></script>
```

## Usage

Add a container element to your body. Then call `window.UniversalDataTool.open` to open the UDT in your element.

```markup
<body>
  <div id="udt"></div>
  <script type="application/javascript">
    window.UniversalDataTool.open({
      container: document.getElementById("udt"),

      // Your UDT dataset
      // https://github.com/UniversalDataTool/udt-format
      udt: {
        interface: {
          type: "image_classification",
          labels: ["A", "B"]
        },
        samples: [
          {
            imageUrl: "https://placekitten.com/408/287"
          }
        ]
      },

      // Called when sample is saved
      onSaveSample: (index, sample) => {
        console.log(index, sample);
      }
    });
  </script>
</body>
```


# Getting Started with React

Use the Universal Data Tool in React Applications.

## Quick Start: CodeSandbox Example

{% embed url="<https://codesandbox.io/s/universal-data-tool-react-usage-example-uerpr?fontsize=14&hidenavigation=1&theme=dark>" %}
Example Loading Image Classification Interface
{% endembed %}

## Installation

```bash
npm install universal-data-tool
```

## Usage

The `<UniversalDataViewer />` component has every interface baked in. Just provide a dataset in the `dataset` prop to view any dataset!

```javascript
import React from "react";
import UniversalSampleEditor from "universal-data-tool";

export default function App() {
  return (
    <div className="App">
      <UniversalSampleEditor
        // Read more about this format here:
        // https://github.com/UniversalDataTool/udt-format
        interface={{
          type: "image_classification",
          labels: ["cat", "dog"]
        }}
        sample={{
          imageUrl: "https://placekitten.com/408/287"
        }}
        onExit={(action: "go-to-prev" | "go-to-next" | undefined) => {
          // Called when user hits "Save", "Next", or "Prev"
        }}
        // when data is saved this is called
        onModifySample={(sampleIndex, newSampleData) => {
          // do something
        }}
      />
    </div>
  );
}
```


# Getting Started with UDT Courses

Create Training Courses for Labeling Datasets

{% embed url="<https://www.youtube.com/watch?v=2XXENmAIyzE&feature=emb_title>" %}
This video has everything you need to know!
{% endembed %}

## Creating a Course

{% hint style="warning" %}
You'll want to have a dataset before you begin! No labels are needed.
{% endhint %}

You can create UDT courses online in a couple easy steps. First navigate to [universaldatatool.com/courses](https://universaldatatool.com/courses), then click "Create a Course".

![Create a Course](/files/-MHsIcqo9UhRWea2yE82)

Now you just need to upload your dataset. You can drag and drop or select your dataset here. The samples will be used to construct tests!

![Upload the Dataset](/files/-MHsJH0Itg8Uq2hPgNFs)

You should now be inside the course editor!

## Editing a Course

Every course has an Instructor URL and a Student URL. Your Instructor URL has a secret code in it that allows you to come back, view passing students and edit the course. So don't lose it! After you create a course it should be in your address bar.

{% hint style="info" %}
Here's an example of an Instructor URL:

<https://universaldatatool.com/courses/course/8f55e988-e2ba-4411-8540-dcd5fd96592d/edit?edit_key=4eb518683bab1898e1683c8d254d201f>

And here's an example of a Student URL:

<https://universaldatatool.com/courses/course/8f55e988-e2ba-4411-8540-dcd5fd96592d>

See how the Instructor URL is longer and has an "edit\_key"?
{% endhint %}

We can now add sections, tests, exercises, quizzes and explanations to create a full training course.

### Creating a Course Item

Anytime you see this icon, you can create a new course item.

![Create a new course item](/files/-MHsM3VtgJHGoXf0Qhle)

![After clicking the Icon, you can select a new item to create](/files/-MHsM8cQt1HvIEMgYCxl)

### Markdown Descriptions

It's just markdown! Put whatever you want inside to explain the motivation of your dataset or specific details. Maybe start with a general overview, then do a deep dive in a second section.

### Question / Quizzes

Quizzes are used to make sure that your labelers read the preceding paragraph.

![A quiz quickly tests the knowledge of your labelers.](/files/-MHsKbqRTlb6rv2dSyNn)

### Tests / Exercises

**Tests and exercises are the bread and butter of a UDT course.** They make sure your labelers actually know how to label with real examples.&#x20;

#### 1. Select the samples

![Most people just pick samples randomly :shrug:](/files/-MHsMtBBDBGXKKHxM59n)

#### 2. Edit the Solution

Here you can add solutions to the dataset. **If your dataset already has labels, they'll automatically be imported.** Your labelers will be tested on these solutions!

![Label some data!](/files/-MHsN4tOQclXaZ0G9N74)

#### 3. Configure the Test

Configure your test with instructions, make it a practice exercise etc.

![](/files/-MHsNPkHfX7txpapDRSw)

## Sharing a Course with Labelers

Share your course using the "Go to Course" button at the top of the page. That will take you to a page that you can send to all of your labelers.

![](/files/-MHsSpPJpvWqgcAxJxIm)

After a student successfully completes the course, they'll be prompted to enter their email. Their email will now appear in the "Passing Students" dialog.

![View the passing students](/files/-MHsTF3S1Y_AZzNgcQCU)

## Running On-Premise

Check out the [github repository for on-premise instructions](https://github.com/UniversalDataTool/courseware)!


# Frequently Asked Questions

FAQ for the Universal Data Tool

## Why are fractional coordinates used instead of pixel coordinates in the Universal Data Tool?

Pixel coordinates can often be helpful for drawing or extraction part of an image. However, fractional coordinates, meaning coordinates in the range `[0,1]` are used for representing the location on an image in the UDT for the following reasons:

* It is resilient to image resizing/changes to size in the underlying image source
* Most images are rescaled prior to being put into a machine learning model, at which point a pixel coordinate transformation would be necessary and cumbersome
* It better supports "massive" image scenarios, such as maps or microscopic slides, that have variable pixel accuracy

If you need to convert UDT fractional coordinates into pixel coordinates, you can do it quickly with[ udt-to-image-position](https://github.com/UniversalDataTool/udt-to-image-position).


