← All projects · Factory Vision write-up

Live demo · runs in your browser

Scratch and dent detection, in your browser

The project's YOLOv8n detector, exported to ONNX and run on your own device with ONNX Runtime Web. Pick a sample or try a photo of your own: it never leaves this page.

Read this first: the model was trained and validated on synthetic images only, each a flat grey panel with one dark line (a scratch) or one dark circle (a dent). Its validation scores show the pipeline works end to end, not that it can inspect real parts. On real photos it misses obvious dents and draws boxes on tail lights, door handles and plain panels instead.

Loading the model…

–boxes above the threshold
–model run on this device
–model input (px)

Loading the model (about 12 MB)…

Synthetic validation images

    Real photos are out of the model's depth. Expect misses and false boxes.

    0.35
    Detections
    • Pick an image to run the model.

    What the scores mean

    Validation, run train3

    Loading…

    From the last epoch of runs/detect/train3/results.csv, which is also the best one.

    Why it fails on real photos
    • Every training image is one high-contrast shape on a flat grey background.
    • Every training image has exactly one defect, so the model has never seen a clean part.
    • The fix is real defect data, such as NEU-DET or MVTec AD, with a held-out real test set.

    How this page works

    • demo/export.py exports runs/detect/train3/weights/best.pt to ONNX (opset 17).
    • The image is scaled so its long side is 640 px and padded with grey to a multiple of 32, as ultralytics does.
    • The output holds a box and two class scores for every anchor. Boxes under the threshold are dropped, then overlapping boxes of the same class are merged (IoU 0.5), the same defaults as the Streamlit app.
    • export.py checks that this decoding gives the same boxes and scores as the original PyTorch weights on every synthetic validation image in the repo.
    • The three real photos used in the README's out-of-domain check are third-party images, so they aren't bundled here.
    • Timings are measured live in your browser, on one CPU thread.

    Source