Three trained Cuvis.AI pipelines for hyperspectral foreign-object detection on a lentil conveyor. All three share one architecture (a frozen DINOv2 backbone, a Dinomaly anomaly head and a two-stage gate-then-quantile binary decider) and differ only in the three-channel projection the backbone sees: a visible RGB selection, a colour-infrared selection, and a learned selection at 542, 902 and 886 nm. The companion dataset holds the recording and the annotations the tutorial notebook uses.
Foreign objects among lentils on a conveyor: stems, stones, aluminium shards, blue and white paper, flies and
rubber in the demo recording. The detector was trained on normal product only and scores every pixel by how far
its DINOv2 features lie from what it has seen, so it has no class list. The decider gates the frame on the mean
of the top 0.1 % pixel scores (image_threshold) and, on an alarmed frame, marks the pixels above the per-frame
quantile (0.995). The output is a semantic anomaly mask, not object instances.
| Folder | Model | Frame gate | Pixel threshold | When to use |
|---|---|---|---|---|
dinomaly_rgb_full_pipeline/ |
Visible RGB baseline | 0.14 | 0.995 | foreign objects that differ from the bulk product in visible colour |
dinomaly_cir_full_pipeline/ |
Colour-infrared selection | 0.14 | 0.995 | foreign objects that separate from the bulk in the near infrared (moisture, surface scattering) and not in visible colour |
dinomaly_custom_selector_full_pipeline/ |
Learned band selection | 0.151 | 0.995 | the lentils product line, where this selection found the most foreign objects on the full dataset |
Each folder holds the pipeline yaml, its fitted weights (.pt, same stem) and a README with the knobs and a quick start. The frame gate and the pixel threshold are the values tuned on the recordings this card describes: set them for your own product before use (the calibration section and the per-pipeline READMEs say how).
plugins/ (copy them into a configs/plugins/ folder next to your pipelines, or point --plugins-dir at plugins/):dinomaly: https://github.com/cubert-hyperspectral/cuvis-ai-dinomaly.git at tag v0.8.0cuvis-ai-dataloader[cu3s] with the Cuvis SDK to read the .cu3s recording of the companion dataset.With the registry (one command per pipeline, all files pinned and sha256-checked):
uv run download-model download dinomaly_lentils_rgb
Then run it on a recording from the snapshot folder the command prints:
cd <snapshot folder>
uv run restore-pipeline --pipeline-path dinomaly_rgb_full_pipeline/dinomaly_rgb.yaml \
--weights-path dinomaly_rgb_full_pipeline/dinomaly_rgb.pt --plugins-dir plugins \
--data-module cu3s --data-arg cu3s_file_path=<recording>.cu3s --data-arg processing_mode=Reflectance
Without Cuvis.AI's registry: python fetch.py in a checkout of this repo downloads every file listed in manifest.json and verifies it; hf download cubert-gmbh/XMR_Demo_Industrial_Foreign_Object_Detection_Lentils --local-dir ./XMR_Demo_Industrial_Foreign_Object_Detection_Lentils does the same without the check.
In CuvisNEXT: pipeline = the yaml, weights = the .pt with the same name, started from the snapshot folder so relative paths resolve.
Two knobs in the decider node: image_threshold, the frame gate on the mean of the top 0.1 % per-pixel anomaly
scores (0.140 for the RGB and the CIR pipelines, 0.151 for the custom selector), and quantile, the per-frame
pixel threshold of an alarmed frame (0.995 for all three). They were tuned on a held-out split by pixel F1 for the
demo recording. On another line, run the pipeline on normal product, read the frame scores, set image_threshold
above the highest normal frame and keep the quantile.
Recorded on the product line and conveyor rig described on the companion dataset card (cubert-gmbh/XMR_Demo_Industrial_Foreign_Object_Detection_Lentils): Ultris XMR, 50 mm lens, video mode, 15 ms integration time, 4 fps, white and dark references recorded. The published recording of the companion dataset is one held-out evaluation session; the training sequences are multi-file conveyor recordings of the same product under controlled belt lighting. The full dataset with three acquisition days and baked splits is cubert-gmbh/XMR_Industrial_Foreign_Object_Detection_Lentils.
Backbone: DINOv2 ViT-B/14 with four register tokens (dinov2reg_vit_base_14), frozen. Head: the Dinomaly anomaly
head of anomalib 2.1.0, image size 448, decoder depth 8, bottleneck dropout 0.2, trained for 50 epochs with the
standard Dinomaly schedule (weight 1.0 on the train-loss bridge). Decider: TwoStageBinaryDecider tuned on a
held-out NPZ split by pixel F1; the exact values are in each yaml. The custom selector's wavelengths (542, 902 and
886 nm) are the frozen band choice of an AdaCLIP channel-selection study on the full lentils dataset. Trained
with Cuvis.AI and the cuvis-ai-dinomaly plugin; the graph keeps the training-loss bridge and the metrics node,
which are skipped at inference.
The three pipelines are compared side by side on the demo recording in the tutorial notebook of the cuvis-ai
repository (https://github.com/cubert-hyperspectral/cuvis-ai/blob/main/notebooks/use_cases/lentils_dinomaly.ipynb).
The whitepaper in the full dataset
repository (cubert-gmbh/XMR_Industrial_Foreign_Object_Detection_Lentils, whitepaper/) reports the method
comparison on the full dataset, where the learned band selection finds more foreign objects than the visible RGB
and the colour-infrared projections across the detectors compared there.
image_threshold.The fitted states, fine-tuned weights and pipeline yamls in this repository are released under the Apache-2.0 license (LICENSE). The third-party models they build on are credited in NOTICE.md with their licenses.
Trained and packaged by the AI team at Cubert GmbH: cuvis.ai@cubert-gmbh.de. For pilots on your own product line, reach out by email or through https://www.cubert-hyperspectral.com.
dinomaly_custom_selector_full_pipeline/dinomaly_custom.pt 592 MBdinomaly_cir_full_pipeline/dinomaly_cir.pt 592 MBdinomaly_rgb_full_pipeline/dinomaly_rgb.pt 592 MB