Skip to content

Experiments ​

Every experiment that informs a decision, newest first. Each entry says what it asked, how it was run (setup, data, GPU, seeds, command), what came out, and which decision of Design it settles or changes. Numbers are on validation unless written otherwise; a test split is evaluated once at the end and never used for a decision.

Template:

## YYYY-MM-DD · short title

Question: what this has to decide.
Setup: datasets, GPU, seeds, command.
Result: table.
Conclusion: what it decides (DESIGN.md decision N), and what it does not show.

2026-11-16 · lt starts over when it still answers one class; the export checks off by default ​

Question: 0.1.1's probe start removed lt's stall at the majority class, but the public benchmark's lt rerun (v1.1, reported only) fell on CLEVR count from 79.1 to 32.5 test macro-F1 (VisA rose from 82.4 to 93.5). What start keeps the cure without that cost? Separately: why did a platform training of lt fail after its training was done?

Diagnosis of the probe start (curves of the v1.1 runs, train and val only):

  • On every other public dataset the probe start lifts epoch 1's val macro-F1 (to 0.72-1.00, from 0.05-0.70). On CLEVR the probe is perfect on its 300 training images, and after the first epoch val is worse than chance (val loss 3.09, chance 2.08). Fine-tuning from it fits the training images further (train loss 0.54-0.69 at epoch 49, against 0.65-1.09 without it) while val stays near 0.3: it memorizes instead of learning to count.
  • 384 features separate a few hundred images whatever their labels, so the probe's training accuracy (0.99-1.00 on every dataset) tells nothing.
  • timm builds the ViT's new head with head_init_scale 0.001: weights of std 2e-5, against 1.3e-2 for m's head, so the backbone gets almost no gradient until the head has grown. (2026-11-12 ruled the init out with head-only runs on frozen features, which cannot show this.)

Setup: the 2026-11-12 testbed (stall tasks B1, B3, B2 x 5 data draws; control A3 x 3 seeds), its A0 and P runs reused, plus a counting task made for this, nothing from the public benchmark: synthetic scenes of 3 to 10 shaded spheres, cubes and cylinders on a floor, 480 x 320, 8 classes (the count), 300 train / 100 val, 5 seeds. It separates the starts as CLEVR does: A0 0.99 / 0.90 / 0.99 / 0.99 / 0.99, P 0.36-0.44. lt at 448 px, the recipe otherwise unchanged, RTX 4090. A rule fixed before the runs, for each new arm: at most 1 of the 15 stall runs stuck; stall mean best val macro-F1 >= P - 0.03; counting >= A0 - 0.03; control >= A0 - 0.02; every run present.

Arms, in the order they ran (each one written down before its runs):

  • N, N3, N5: timm's head without the 0.001, a fresh normal head of std 0.02, 0.05, 0.1.
  • S: P's probe with its logits scaled by 0.1 towards the class prior (its direction without its confidence).
  • R: timm's head; at the first validation after the warmup, if val macro-F1 is within 0.02 of the single-class score, the head is replaced in place by S's.
  • RS: as R, but the run starts over from the pretrained weights with S's head (the code of 0.1.2). Emulated first from the A0 and S runs; this row is the real code.
  • Rejected before any run: keeping the probe only if its validation beats probes fitted to shuffled labels. On frozen features it kept the probe on counting (val loss 1.59 against 2.41 at best shuffled), where P fails anyway, and rejected it on B1, where P cures the stall.

Result (val macro-F1; VE: the first epoch above the single-class score + 0.02):

armstuck (of 15)median VEstall mean bestrelapsesstall median NLLcontrol mean bestcounting mean bestpasses
A0 (0.1.0)10never0.58900.3020.9170.972-
P (0.1.1)020.86280.1770.8770.395-
N (0.02)5250.72000.2300.8360.945no
N3 (0.05)3180.73300.2330.9210.839no
N5 (0.1)0100.83900.1520.8920.746no
S050.88100.1470.9160.664no
R9never0.60010.3000.8630.969no
RS (0.1.2)0110.88700.1360.9050.982yes
  • Every start that cures the stall from the first step costs on counting, the more the stronger the head starts (N, N3, N5; S; P). The two kinds of task want opposite starts.
  • What tells them apart is visible at the end of the warmup: the 15 stall runs all still answered one class at epoch 5, no counting run did (val macro-F1 0.13-0.46 by then; the single-class score + 0.02 is 0.05). RS started over in those 15 and in 1 of the 3 control runs, and in no counting run, which therefore trains as A0.
  • Replacing the head in place at that point (R) leaves 9 of 15 stuck; starting over, with the warmup run again, leaves none. RS's median VE counts the 5 epochs of the first attempt.
  • With a time budget, as the platform trains (240 s, at most 500 epochs, 2 seeds each): the counting runs did not start over (best val 0.980 and 0.929), the B1 runs did and left the stall (0.794 and 0.770).

Guards of RS against A0, those of 2026-11-12 with A0's runs reused (lt at 448 px; sets 1-2 by 5-fold out-of-fold test predictions, 3 seeds; the development suite at 224 px, test macro-F1, 3 seeds). No guard run started over, so RS trained them as A0 does:

guardA0RS
set 1: OOF macro-F1 / AUC of P(NOK)97.7 / 99.197.3 / 99.2
set 1: OK images rejected to catch every NOK59 %63 %
set 2: OOF macro-F1 / AUC96.9 / 99.196.8 / 98.9
set 2: OK images rejected to catch every NOK58 %60 %
development suite, mean test macro-F187.887.8 (every run identical)
median val NLL at the best epoch0.0820.082
float16 TensorRT on 16 set-1 images: same class, largest probability difference16/16, 0.000316/16, 0.0003
  • Every guard passed but run time: RS's median 126 s against 89 s for A0's runs of four days earlier, with other users' jobs on the machine now (load average 9-14). The same development run alternated between the two codes gave 69, 81 and 77 s for A0 and 81, 82 and 96 s for RS, with identical results; a run that does not start over computes nothing more than one comparison per epoch.
  • m trained with the new code is identical to the old, number for number.

A platform training of lt at 1024 x 2048 on a T4 (0.1.1) ended in an out-of-memory failure after its only epoch:

  • The probe start read 1044 images in float32 at 1.5 images/s, 11.4 of the 16.5 minutes the time budget left. One epoch then took 12.6 minutes. 0.1.2 reads the probe's images in the precision training uses and at most 10 % of the time left, and only in a run that starts over.
  • Then the export's float16 check. It runs the ONNX model once with every internal tensor as an output: measured on a 288 x 576 export and scaled by each tensor's token dimensions, 1.35 GB at 448 x 448 but 46.5 GB at 1024 x 2048, 36 GB of it the 24 attention maps of 8197 x 8197 tokens. The machine had 52 GB.

Conclusion (DESIGN.md decision 6, As built, and 14):

  • RS becomes lt's head start (RECIPE head_start 'restart'); the CNN sizes keep timm's head.
  • It removes the stall as P did (0 of 15 stuck) with a higher stall score, no relapse and better-calibrated probabilities, and leaves counting where A0 had it.
  • A run that starts over pays its warmup twice: 5 of 100 epochs here, 5 % of a time budget.
  • Both export checks are off by default, as in RP-OD; export(check=True) runs them.
  • Not shown: the public benchmark with 0.1.2, to be run and reported as is.

2026-11-12 · lt's new head starts as a linear probe ​

Question: why does lt sometimes stay at the majority class (5 of 36 VisA runs of the public benchmark v1, never m), and what removes it without costing where lt already learns?

Diagnosis (curves of every v1 run and head-only simulations on frozen features, CPU):

  • In those runs the train loss sits from epoch 3 at exactly the loss of predicting the class prior with label smoothing (0.388 for 91 / 9). The model outputs a constant; it is not overfitting.
  • The features are not the problem: a linear probe on lt's frozen features of macaroni1 reaches val macro-F1 0.93.
  • lt's new head learns about ten times slower than m's. Its input, the mean of 784 LayerNorm'd patch tokens, is 14-17 times smaller in L1 than HGNetv2's pooled feature, and AdamW moves each weight by about the learning rate per step, so a logit moves by about lr times that L1 size. The head learns the prior inside the warmup and then separates the classes by about 0.01 per epoch, against 0.1 for m.
  • Ruled out: label smoothing, timm's 0.001 head init, EMA, bfloat16, clipping, CLS against mean pooling.

Setup: a development testbed at 9 % NOK, 273 OK + 27 NOK train and 91 + 9 val per task, no test split, nothing from the public benchmark:

  • A1-A3: 9 % cuts of real images (set 1, set 3, PCam);
  • B1-B5: composites where the defect is small, grids of set-1 or set-2 parts with one NOK part (3x3, 2x2) and Kather mucosa mosaics with one tumour tile (6x6, 3x3).

lt at 448 px, the recipe otherwise unchanged, RTX 4090.

  • Pilot: lt seeds 0-2 and m seed 0 on each task. The 3 most stall-like tasks (B1, B3, B2) and a control where lt learns (A3) were picked by a rule fixed before the runs.
  • A/B, paired by task and seed, 5 seeds on the stall tasks and 3 on the control:
    • A0, the recipe;
    • H15 / H30, the head's learning rate x15 / x30;
    • P, the head fitted as a linear probe on the frozen features of the clean training images before the first step: label-smoothed multinomial logistic regression, L2 0.03 on centred and RMS-scaled features, L-BFGS, folded back into timm's head.
  • Val escape (VE): the first epoch whose val macro-F1 beats the single-class score by 0.02. Stuck: never.

Result, A/B on the stall tasks (15 runs per arm) and on the control (3):

armstuckVE > 8median VEmean best val F1Wilcoxon p (VE earlier than A0)control: median VE, mean best val F1
A01015never0.589-5, 0.917
H15112170.8050.00013, 0.840
H301780.8170.00013, 0.879
P0320.8620.00001, 0.877

No arm passed every criterion fixed before the runs:

  • P failed "at most 1 run with VE > 8" (it had 3).
  • It failed "no more relapses than A0" (8 against 0). The comparison is lopsided: A0 seldom left the prior, so it seldom could fall back.
  • It failed "control within 2 points" (0.877 against 0.917, 3 seeds, 9 NOK in val).

The guards of P against A0 ran anyway, the same batch and code (lt at 448 px; sets 1-2 by 5-fold out-of-fold test predictions, 3 seeds; the development suite at 224 px, test macro-F1, 3 seeds):

guardA0P
set 1: OOF macro-F1 / AUC of P(NOK)97.7 / 99.198.0 / 99.8
set 1: OK images rejected to catch every NOK59 %25 %
set 2: OOF macro-F1 / AUC96.9 / 99.195.8 / 98.5
set 2: OK images rejected to catch every NOK58 %79 %
development suite, mean test macro-F187.888.1
flowers / jiawood / kather2016 / pcam92.6 / 85.8 / 87.8 / 85.193.9 / 87.2 / 86.4 / 85.1
median val NLL at the best epoch0.0820.125
median run time89 s83 s
float16 TensorRT on 16 set-1 images: same class, largest probability difference16/16, 0.000316/16, 0.002

m trained with the new code is identical to the old, number for number (results.csv, every column but the timings).

Conclusion (DESIGN.md decision 6, As built):

  • P becomes lt's head start, the user's choice with these numbers in hand.
  • It removes the stall, 10 of 15 stuck development runs to 0, and on the guards it averages what A0 does: set 1 and the development suite gain a little, set 2 loses 1.1 points of macro-F1 and 0.6 of AUC, and kather2016 1.4.
  • Its best epochs have a higher val NLL, so its probabilities are less calibrated.
  • A model that calls everything OK fails silently, which is worse than a point on one set.
  • Not shown: the effect on the public benchmark. Its lt rerun (v1.1) is still to be run and will be reported as is.
  • Head lr x15 / x30 leave stuck runs; a softer probe (a lower L2) might keep set 2's point, untried.

2026-11-10 · Inference time on three GPUs ​

Question: how long does each size take to classify one image on the GPUs the models are served on, against YOLO11s-cls? And does float16 keep the right answer on every one of them?

Setup: benchmarks/tensorrt.py sizes exported every size at its default input size: s, m and l at 384 px, lt at 448 px. m and lt were the models trained for the serving check, s and l pretrained with a fresh head, which costs the same time. YOLO11s-cls was exported at 224 and 384 px. One real image was letterboxed as each engine expects it, and PyTorch's float32 answer was kept. On an RTX 4090, an RTX 3060 and an RTX 2060, each model was built by trtexec with TensorRT 10.9, in float16 (--fp16) and float32 (TF32 where the GPU has it), batch profile 1-16, and timed at batch 1 over 1000 runs after 500 ms of warm-up, without host-device copies (--noDataTransfers). benchmarks/tensorrt.py report read each GPU's logs.

Result: GPU time per image, median, float16 / float32.

ModelInputRTX 4090RTX 3060RTX 2060
RP-CLASS s (HGNetv2-B0)384 × 3840.22 / 0.35 ms0.43 / 0.84 ms0.50 / 1.13 ms
RP-CLASS m (HGNetv2-B2)384 × 3840.34 / 0.59 ms0.80 / 1.68 ms1.02 / 2.48 ms
RP-CLASS l (HGNetv2-B4)384 × 3840.44 / 0.75 ms1.20 / 2.52 ms1.57 / 4.27 ms
RP-CLASS lt (DINOv3 ViT-S/16)448 × 4480.91 / 1.90 ms2.77 / 8.38 ms3.72 / 14.29 ms
YOLO11s-cls224 × 2240.23 / 0.41 ms0.35 / 0.73 ms0.49 / 0.97 ms
YOLO11s-cls384 × 3840.26 / 0.48 ms0.53 / 1.21 ms0.67 / 1.84 ms

Every RP-CLASS engine gives PyTorch's class on all three GPUs. The largest probability difference is 4.6e-4 in float16 and 2.3e-4 in float32. lt, exported with centred keys, holds in float16 on the RTX 2060 too.

Conclusion: in float16, m classifies an image in 0.34 ms on an RTX 4090, 0.80 ms on an RTX 3060 and 1.02 ms on an RTX 2060. That is 1.3 to 1.5 times YOLO11s-cls at the same 384 px. lt costs 2.7 to 3.6 times m, and float16 matters most for it: float32 is 2.1 times slower on the RTX 4090 and 3.8 times slower on the RTX 2060. These times do not include the letterbox or host-device copies. The serving check measured the whole request at 0.72 ms for m and 1.38 ms for lt on the RTX 4090 (2026-11-09).

2026-11-09 · Serving parity: RP-CLASS in a float16 TensorRT engine behind Triton ​

Question: does a trained RP-CLASS model, exported and served in a float16 TensorRT engine, give the answers of RPCLASS.predict()? And at what latency?

Setup: one fresh model of each range with the final recipe (library defaults) on private set 1, fold 0 (m: HGNetv2-B2 at 384 px, best epoch 48; lt: DINOv3 ViT-S/16 at 448 px, best epoch 43; both val and test macro-F1 1.0). Each model was exported with model.export(), built with trtexec (--fp16 and the batch profile 1-16 stored in the ONNX) and served by NVIDIA Triton 2.56 (TensorRT 10.9), the letterbox done on the GPU in front of the engine, the images sent over gRPC through system shared memory.

The test split has 64 images. It was sent as RGB bitmaps one at a time (P1), as BGR bitmaps (P2), five in flight (P3) and as PNG files decoded by the client (P4), plus a float32 engine without TF32 as a control (C). RTX 4090, nothing else on the GPU.

Result:

m (HGNetv2-B2)lt (DINOv3 ViT-S/16)
same class as predict(), 64 images64 in each of P1-P40 with the float16 engine (NaN scores), 64 with float32
largest probability difference5.5e-3 (float16)6.0e-6 (float32)
float32 control against predict() on the CPU1.5e-63.8e-6
P2, P3, P4 against P1identical, to the last digitidentical
round trip, one image at a time, p50 / p990.94 / 1.30 ms (float16); 1.20 ms (float32)3.03 ms (float32)
images per second, five in flight1,855-
predict() per image, for reference3.3 ms on the GPU4.9 ms

The float32 controls match predict() on the CPU to a few millionths: the GPU letterbox in front of the engine is the library's. The lt float16 engine gives NaN for every image, and a second build gives the same. Its attention in the first block reaches 2.2e6 (the export warns of it), beyond float16's 65,504. On 2026-11-06 a float16 engine of the ViT gave PyTorch's answer, with another checkpoint at 384 px, so whether it survives depends on the model.

Conclusion:

  • m is ready to serve. In a float16 TensorRT engine it gives predict()'s answers to 0.6 % of probability, in under a millisecond.
  • lt cannot be served in float16 as exported. Next: make the export safe for float16; failing that, serve lt in float32 (about 3 ms an image).

Follow-up, the same evening: lt's export in four variants, each built with trtexec --fp16 and the batch profile and run on 16 of the test images against PyTorch float32.

variantfloat32, against the originalfloat16 engine: NaN imagessame classlargest probability difference
as it is2.7e-616 of 16--
attention logits clamped to +-3e40.1216 of 16--
keys centred over the tokens1.1e-60 of 1616 of 160.020
both0.0780 of 1616 of 160.098

Centring the keys subtracts the same amount from every logit of a query row, so the softmax is unchanged. It brings the first block's largest attention value from 2.2e6 to 5.9e5. In the float16 engine, lt then gives no NaN and the same class for all 16 images. Clamping the logits is not exact, and on its own it does not stop the NaN.

Then, on 2026-11-10, the centring went into the export of every timm attention (rpclass/engine/exporter.py, _float16_safe_attention; the export stops if it no longer applies). The whole check was run again for both models on 450 images: set 1 fold 0 (its train, val and test), plus the tests of sets 2 and 3 as images the set-1 models never saw.

m (HGNetv2-B2)lt (DINOv3 ViT-S/16, keys centred)
same class as predict(), float16 engine450 of 450 in each of P1-P4449 of 450
probability difference: median / p99 / largest2.1e-4 / 3.5e-3 / 6.0e-31.2e-4 / 9.3e-3 / 5.1e-2
float32 control against predict() on the CPU1.7e-64.4e-5
P2 and P4 against P1identicalidentical
round trip, one image at a time, p50 / p990.72 / 1.11 ms1.38 / 1.76 ms
images per second, five in flight2,2131,027

lt's one disagreement is an image of set 2 that predict() calls nearly even (0.531 against 0.469, a logit margin of 0.12). It is the only image with a margin under 0.25 for lt; float16 moves lt's margins by up to 0.22. All 320 images of set 1 agree. Five in flight, the engine runs batches, and float16 gives other last digits for 130 of 450 images, but the same classes. In float16, lt serves 2.2x faster than in float32 (1.38 against 3.03 ms).

Conclusion, revised: both ranges serve in a float16 TensorRT engine with predict()'s answers. m agrees to 0.6 % of probability; lt with centred keys agrees to 5 %, and differs only on a near tie.

2026-11-09 · Large training images read shrunk ​

Question: can training read large photos at a reduced size, so that the GPU stops waiting for the CPU, without changing what the model learns?

Setup:

  • First version: images read at about 2x the size their letterbox needs, with the letterbox geometry kept.
  • Validation of that version: HGNetv2-B2, which is bit-for-bit reproducible, and the ViT, each run with and without the shrink. It used sizes where private and development images exceed twice their letterbox: 224 px, set 2 at 160 px and set 1 at 192 px. At 160 and 192 px every image of those sets is shrunk. 3 to 5 seeds (benchmarks/run.py and benchmarks/public/benchmark.py with --shrink-factor, each under its own --tag). The controls (set 2 at 224, Kather-2016, PCam) hold no image large enough to shrink.
  • Then an adversarial review of the change: three lenses, each finding re-checked by a refuter.
  • Second version: exactly 3x, only when that at least halves the pixels.

Result 1, the 2x version: macro-F1, mean ± std over the seeds (private sets: out of fold; development suite: test).

setmodelseedswithoutwithper seed
set 2, 160 px, every image shrunkB2593.5 ± 0.494.3 ± 1.4-2.0 +0.4 +1.9 +2.0 +2.0
set 1, 192 px, every image shrunkB2594.8 ± 0.594.9 ± 0.7+0.3 +1.3 +1.3 -0.6 -1.9
set 1, 224 pxB2396.5 ± 0.396.1 ± 0.9-1.9 +0.9 -0.0
set 3, 224 pxB2 / ViT399.9 / 99.3100.0 / 99.5within 0.3
flowers, 224 pxB2 / ViT388.8 / 92.587.7 / 92.3B2 +1.4 -0.4 -4.3, ViT -0.7 -1.6 +1.8
jiawood, 224 pxB2 / ViT382.4 / 85.880.3 / 87.4B2 -1.5 +1.7 -6.5, ViT +1.2 +3.0 +0.6
controls: set 2, Kather-2016, PCamB21-3identical, every run to the last digit

Result 2, the review. At 2x, the two resizes make a wider filter than the single full-resolution one: on a grating at 448 px, the contrast kept at 0.2 / 0.3 / 0.4 / 0.45 cycles per pixel was 0.95 / 0.89 / 0.81 / 0.76 of the full-resolution letterbox's. At an exact odd factor every output pixel is centred on an intermediate one, and the two triangles make the full-resolution one: 1.000 at 3x and at 5x. The other confirmed findings, all fixed:

  • the size search missed 10-14 % of large images at 256 and 512 px;
  • a JPEG decoded at a reduced scale shifted its content by up to 0.43 px;
  • the benchmarks' upright read shrunk without being asked;
  • workers started by spawn or forkserver ignored the setting;
  • functools.wraps passed the opt-in on to a wrapper;
  • args.yaml named the wrapped augmentation null.

Result 3, the 3x version: the training loader alone (12 workers, d4, no GPU), and how far a shrunk training tensor is from the full-resolution one (identity augmentation; training pixels only):

imagesinputloader, in fullloader, shrunkspeed-upmean distance from full resolution
VisA macaroni2, 2.3 MP448 px1.33 s an epoch1.37 snone: not shrunk (3x keeps more than half the pixels)0
VisA macaroni2224 px1.29 s0.55 s2.3x0.084 / 255
tyres, up to 12 MP448 px4.54 s1.60 s2.8x0.039 / 255
tyres384 px4.36 s1.42 s3.1x0.049 / 255

Conclusion:

  • The 2x version changed no accuracy measurably. With every training image shrunk, B2 went +0.9 on set 2 and +0.1 on set 1, within the seed spread, and the controls were identical. Even so, it trained on images 5-24 % softer at fine detail than the full-resolution ones.
  • The 3x version gives the full-resolution tensor, up to the 8-bit rounding of the intermediate image, and cuts the loader's time 2.3-3.1x on large photos. It applies to images it shrinks to half their pixels or fewer, with square input sizes and the library's augmentations.
  • Not run: accuracy at 3x. Its tensors equal the full-resolution ones up to that rounding. The 2x runs, whose tensors were 3 to 15 times farther from the full-resolution ones and up to 24 % softer at fine detail, already show no measurable effect.

2026-11-09 · Public benchmark, version 1: RP-CLASS m and lt against YOLO11s-cls ​

Question: how does RP-CLASS do against a common classifier on public datasets cut to the size of a typical inspection dataset? This is the benchmark's one evaluation of each test. It reports, and decides nothing in the library.

Setup: the protocol in docs/BENCHMARK.md: 14 datasets, 34 tasks, manifests v1, seeds 0-2, 224 px, or 448 px for VisA, DAGM and the tyres; batch 32, at most 100 epochs, patience 20, DAGM classes 07-10 included (--final).

  • RP-CLASS m (hgnetv2-b2) and lt (vit-s16-dinov3) used the default augmentation: benchmarks/augments.py's d4, which draws exactly as the library's does. They used the recipe with label smoothing 0.1, which every run's args.yaml records.
  • The runs started before 10:47 used the library without three changes that only make training faster; later runs had them: validation from memory, micro-batches prepared by every worker, 4 main threads. Each of these has a test that compares every number of a training. On the GPU, 8 epochs of B2 on VisA gave the same losses and macro-F1.
  • YOLO11s-cls used Ultralytics' defaults (benchmarks/yolo_cls.py).
  • Hardware: one RTX 4090, with up to four runs at a time. Summed over the runs, the time was 4.3 h for m, 4.6 h for lt and 1.9 h for YOLO11s-cls.

Commands:

python3 benchmarks/public/benchmark.py <prepared> <out> --datasets <the 14> --models hgnetv2-b2 \
    --seeds 0 1 2 --augment default --workers 12 --final       # the same for vit-s16-dinov3 and yolo11s-cls
python3 benchmarks/public/report.py <prepared> <out>

Result: benchmarks/public/results/v1 (report.md, runs.csv). The per-dataset table is in docs/BENCHMARK.md, under Results. Headline: macro-F1, the unweighted mean over the datasets (mean ± std over the seeds):

methodall 14generalindustrial
RP-CLASS lt88.8 ± 0.389.8 ± 0.387.8 ± 0.8
RP-CLASS m85.0 ± 0.682.4 ± 0.787.6 ± 0.7
YOLO11s-cls77.1 ± 1.277.8 ± 0.876.3 ± 2.5

Binary runs that never left the majority class. For RP-CLASS, validation macro-F1 never rose above 0.476, the score of calling every image OK. For YOLO11s-cls, which records no validation score here, test macro-F1 stayed under 56:

methodrunswhich
m0 of 75
lt5 of 75VisA macaroni1 s0 and s2, macaroni2 s1 and s2, pcb3 s0; each stopped by patience at epoch 41
YOLO11s-cls7 of 75VisA candle s2, pcb3 s1 and s2; DAGM class03 s0; RAW-FABRID s1 and s2; SDNET2018 s2

Conclusion: m and lt are both well ahead of YOLO11s-cls, by 7.9 and 11.7 points, and m is ahead on all 14 datasets. lt leads m overall, mostly through the general sets: CLEVR's counting gives 2.8 of its 3.8 points. On the industrial sets they tie on average; m is clearly ahead on VisA and lt ahead on the rest.

lt's VisA deficit is mostly the 5 runs that never learned the defect class. That failure shows on validation, which makes it a development candidate: detect it, and find out why the ViT stays at the majority class. It has to be reproduced on development data first.

What it does not show:

  • RP-CLASS at its own input sizes: both models ran at 224 px on 11 datasets, below their defaults.
  • A DINOv3 fine-tune baseline, which was not run.
  • Any decision: none of these test numbers changes the library.

2026-11-06 · Learning rate and label smoothing; the ViT at 512 px; what is noise ​

Question: does the recipe gain from another learning rate (both halved or doubled: head 5e-4 / 2e-3, backbone 5e-5 / 2e-4) or from label smoothing 0.1? And does lt gain from 512 px over 448?

Setup: HGNetv2-B2 and ViT-S DINOv3, d4, 384 px, validation in float32; this batch's own baseline (base, the recipe as it is). Private sets: 5 folds x 3 seeds, OOF macro-F1. Development suite: 3 seeds, test macro-F1. 336 runs (benchmarks/run.py and benchmarks/public/benchmark.py with --recipe and --tag; benchmarks/recipe.py). The ViT at 512 px: sets 1 and 2, 3 seeds x 5 folds.

Result on the private sets, OOF macro-F1 (mean ± std over 3 seeds); OK images rejected to catch every NOK in brackets (of 160 / 153):

recipeset 1, B2set 1, ViTset 2, B2set 2, ViT
base97.8 ± 0.4 (81)96.1 ± 0.3 (95)95.5 ± 1.0 (133)96.7 ± 0.7 (111)
learning rates x0.596.9 ± 0.5 (76)96.8 ± 0.6 (92)96.0 ± 0.7 (112)96.7 ± 0.4 (125)
learning rates x297.1 ± 0.3 (79)95.0 ± 0.7 (72)94.9 ± 0.5 (126)94.2 ± 1.4 (126)
label smoothing 0.197.8 ± 0.3 (23)97.2 ± 0.3 (28)96.1 ± 0.6 (118)96.6 ± 0.9 (130)

Development suite, test macro-F1, B2 / ViT:

recipeflowersjiawoodkather2016pcam
base87.9 / 92.382.1 / 85.485.9 / 88.883.9 / 83.7
learning rates x0.587.8 / 93.086.2 / 77.886.3 / 88.383.8 / 83.7
learning rates x287.9 / 90.482.6 / 80.686.8 / 86.983.8 / 83.2
label smoothing 0.188.8 / 92.582.4 / 85.887.1 / 87.882.5 / 85.1

Mean change over base across the 12 numbers: x0.5 -0.2, x2 -1.1 (worse in 9 of 12), label smoothing +0.3. The ViT at 512 px: 97.1 ± 0.4 on set 1 and 96.8 ± 0.9 on set 2, against 97.7 ± 0.1 and 96.4 ± 0.7 at 448 (image-size batch).

What is noise: HGNetv2-B2 runs are bit-for-bit reproducible. This batch's B2 base repeats the image-size batch's 384 px runs to the last digit (97.8 ± 0.4 and 95.5 ± 1.0, the same rejections), so the earlier gap between batches for B2 came from the validation precision alone. The ViT is not: the same setting gave 96.1 here and 96.6 there (set 1), 96.7 against 95.9 (set 2), from non-deterministic attention kernels. Below about 1 point, a ViT difference says nothing.

Conclusion: the learning rates stay (doubling them loses 1.1 points on average; halving them changes nothing consistent). Label smoothing 0.1 adds 0.3 points of macro-F1 on average, within the noise, but on set 1 the OK images a threshold must reject to catch every NOK fall from 81 and 95 to 23 and 28 (of 160) for both models, the operating point inspection cares about; on set 2 they barely move. Its cost: confidences stop at 0.95 for two classes (1 - 0.1 + 0.1 / C), which a user sees. Decision (2026-11-09): label smoothing 0.1 is in the recipe. The ViT gains nothing at 512 px over 448: lt stays at 448.

2026-11-06 · Image size ​

Question: which input size should each model use by default (decision 4: a size given to train is always used)?

Setup: HGNetv2-B2 (m) and ViT-S/16 DINOv3 (lt), d4 augmentation, validation in float32, sets 1 and 2, 5 folds, 3 seeds, at 224, 320, 384 and 448 px. 240 runs (benchmarks/run.py --imgsz, two or four at a time; every run used the full batch of 32).

Result, OOF macro-F1 (mean ± std over the 3 seeds); AUC of P(NOK) in brackets:

sizeset 1, B2set 1, ViTset 2, B2set 2, ViT
22495.7 ± 0.6 (99.0)94.2 ± 0.5 (97.3)93.7 ± 1.0 (97.7)94.1 ± 0.7 (97.6)
32097.0 ± 0.7 (99.3)96.4 ± 0.9 (98.8)94.7 ± 1.0 (97.9)95.4 ± 0.6 (97.5)
38497.8 ± 0.4 (99.4)96.6 ± 0.4 (98.9)95.5 ± 1.0 (98.3)95.9 ± 0.4 (97.7)
44897.7 ± 0.4 (99.7)97.7 ± 0.1 (99.4)94.7 ± 0.6 (97.8)96.4 ± 0.7 (98.2)

Conclusion: B2 peaks at 384 (448 is no better: set 1 -0.1, set 2 -0.8); the ViT still gains at 448 (+1.1 and +0.5 over 384), as a 16 px patch then covers less of the part. 224 costs 1.8 to 2.4 points to every model. Proposed defaults: 384 px for the CNN sizes (s, m, l), 448 px for lt; whether lt gains further at 512 is open.

Noise between batches: the same setting, d4 at 384, gave the ViT 97.4 ± 0.2 on set 2 in the augmentation batch and 95.9 ± 0.4 here, B2 97.5 against 97.8 on set 1 and 96.0 against 95.5 on set 2. The one change in between is the validation precision (bfloat16 then, float32 now), which moves the best epoch and the weights the final decay restarts from; GPU kernels are not deterministic either. So a difference between batches is not evidence below about 1.5 points: every comparison is made within one batch, with its own baseline.

2026-11-06 · The 8 orientations beyond the private sets: the development suite ​

Question: the 8 orientations (d4) gained 1.3 to 3.6 points on the private sets, whose parts are seen from above. Do they cost anything elsewhere: on natural photos, half of them upright (flowers), on histology (Kather-2016, PCam), on coated-wood defect crops (Jia)?

Setup: the development suite (benchmarks/dev, docs/BENCHMARK.md), prepared with the benchmark's protocol (built test, val of about 100, training draws of about 300 images per seed; Jia's whole pool, 152 crops); HGNetv2-B2 and ViT-S DINOv3, the default augmentation against d4, 224 px, 3 seeds, validation in float32. 48 runs, benchmarks/public/benchmark.py and report.py; scores on each set's test, used for development as the suite is meant to.

Result, test macro-F1 (mean ± std over the 3 seeds); PCam's AUROC of P(tumour) in brackets:

modelflowersjiawoodkather2016pcam
B2, default87.6 ± 1.384.1 ± 1.784.6 ± 0.682.6 ± 0.9 (91.1)
B2, d487.9 ± 1.282.1 ± 1.285.9 ± 1.283.9 ± 1.9 (93.2)
ViT, default92.4 ± 0.983.1 ± 2.187.7 ± 1.181.9 ± 1.8 (91.8)
ViT, d492.3 ± 0.785.4 ± 3.488.8 ± 0.883.7 ± 3.8 (93.2)

Conclusion: no measurable cost anywhere. The flower photos, about half of them upright, are unchanged (+0.3, -0.1); histology, which has no up, gains 1.1 to 1.8 points of macro-F1 and 1.4 to 2.1 of AUROC; Jia's crops move both ways (-2.0 for B2, +2.3 for the ViT) within their noise (152 training crops, std up to 3.4). With the private sets, d4 is a gain or neutral on six sets of four kinds. What no set here can show is a task whose class is the orientation (a part mounted upside down, a mirrored label): d4 would teach a model to ignore exactly that, as the horizontal flip of the current default already does for mirrored parts.

Decision (2026-11-06): d4 is the library's default, and train(keep_orientation=True) removes every flip and turn for a task whose class is the orientation (docs/DESIGN.md, As built 8). In this entry and the two before it, "default" is the provisional one, today's --augment hflip.

2026-11-06 · The default augmentation, on the private sets ​

Question: which augmentation becomes the default (decision 8)? The candidates (benchmarks/augments.py) never erase or invent content: default, the provisional one (photometric distortion 0.5, horizontal flip 0.5); none; d4, default plus the 8 orientations of the square (vertical flip 0.5, then a random multiple of 90 degrees); rotate, default plus a free rotation of 0-360 degrees on a canvas that holds the whole image; d4-zoom, d4 plus a zoom-out 0.5 (the image on a grey canvas up to 1.3x its size).

Setup: as the backbone benchmark (5 folds, out-of-fold scores, 3 seeds, 384 px, the provisional recipe, validation then in bfloat16): HGNetv2-B2 (size m) and ViT-S/16 DINOv3 (size lt) on sets 1 and 2; set 3 is saturated. 240 runs (benchmarks/run.py --augment).

Result, OOF macro-F1 (mean ± std over the 3 seeds); AUC of P(NOK) in brackets:

augmentationset 1, B2set 1, ViTset 2, B2set 2, ViT
default93.9 ± 1.3 (98.5)94.9 ± 0.5 (98.3)94.7 ± 0.7 (97.9)95.9 ± 0.8 (97.9)
none92.2 ± 0.5 (97.3)93.9 ± 0.7 (97.9)93.7 ± 2.8 (97.8)95.3 ± 0.6 (97.2)
d497.5 ± 0.4 (99.4)96.8 ± 0.1 (99.3)96.0 ± 1.0 (98.5)97.4 ± 0.2 (98.7)
d4-zoom97.9 ± 0.4 (99.6)96.6 ± 0.4 (99.0)96.4 ± 0.7 (98.2)96.3 ± 0.7 (98.7)
rotate97.0 ± 0.8 (99.3)96.6 ± 0.5 (99.3)94.7 ± 0.5 (96.5)94.7 ± 0.2 (97.9)

The d4 runs train longer (best epochs 41-53 against 31-40; 87-161 s a run against 63-103): the model keeps improving under more varied views. The OK images a threshold must reject to catch every NOK stay many for every variant (55-153 of 153-160): that operating point hangs on the one hardest NOK of each set.

Conclusion: the 8 orientations are the lever, 1.3 to 3.6 points over the default and the best or within a standard deviation of it in all four columns. The zoom-out adds nothing consistent (+0.4 for B2, -0.2 and -1.1 for the ViT); the free rotation helps set 1 (round parts in round crops) but not set 2, whose crops are square and fill the frame (a rotation shrinks the part inside a larger canvas and adds grey corners). Photometric distortion and the horizontal flip are worth 0.6 to 1.7 points over nothing. Not yet the library's default: in both sets the parts are seen from above, where every orientation is a valid view, while on a task where the orientation is the defect (a part upside down) d4 would teach the model to ignore it. Next: the development suite (natural photos, histology, coated wood) shows whether d4 costs anything elsewhere. Meanwhile d4 is the augmentation of the recipe experiments.

2026-11-06 · Validation precision: the trainer's numbers against model.val() ​

Question: the runs.csv of the benchmark on the private sets (the trainer's final test evaluation) and its predictions.csv (predict() afterwards, the same weights) disagree. By how much, and why?

Setup: the 135 RP-CLASS runs of the benchmark on the private sets (HGNetv2-B0, B2, ViT-S DINOv3; sets 1, 2 and 3; 3 seeds x 5 folds), test macro-F1 and top-1 from runs.csv against the same metrics computed from predictions.csv.

Result: 78 of 135 runs differ, by 1 or 2 test images of 53-54 (top-1 up to 3.7 points, macro-F1 up to 3.7; mean difference +0.03 points, no direction). The trainer validated under autocast (bfloat16 on the RTX 4090), predict() in float32: borderline images move.

Conclusion: validation runs in float32 from now on (rpclass/engine/trainer.py), per epoch and at the end: the best epoch no longer depends on rounding, and the numbers a training reports are the ones model.val() gives. Training stays in reduced precision. The benchmark summaries were already computed from predictions.csv (float32) for every method, so no reported number changes.

2026-11-06 · What counts as a duplicate in the public benchmark ​

Question: the public splits group near-copies (docs/BENCHMARK.md, step 1), but the first rule (64-bit dHashes within 4 bits and 32 x 32 grey thumbnails within 3 / 255) trimmed official tests (VisA pipe_fryum 240 -> 174 and an empty training pool, candle, pcb3, macaroni1, DAGM class04) by joining images that are not copies and dropping them as label noise. Which rule tells the same picture from a picture that looks alike?

Setup: every candidate pair under the first rule (each image against the first image of every cluster so far, as finalize matched them), on the real data of the dataset modules: EuroSAT, DAGM class01 and class04, DeepWeeds, VisA (6 objects). For each pair, the mean thumbnail difference at 32, 64 and 128 px, and whether the labels agree. Then real copies made on purpose: 60 real images (DeepWeeds, VisA, EuroSAT) re-encoded as JPEG 95 / 85 / 75 and resized to 0.8 then JPEG 90. Script: scratch calibrate_twins.py (not kept: a one-off measurement).

Result, mean thumbnail difference at 128 px (min / median / max):

pairs under the first rulecountsame labelother label
VisA pipe_fryum (distinct pieces, one background)4381.89 / 2.97 / 3.802.38 / 3.05 / 3.62
VisA candle2490.37 (4 true repeats) / 3.27 / 3.582.78 / 3.29 / 3.64
VisA pcb3, pcb4, macaroni12323.78 and up4.27 and up
DAGM class04 (independent textures)997.65 / 8.36 / 9.107.95 / 8.57 / 9.01
DeepWeeds (the same scene shot twice)572.05 / 5.64 / 12.75none
EuroSAT (707 of 762 flat open water)7620.45 / 0.91 / 3.681.38 / 2.06 / 3.01
copies made on purpose (60 real images)32 px, 90th pct / max128 px, 90th pct / max
JPEG 950.23 / 0.300.55 / 0.65
JPEG 850.40 / 0.490.90 / 1.18
JPEG 750.59 / 0.671.20 / 1.59
resized 0.8, JPEG 900.53 / 0.751.28 / 1.77

The review of the adapters added Caltech's 41 grouped pairs, each the same photo or drawing (cropped or shifted): 0.18-2.71 at 32 px, 0.43-5.61 at 128 px.

Conclusion: no single threshold separates them. At 32 px, copies (under 0.8), re-shots of one scene (Caltech, DeepWeeds: up to 3) and distinct look-alikes (VisA: from 1.1) overlap; at 128 px, copies stay under 1.8 while distinct VisA pieces start at 1.9 against the cluster leaders the rule compares with (1.57 over all pairs, found by the docstring check of the frozen data: a thin margin, the frozen near-copies reaching 1.43) and textures at 7.6, but re-shots spread to 13. So two tiers (benchmarks/public/common.py): look-alikes (the first rule) only join a group, which keeps re-shots on one side of the splits we build; near-copies (look-alikes within 1.5 at 128 px) are the same picture, and only they count as label noise or tie a pool image to an official test. Two refinements came from running it on EuroSAT: label noise is a pair, not a cluster (near-copies chain, and one dark forest tile among 867 flat water tiles dropped 67 of them), and featureless images (32 x 32 thumbnail standard deviation under 2 grey levels: 837 of the 895 EuroSAT tiles the first rule grouped, against 14.2 for the rest) are neither look-alikes nor near-copies: chained into one group, the flat water would have made almost all of sea_lake's test when drawn. Official tests now stay whole (VisA: 12 of 12, DAGM class01 and class04), pipe_fryum trains on 237 images instead of none, and DeepWeeds' 57 retakes and Caltech's 45 repeated photos stay on one side of the splits.

2026-11-06 · Backbones on the three private inspection datasets ​

Question: which backbone makes the sizes (decision 2): accuracy on small inspection datasets, speed, float16.

Setup: three private OK / NOK sets of 320, 266 and 383 images (sets 1, 2, 3), in 5 folds (benchmarks/folds.py): for fold k, test = fold k, val = fold k+1, train = the rest; the 5 test folds pooled give out-of-fold (OOF) scores over every image. RTX 4090, Python 3.11, torch 2.6, bfloat16. The provisional recipe of every RP-CLASS run: head lr 1e-3, backbone 1e-4, weight decay 0.05, batch 32, 384 px letterbox, 100 epochs, patience 20, the default augmentation (photometric, horizontal flip). Seeds 0, 1, 2. Baseline: Ultralytics YOLO11s-cls 8.4.93 with its own defaults at the same size, epochs, patience and batch (benchmarks/yolo_cls.py). 270 runs (benchmarks/run.py, benchmarks/yolo_cls.py), summarized by benchmarks/summary.py.

Result, OOF macro-F1 (mean ± std over the 3 seeds); AUC of P(NOK) in brackets:

modelset 1set 2set 3s / runparams
vit-s16-dinov394.9 ± 0.5 (98.3)95.9 ± 0.8 (97.9)99.9 ± 0.187-9521.6 M
hgnetv2-b293.9 ± 1.3 (98.5)94.7 ± 0.7 (97.9)100.063-1039.2 M
hgnetv2-b494.7 ± 1.1 (98.9)91.2 ± 1.4 (96.5)100.072-12517.8 M
hgnetv2-b092.6 ± 0.4 (97.5)91.8 ± 0.8 (97.4)100.047-903.9 M
convnext-t-dinov392.5 ± 0.7 (96.2)92.0 ± 2.1 (95.4)99.6 ± 0.1103-11127.8 M
YOLO11s-cls88.4 ± 0.9 (95.2)88.0 ± 1.7 (93.2)99.8 ± 0.126-395.5 M

Every RP-CLASS run ended by patience (best epoch 29-45, 44-67 epochs run). Set 3 is saturated (every model 99.6-100) and decides nothing.

Float16 (benchmarks/fp16.py, set 1, seed 0, fold 0, 8 test images): only the ViT holds values float16 cannot (block 0 attention, 2.3e6); the four CNNs never pass 65504. TensorRT (benchmarks/tensorrt.py, TensorRT 10.9, the same model, one real test image): every float16 engine, the ViT's included, gives the PyTorch answer (probabilities within 3e-5, the same class): TensorRT computes the attention safely; a plain float16 runtime (ONNX Runtime float16) would not. GPU time per image, batch 1, 384 x 384, median of 500 runs, float16 / float32:

modelRTX 4090
hgnetv2-b00.22 / 0.35 ms
hgnetv2-b20.34 / 0.59 ms
hgnetv2-b40.44 / 0.75 ms
convnext-t-dinov30.68 / 1.10 ms
vit-s16-dinov30.62 / 1.37 ms

Conclusion: RP-CLASS beats YOLO-cls by 5.5-8 points of macro-F1 with any of its backbones. The DINOv3 ViT-S is the most accurate (1.0-1.2 points over HGNetv2-B2, about one standard deviation), and serves in float16 on TensorRT, but is 1.8x slower than B2 and comes under Meta's DINOv3 licence; B4 is not better than B2 on data this small. Not decided yet (decision 2): two datasets of a few hundred images, with a provisional recipe whose augmentation ignores what matters for parts seen from above (rotation); the recipe experiments and the public benchmark come first. To catch every NOK of set 1, every model still rejects 83-106 of its 160 OK images, so the recipe has a lot to give.