# Build Visual AI models
URL: https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html

> Building Visual AI models, as with any DataRobot project, starts with preparing and uploading data.

# Build Visual AI models

As with any DataRobot project, building Visual AI models involves preparing and uploading data:

1. Preparing the dataset , with or without additional features types.
2. Creating projects from the AI Catalog or via local file upload.
3. Reviewing the data before building .

Once you have [built models](https://docs.datarobot.com/en/docs/classic-ui/modeling/build-models/build-basic/model-data.html) as you would with any DataRobot project, you can:

1. Review the data after building .
2. Evaluate and fine-tune models.
3. Make predictions .

> [!NOTE] Note
> Train-time image augmentation is a processing step that randomly transforms existing images, augmenting the training data. You can configure augmentation both [before and after](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/tti-augment/ttia-introduction.html) model building.

See [additional considerations](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html#feature-considerations) and [file size limits](https://docs.datarobot.com/en/docs/reference/data-ref/file-types.html#general-requirements) for working with Visual AI.

## Prepare the dataset

When creating projects with Visual AI, you can provide data to DataRobot in a ZIP archive. There are two mechanisms for identifying image locations within the archive:

1. Using a CSV file that contains paths to images (works for all project types).
2. Using one folder for each image class and file-system folder names as image labels (works for a single-image feature classification dataset).

> [!NOTE] Note
> Additionally, you can encode image data and provide the encoded strings as a column in the CSV dataset. Use base64 format to encode images before registering the data in DataRobot. (Any other encoding format or encoding error will result in model errors.) See [this tutorial](https://docs.datarobot.com/en/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html) for access to a script for converting images and for information on how to make predictions on Visual AI projects with API calls.

Before beginning, verify that images meet the [size and format](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html#dataset-guidelines) guidelines. Once created, you can [share and preview](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html#create-projects-from-the-ai-catalog) the dataset in the AI Catalog.

### Dataset guidelines

The following table describes image requirements:

| Support | Type |
| --- | --- |
| File types | .jpeg*, .jpg*, .png, .bmp, .ppm, .gif, .mpo, and .tiff/.tif |
| Bit support | 8-bit, 16-bit** |
| Pixel size | Images up to 2160x2160 pixels are accepted and are downsized to 224x224 pixels.Images smaller than 224x224 are upsampled using Lanczos resampling. |

Additionally:

- Visual AI class limit is the same as non-Visual AI ( 1000 classes ).
- Image subfolders must not be zipped (that is, no nested archives in the dataset's main ZIP archive).
- Any image paths referenced in the CSV must be included in the uploaded archive—they cannot be a remote URL.
- File and folder names cannot contain whitespaces.
- Use / (not \ ) for file paths.

### Paths for image uploads

Use a CSV for any type of project (regression or classification), both a straight class-and-image and when you want to add features to your dataset. With this method, you provide images in the same directory as the CSV in one of the following ways:

- Create a single folder with all images.
- Separate images into folders.
- Include the images, outside of folders, alongside the CSV.

To set up the CSV file:

1. Create a CSV in the same directory as the images with, at a minimum, the following columns:
2. Include any additional features.

If you have multiple images for a row, you can create an individual column in the dataset for each. If your images are categorized for example the front, back, left, and right of a healthy tomato plant, best practice suggests creating one column for each category (one column for front images, one for back images, one for left images, and one for right). If there is not an image in each row of an added column, DataRobot treats it as a missing value.

Create a ZIP archive of the directory and drag-and-drop it into DataRobot to start a project or add it to the [AI Catalog](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html#create-projects-from-the-ai-catalog).

### Folder-based image datasets

When adding only images, prepare your data by creating a folder for each class and putting images into the corresponding folders. For example, the classic "is it a hot dog?" classification would look like this, with a folder containing images of hot dogs and a folder of images that are not hot dogs:

Once image collection is complete, ZIP the folders into a single archive and upload the archive directly into DataRobot as a local upload or add it to the [AI Catalog](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-model.html#create-projects-from-the-ai-catalog).

## Create projects from the AI Catalog

It is common to access and share image archives from the [AI Catalog](https://docs.datarobot.com/en/docs/classic-ui/data/ai-catalog/catalog.html), where all tabs and catalog functionality are the same for image and non-image projects. The AI Catalog helps to get a sense of image features and check whether everything appears as expected before you begin model building.

To add an archive to the catalog:

1. Use theLocal Fileoption to upload the archive. When the dataset has finished registering, a banner indicates that publishing is complete.
2. Select theProfiletab to see a sample for each image class.
3. Click on a sample image to display unique and missing value statistics for the image class.
4. Click thePreview Imageslink to display 30 randomly selected images from the dataset.
5. ClickCreate projectto kick offEDA1(formaterializeddatasets).

Next, review your data before building models.

## Review data before building

After EDA1 completes, whether initiated from the AI Catalog or drag-and-drop, DataRobot runs data quality checks, identifies column types, and provides a preview of images for sampling. Confirm on the Data page that DataRobot processed dataset features as `class` and `image`:

After previewing images and data quality, as described below, you can build models using the regular workflow, identifying `class` as the target.

### Data quality checks

Visual AI uses the Data Quality Assessment tool, with specific checks in place for images. After EDA1 completes, access the results from the Data page:

If images are missing, a dedicated section reports the percent missing as well as provides access to a log that provides more detail. "Missing" images include those with bad or unresolved paths (file names that don't exist in the archive) or an empty cell in the column expecting an image path. Click Preview log to open a modal showing per-image detail.

### Data page checks

From the Data page do the following to ensure that image files are in order:

1. Confirm that DataRobot has identified images as Var Type image .
2. Expand theimagerow in the data table to open the image preview, a random sample of 30 images from the dataset (the full dataset will be used for training). The preview confirms that the images were processed by DataRobot and also allows you to confirm that it is the image set you intended to use.
3. ClickView Raw Datato open a modal displaying up to a 1MB random sample of the raw data DataRobot will be using to build models, both images and corresponding class.

## Review data after building

After you have built a project using the [standard workflow](https://docs.datarobot.com/en/docs/classic-ui/modeling/build-models/build-basic/model-data.html), DataRobot provides additional information from the Data page.

Expand the `image` feature and click Image Preview. This visualization initially displays one sample for each class in your dataset. Click a class to display more samples for that class:

Click the Duplicates link to view whether DataRobot detected any duplicate images in your dataset. Duplicates are reported for:

- the same filename in more than one row of the dataset
- two images with different names but, as determined by DataRobot, exactly the same content

## Predictions

Use the same prediction tools with Visual AI as with any other DataRobot project. That is, select a model and make predictions using either [Make Predictions](https://docs.datarobot.com/en/docs/classic-ui/modeling/analyze-models/predictions/predict.html) or [Deploy](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/deploy-methods/deploy-model.html). The requirements for the prediction dataset are the same as those for the modeling set.

Refer to the section on [image predictions](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/visual-ai/vai-predictions.html) for more details.

## Feature considerations

- For Prediction Explanations, there is a limit of 10,000 images per prediction dataset. Because DataRobot does not run EDA on prediction datasets, it estimates the number of images asnumber of rowsxnumber of image columns. As a result, missing values will count toward the image limit.
- Image Explanations, or Prediction Explanations for images, are not available from a deployment (for example, Batch predictions or the Predictions API).
- There is no drift tracking for image features.
- Although Scoring Code export is not supported, you can use Portable Prediction Servers.
- Object detection is not available.
- Visual AI does not support time series. Time-awareOTVprojects are supported.

---
