Model inference and automatic export¶
Supported inference architectures¶
Model inference supports all four modern tasks plus classic detection and classification. Use the anomaly page's own inference view for anomaly detection.
| Architecture | Input weights | What else is needed |
|---|---|---|
| Modern models | .pt or .onnx |
Matching task type; especially important for ONNX |
| Classic detection/classification | .pdparams |
Matching training YAML; it can be imported from an experiment |
| The anomaly detection page itself | model.patchcore.pt |
Image source, device and threshold multiplier on that page |
Importing a classic training experiment prioritizes the valid final configuration snapshot and actual checkpoint; a pretrained URL in YAML is not treated as a trained model. A class TXT can be specified if needed. Incompatible classic weight shapes cause an error rather than silently using random parameters.
Task type, threshold and device¶
Modern tasks include classification, object detection, instance segmentation and oriented object detection. For classic architectures, the selected architecture fixes the task type.
The confidence field defaults to 0.3 and accepts 0.01–1.0. Detection inference retains results at or above the threshold; classic classification returns at most the top 5 classes meeting it. Native modern classification result handling does not filter class probabilities using this conf control; it is not an OK/NG decision rule for modern classification.
Modern PT follows the device selection. The current software forces modern ONNX inference to CPU, reporting this in the log even if GPU is selected; ONNX GPU inference is not guaranteed. Classic inference can use CPU or one selected NVIDIA GPU.
Preprocessing¶
Modern classification PT/ONNX models generated by the software embed center-crop preprocessing metadata, which software inference reads. External ONNX runtimes do not automatically apply preprocessing merely because a JSON file is nearby; deployment must implement it correctly.
Classic classification reads the configured Infer preprocessing and class mapping; classic detection uses the matching TestReader. External weights without their training configuration cannot recover correct preprocessing from the file extension alone.
Output directory¶
Without an explicit output directory, the modern model task determines the default location. An explicitly selected directory is used directly and can be reused; results with identical names may be overwritten.
Classic and anomaly inference create independent experiment directories beneath the output root, saving visualizations and structured results. The completion log provides the actual output path.
Automatic training export¶
| Training architecture | Export after success |
|---|---|
| Four modern architectures | ONNX; detection/segmentation/OBB also export infer_cfg.yml, while classification exports Label.txt and preprocessing information. |
| Classic detection | model.pdmodel, model.pdiparams, parameter information and infer_cfg.yml |
| Classic classification | Inference model, parameters, ImageSize.txt, deployment YAML and class list |
| Anomaly detection | Self-contained model.patchcore.pt; use the anomaly inference workflow |
Modern ONNX export does not simplify the graph by default or automatically install onnxslim; OBB does not embed NMS. Classic export uses CPU within this run's independent process, even if training used GPU. The UI may continue to show Exporting after training finishes; wait for a confirmed export result before deployment.
Training completion does not guarantee export completion. A failed classic export retains trained weights and the full experiment; inspect export.json and the raw log. Do not delete the entire experiment to retry export.