share-nodesExport AI Model

Converting trained models to ONNX format and generating PDF reports for deployment

The Export screen converts a trained PyTorch checkpoint into an ONNX model file optimized for inference on Csmart Digit Desktop. It also generates a JSON model descriptor that tells Digit Desktop how to configure preprocessing, class labels, and inference parameters. Additionally, you can generate a PDF report summarizing the model's training and test performance.

Prerequisites

  • An open project with at least one completed training session.

  • Ideally, a completed test session (for including metrics in the PDF report).

  • An optional reference model (a previously deployed ONNX model whose class configuration you want to carry forward).

Step-by-Step Walkthrough

1. Select the Checkpoint

You have two options:

Use Last Trained (toggle ON): The application automatically resolves the most recent checkpoint from the latest version_XX folder. This is the quickest path when you want to export your latest work.

Manual Selection (toggle OFF): Click Select to browse for a specific .ckpt file. Use this when you want to export a checkpoint from an earlier training session.

After selecting a checkpoint, the center panel populates with a summary of its hyperparameters (architecture, learning rate, training mode, etc.) and any associated test results.

2. Set the Export Directory

Click Select to choose where the ONNX model and associated files will be saved. The default is your project's Models/ folder.

3. Configure a Reference Model (Optional)

If you are replacing an existing model in production, you can select a reference model to carry forward its class configuration and custom settings:

  1. Click Select next to the reference model field.

  2. Choose the .onnx file of the model currently deployed on Digit Desktop.

  3. The application loads the reference model's JSON descriptor and compares its classes with the new model.

circle-exclamation

When a reference model is set, the export process automatically merges configuration fields from the reference into the new model's JSON descriptor. This includes custom fields such as hue colormaps, subset definitions, descriptive rules, and the original class mapping.

Click Clear to remove the reference model if you do not need to carry forward any configuration.

4. Add Metadata

Issued Date — Enter the release date in mm-yyyy format. This date is embedded in the model descriptor and PDF report.

Comments — Add notes about this model version (e.g., dataset changes, training decisions, intended use). These are saved per checkpoint in the project metadata.

Click Save if you modify these fields. A confirmation dialog appears if you navigate away with unsaved changes.

5. Export the Model

Click Export Model to begin. The application:

  1. Launches the Python export script with Hydra configuration.

  2. Loads the checkpoint and converts it to ONNX format.

  3. Generates the JSON model descriptor with class labels, preprocessing config, and metadata.

  4. Copies the feature_extraction.npz file (if available) alongside the ONNX model and computes a SHA-256 checksum.

  5. If a reference model is set, merges its configuration into the exported JSON.

Progress is streamed to the log monitor.

Export Output

After a successful export, the output folder contains:

File
Description

model_YYYYMMDD_HHMMSS.onnx

The ONNX model file for Digit Desktop

model_YYYYMMDD_HHMMSS.json

Model descriptor with classes, preprocessing, and metadata

feature_extraction.npz

Feature embeddings for similarity analysis (optional)

The ONNX file and its companion JSON are the two files you deploy to Csmart Digit Desktop.

6. Generate a PDF Report (Optional)

Click Generate Report to create a PDF document summarizing the model. The report includes:

  • Model architecture and hyperparameters

  • Training configuration and duration

  • Test metrics (accuracy, precision, recall, F1)

  • Confusion matrix and ROC curves

  • Export metadata and comments

The PDF opens automatically in your default viewer when generation completes.

circle-info

The report requires at least one completed test session for the selected checkpoint. If no test results are available, the report will contain training information only.

Stopping an Operation

Both export and report generation can be cancelled by clicking Cancel. Each operation is tracked independently — you can export a model and then generate a report without them interfering.

Configuration Persistence

The export directory and reference model path are stored in config.yaml under the export section. The issued date and comments are stored per checkpoint in project.yaml.

Troubleshooting

Issue
Possible Cause
Solution

Export fails immediately

Python runtime not installed

Install the runtime from Hardware Settings

Class mismatch warning with reference model

New model has different classes than the reference

Review the comparison modal; this may be intentional if you added or removed classes

PDF report is incomplete

No test session exists for this checkpoint

Run a test session first from the Test screen

ONNX file is very large

Large architecture (ViT Large, Fused Network)

This is expected; heavy models produce larger files

Export completes but Digit Desktop rejects the model

JSON descriptor missing required fields

Ensure a reference model is set so that custom configuration fields are carried forward

Deployment

After exporting:

  1. Copy the .onnx and .json files to the Csmart Digit Desktop machine.

  2. In Digit Desktop, configure the model path in the application settings.

  3. Run a test analysis to verify the model performs correctly on live data.

circle-info

For details on the full deployment pipeline and how models are loaded in production, see the System Architecture section:

Last updated