tagsPre-Classification

Using an existing AI model to automatically classify images before manual review

The Pre-Classification screen allows you to automatically classify images in a dataset folder using an existing AI model. This is useful when you have a large set of unlabeled or partially labeled images and want to leverage a previously trained model to sort them into classes before manual review.

Pre-classification does not modify your original images. It organizes copies or references into class subfolders based on the model's predictions, giving you a starting point that you can then review and correct manually.

Prerequisites

Before running pre-classification, you need:

  • An open project with a dataset that has been split (or at least organized into class folders).

  • An AI model file — either an .onnx model (exported from Studio Desktop or Digit Desktop) or a .ckpt checkpoint (from a previous training session).

Step-by-Step Walkthrough

1. Select the Class Folder

Click Select next to the first field to choose the folder containing the images you want to classify. This should be a class folder (a single category), not the root dataset folder.

circle-exclamation

After selecting the folder, the application displays the number of detected images (e.g., "Detected 1,247 images"). If no images are found, verify that the folder contains files in a supported format (.jpg, .jpeg, .png, .bmp, .tiff, .webp).

2. Select the AI Model

Click Select next to the model field to choose the model file that will perform the classification.

Two model types are supported:

Model Type
Extension
Description

ONNX

.onnx

Exported production model — faster inference, recommended

Checkpoint

.ckpt

Training checkpoint — uses the full PyTorch model

circle-info

If you have previously exported a model from Studio Desktop, the ONNX file is located in your project's Models/ folder. Checkpoints are in the Checkpoints/version_XX/ folders.

The application validates that the selected file exists and has a supported extension. If the file is invalid, an error message appears.

3. Run Classification

Once both a folder and a model are selected, the Run Classification button becomes active. Click it to start the process.

The application:

  1. Determines the model type (ONNX or checkpoint) and launches the appropriate Python classification script.

  2. Loads the model into memory (using GPU if available, falling back to CPU).

  3. Iterates through all images in the selected folder.

  4. Assigns each image a predicted class based on the model's output.

  5. Organizes images into class subfolders.

Progress is streamed to the log monitor on the right panel in real time.

Status Indicators

The status line below the buttons reflects the current state:

Status
Meaning

Idle

No classification in progress

Running classification...

The model is actively processing images

Classification completed successfully

All images have been classified

Error during classification

The process encountered a problem (check the error box and logs)

Classification cancelled

You stopped the process manually

An indeterminate progress bar appears during the operation. If an error occurs, a red error box displays the details below the progress bar.

Stopping a Classification

Click Stop at any time to cancel the operation. The Python process receives a termination signal and shuts down gracefully. Any images already classified up to that point are preserved.

circle-info

The sidebar is locked during classification to prevent accidental navigation. It unlocks when the process completes or is cancelled.

After Classification

When classification completes successfully, the application opens the result folder in your system's file explorer. You can then:

  1. Review the results — Browse the class subfolders to verify predictions.

  2. Correct misclassifications — Move incorrectly classified images to the correct class folder.

  3. Proceed to training — Use the refined dataset as input for a new training session.

circle-info

Pre-classification is particularly valuable in iterative workflows. For example, you can train an initial model on a small manually labeled set, use pre-classification to label a larger batch, correct the errors, and then retrain on the expanded dataset for improved accuracy.

Configuration Persistence

The selected class folder path and model path are saved in the project's config.yaml. When you return to this screen, the application restores your previous selections and validates that the paths still exist. If a previously selected model file has been moved or deleted, the field is cleared automatically.

Troubleshooting

Issue
Possible Cause
Solution

"Run Classification" button is disabled

Folder or model path is empty

Ensure both fields are filled with valid paths

"No images detected" after selecting folder

Folder contains no supported image files

Check that the folder has .jpg, .jpeg, .png, .bmp, .tiff, or .webp files

Error: invalid file type

Selected a file that is not .onnx or .ckpt

Choose a supported model file

Classification fails immediately

Python runtime is not installed

Go to Hardware Settings and install the runtime

GPU out of memory error

Model or batch size exceeds GPU VRAM

Try using a smaller model, or the process will fall back to CPU

Last updated