Skip to main content
Created By: Martins Awojide Public Edge Impulse projects: webcheck_poc_ad (gate) · webcheck_poc_od (detector) GitHub repository: MartinsAwojide/webcheck Demo video: YouTube
Rendering of the intended production line: the gravure press with Station A, the triplex laminator, and the slitter-rewinder with Station B. The layout is illustrative, not a real plant.

Story

The problem

Flexible packaging such as snack bags, pouches and sachets is printed and laminated on web lines, where a continuous roll of film runs through the press at high speed. At those speeds, it is nearly impossible to check every metre by eye. At above 500 feet per minute (about 152 m/min), no known method lets an operator reliably inspect the whole product by eye. Creating a relatively inexpensive inspection setup that a facility’s IT team has full control over is now a prospect considering the improvements in hardware and software for edge development. But acquiring labelled training data for this kind of project can be complicated. A defect worth catching is, by definition, rare, and production images are often confidential, so a labelled collection of hundreds of examples of each defect type is slow to build and expensive. Rendered images sidestep both problems, because the renderer knows exactly where every defect is and can make as many as the model needs. The focus of this project is to know how well models trained only on renders can perform.

Things used in this project

Hardware components

  • NVIDIA Jetson Orin Nano Developer Kit (×1): Jetson Orin Nano 8GB module on the reference carrier board. Runs both models, the defect log, the MQTT broker and both web pages.
  • Webcam, Logitech HD Pro (×1): Optional. Films a screen showing the moving web so the audience sees a real camera picture. It is not inspected.

Software apps and online services

  • Edge Impulse Studio: training, testing and exporting both models (FOMO-AD visual anomaly detection, YOLO-Pro object detection).

What I built

webcheck is the inference core of an automated web inspector, built as a prototype. Two models work in cascade: an anomaly detection model as the gate, flags any part of the image that looks wrong, and an object detector then names and boxes the defect. Both models run on an NVIDIA Jetson Orin Nano. The output is a structured defect log with one record per defect: defect type, confidence, time, position along and across the web in millimetres, and size. An operator HMI shows the inspected web and the defects, and a separate defect map reads the defects from a Unified Namespace (UNS), a shared tree of MQTT topics on the board, and shows where on the print they fall to help the operator with pattern recognition and basic root cause analysis. Why run it on the edge? In the system as built, every frame is inspected on the board that receives it, so inspection does not depend on a network uplink. The only things that leave the board are the defect records and the two web pages, which go to a browser you point at the board (usually within the local network of the facility). The print design therefore stays on your own network, which matters to anyone whose artwork is confidential.

How the data was made

All training and test images were rendered with BlenderProc 2.8.0 on Blender 4.2.1. The script that places each defect also writes its label box, so every image comes with exact ground truth.

The product and its layers

The product is a fictional creatine supplement pouch, and its artwork sits on the web as two lanes side-by-side with a 10 mm gap of bare film between them. The two inspection points use different materials:
  • Station A, after printing. Outer PET film with reverse-printed ink, and nothing else.
  • Station B, after lamination. A true multi-layer stack: outer PET with the ink on its inner face, an aluminium-oxide-coated PET barrier layer, and an LLDPE sealant layer.
Rendering of one-pass triplex solventless lamination from the drive side, slowed for viewing. The inset shows the layer stack, not to scale: PET with the ink on its inner face, an AlOx-coated PET barrier and an LLDPE sealant, joined by two thin adhesive bonds.

The scene and the light

I used transflected lighting, where light transmitted through the film and light reflected off it reach the same sensor and blend into one RGB image. A large diffuse panel under the film gives the transmitted light, which suits print inspection because ink density reads as opacity. Two front bars, angled at 45 degrees and kept just outside the camera’s view, give the reflected light, which is what shows lamination defects such as air pockets.
Rendering of Station A after printing, slowed for viewing: two cameras over a free span of film lit from below, a Jetson Orin Nano at the station, and the HMI boxing each defect as it crosses the window. The defect marks are enlarged stand-ins.
The system mimics an area-scan camera. Each frame is a full 1920x1080 picture at 0.5 mm per pixel, so it covers 960 mm across the web and 540 mm along it, which matches the Logitech C920 webcam used in the demo. Two cameras sit side by side and together cover the full web width. They overlap, so the same defect can appear in both frames, as in the pair below, and the cascade merges those into one record.
The fictional creatine pouch artwork printed on every rendered web. The brand, logo, QR code and barcode are placeholders and belong to no real product.
One web position at station A as the left camera sees it (1920x1080, after printing). The three boxes are ground-truth labels: two streaks and a dot skip.
The same web position from both cameras side by side. Each defect appears in both frames, so three defects give six boxes.
The right camera's frame. The grey area is what the left camera already inspects, so the right camera skips those two tile columns. The streak numbered 3 lies in the column both cameras inspect, and the dedup code merges its two detections into one record.

Six defect classes

The demo models detect six classes: streaks, dot skip, mottling, bubbles, silvering and tunneling. Station A can show three of them (streaks, dot skip and mottling), and station B can show all six.
Rendering of Station B after lamination, slowed for viewing: the six defect classes pass under the two cameras, the stack light turns red while a defect is in view, and the HMI boxes each one. The defect marks are enlarged stand-ins, and the encoder wheel belongs to the intended installation (the demo has none).

Modelling the film

Light behaves differently at every layer boundary, so the renders have to follow the physics closely enough for a model to learn from them. How much light each boundary reflects is calculated from Fresnel reflection, using SCHOTT’s reflection-factor formula for a plate in air. A tunnel is an air gap between layers, and the same calculation says the extra boundaries make it slightly darker than bonded film in transmitted light and brighter in reflected light. Each defect type has its own rendering method. Small bubbles render with the denoiser off, folds get local mesh detail, and dot skips are placed only where ink is printed. Lighting variation (nuisance) and sensor noise (based on camera settings) are added when the frames are cut into tiles to ensure that the dataset mimics anomalies present in production settings, even though the transflected lighting setup controls for variations.

Volume

Each station’s dataset has 1,490 rendered frames: 660 for training, 277 for validation and 553 for testing. The test split is held out: it was not used to train either model or to set any threshold, and the demo plays these test frames. They are public on Hugging Face, 553 frames per station with COCO labels, metadata and checksums: webcheck-test-frames on Hugging Face

The two models

Both models were trained and tested in Edge Impulse Studio, and both projects are public, so you can open them and clone them instead of training your own. The gates are in webcheck_poc_ad, and the detectors are in webcheck_poc_od.
Edge Impulse Studio, the best-recall gate's impulse: a 320x320 image input, an image block and the FOMO-AD visual anomaly block, with one anomaly score as the output.

The gate

Edge Impulse’s FOMO-AD visual anomaly block learns what normal looks like from training data that contains no anomalies, so it needs no defect examples. That fits this problem well, because the gate only has to say “something here is not normal”, and the detector decides what it is. The gate’s score for a tile is the highest value in its 40x40 grid of anomaly scores, and two gates are offered on the HMI’s start screen. The best-recall gate (threshold 20.3522, the default) passes 0.901 of defective tiles to the detector, at the cost of flagging many more normal tiles. The best-F1 gate (threshold 25.3) flags 1.5% of normal tiles and passes 0.606 of defective tiles, so it raises far fewer false alarms and the line runs faster.
Edge Impulse Studio, the small YOLO-Pro detector's impulse: a 640x640 image input, an image block and the object detection block, with six output classes: bubbles, dot skip, mottling, silvering, streaks and tunneling.

The detector

Edge Impulse’s YOLO-Pro is a family of object detection architectures built for edge devices. It runs only on the tiles the gate flagged, and it names and boxes each defect, which is what makes the cascade cheaper than running a detector on everything. Which metric matters. For the gate, it is recall, not F1: a defect the gate misses is never seen again. At the same time, a false alarm only costs the detector some time, and a gate tuned for its own best F1 gives up recall for precision that the detector can supply (my best-F1 gate passes only 0.606 of defective tiles). For the detector, it is F1 per class because it names and records every defect, so it must keep false records out of the log (precision) without missing the defects the gate passed (recall).
Edge Impulse Studio, Experiments page of the gates project: the two FOMO-AD gates side by side. Both use a MobileNetV2 0.75 backbone with PatchCore at 320x320, one trained on CPU (best recall) and one on GPU (best F1). Their model-testing accuracy, 56.9% and 95.0%, differs because accuracy depends on where the threshold sits; the next two images show why.
Model testing of the best-recall gate: it flags 90.1% of anomalous tiles, and 46.5% of normal tiles too (F1 0.28 for anomaly and 0.69 for no anomaly). It misses few defects and raises many false alarms, which is the trade a gate should make.
Model testing of the best-F1 gate: it flags 60.6% of anomalous tiles and only 1.5% of normal tiles (F1 0.69 and 0.97). It raises few false alarms, but 39.4% of defective tiles get through unseen.
FOMO-AD settings of the best-recall gate: a MobileNetV2 0.75 backbone with PatchCore scoring (3 layers, pool size 3, sampling ratio 0.0005, 9 nearest neighbours), trained on CPU. The on-device time shown is Edge Impulse's own estimate for its runtime, not the TensorRT timing measured on the board.
FOMO-AD settings of the best-F1 gate: the same backbone and PatchCore settings, trained on GPU. The on-device time shown is Edge Impulse's own estimate for its runtime, not the TensorRT timing measured on the board.
Edge Impulse Studio, Experiments page of the detectors project: YOLO-Pro small and medium at 640x640, both trained on GPU. Validation and test mAP at IoU 0.5 are 0.91 and 0.91 for small, and 0.92 and 0.91 for medium.
Model testing of YOLO-Pro small on the validation tiles: mAP at IoU 0.5 is 0.91 and overall mAP is 0.58, with recall of 0.63 at up to 100 detections.
Model testing of YOLO-Pro medium on the validation tiles: mAP at IoU 0.5 is 0.91 and overall mAP is 0.60, with recall of 0.66 at up to 100 detections.
Training page of YOLO-Pro small (6.9M): 200 training cycles, learning rate 0.001 and pretrained weights; last training performance on the validation set is mAP at IoU 0.5 of 0.91 and mAP of 0.61. The 452 ms on-device time is Edge Impulse's estimate, not the TensorRT timing measured on the board.
Training page of YOLO-Pro medium (16.6M): the same settings as the small model; last training performance on the validation set is mAP at IoU 0.5 of 0.92 and mAP of 0.58. The 1225 ms on-device time is Edge Impulse's estimate, not the TensorRT timing measured on the board.

How the cascade runs

How a frame is inspected: it is cut into six 640x640 tiles, the FOMO-AD gate scores every tile, YOLO-Pro runs only on the flagged tiles, and each defect goes to the HMI, the JSON Lines log and the MQTT topics that feed the defect map.
Each frame follows the same path, and the order is what keeps the board fast:
  • Tiling. Each 1920x1080 frame is cut into six 640x640 tiles (two overlapping rows, three columns).
  • Right-camera column gating. The right camera’s first two tile columns lie inside the left camera’s view, so by default only its third column is inspected.
  • The gate scores every inspected tile, and only flagged tiles go on.
  • The detector runs on the flagged tiles. Its boxes are decoded and duplicates removed with class-aware non-maximum suppression.
  • One defect, one record. When both cameras see the same defect, the two detections are merged. They count as one when they share a web position and label and, after each box is grown by 2 mm, their overlap over the smaller box is at least one half. The copy not cut off by an image edge is kept. The picture of the left and right camera frames shows this: three defects, six boxes.
  • A queue and a state machine. Both cameras’ frames at one web position form a slice. Slices are inspected in order and never dropped. If the board falls behind, the queue grows, and the HMI shows the backlog.
  • The defect log. A JSON Lines file with one record per defect. There is no hardware encoder in the demo as it would be in the line, so web position comes from the frame index times the frame length, plus the camera’s offset across the web.
  • The log on MQTT. Each record is also published to a Unified Namespace on the Mosquitto broker running on the board, with the topics following the ISA-95 levels of a fictional converter and each station as its own work cell.
Where the gate looks: the best-recall gate's anomaly maps over the six tiles of one validation frame (station B, left camera). The two labelled defects, a streak and a small bubble, are the hottest areas, and the detector finds both.
A defect record looks like this:
location.md_mm is along the web (machine direction) and cd_mm across it. size is the box area in square millimetres. The same records leave the board as a Unified Namespace (UNS). A UNS is one shared tree of MQTT topics where every system on a line publishes what it knows and reads what it needs, so a dashboard, a quality database or the machine downstream can all take the defects from one place instead of each needing its own connection to the inspector. The topics here follow the ISA-95 levels (enterprise, site, area, line and work cell), with each inspection station as its own work cell; the company and site are fictional and are settings, not code. Each record is written to the log file first and published second, so a broker that is down never stops the inspection, and the defect map is just one more subscriber reading the tree the way any other software on the line could. On the board, both models are exported from Edge Impulse Studio as ONNX graphs inside the TensorRT library export. The board’s own TensorRT 10.3 builds them into engines in the project’s Python package and caches them. The gate input is resized on the GPU by a CUDA port of Pillow’s Lanczos resize so the board sees the same input Studio does.
Edge Impulse Studio, Deployment page: the TensorRT library target with the unoptimized float32 model selected. The download holds the ONNX files the board turns into TensorRT engines. The latency shown is Edge Impulse's own estimate, not the TensorRT timing measured on the board.
Rendering of the intended installation: a Jetson Orin Nano at each station, with the inspection HMI and the defect map on line screens over the Station B aisle. The screen contents are illustrative.
The board serves two pages. The inspection HMI (port 8080) plays the station’s test frames as a moving web with the counters, the latest defect, a gate legend and both models’ timings floating over it, and it has a speed slider from 1 to 450 m/min. The defect map (port 8090) is a separate process that subscribes to the MQTT topics like any other software on a line would, and folds every detection onto one print repeat as a per-class heatmap, with counts by class and severity and the defect rate in defects per million opportunities.
Inspection HMI: station A at 123 m/min. Inspected slices and metres, defects per class, the latest defect with its gate score, and both models' timings.
Defect map: the MQTT defect log streaming live, every detection folded onto one print repeat as a per-class heatmap, and counts by class and severity with the defect rate in DPMO.

Results

Model accuracy comes from Edge Impulse Studio’s model testing on 3,014 validation tiles (282 with a defect), float32, and the thresholds were picked on those same tiles. Every other number was measured on the NVIDIA Jetson Orin Nano Super Developer Kit, in power mode MAXN_SUPER, with TensorRT 10.3 engines built on the board in float32, at a batch size of 1.

The gate

The best-recall gate (FOMO-AD, 320x320 input, threshold 20.3522) on the 3,014 validation tiles: AUROC 0.883, recall 0.901 with 46.5% of normal tiles flagged, on all tiles and per station. Edge Impulse Studio, float32, measured.

The detector

YOLO-Pro small-640 at confidence 0.5: labelled defects, precision, recall and F1 for each of the six defect classes, with macro F1 0.776. Edge Impulse Studio, float32, measured.
Board against Studio (200 validation tiles, 60 with a defect): the board’s gate scores rank the tiles like Studio’s with a Spearman correlation coefficient of 0.9962; its AUROC is 0.937 against Studio’s 0.936, and its flag decision at the earlier threshold of 20.6 agrees with Studio’s on 199 of 200 tiles. The whole cascade on the board. A log inspector replays each station’s frames through the cascade and checks every logged record against ground truth. A record matches a defect when it has the right type and its centre lies inside the defect’s extent on the web grown by 2 mm, and a defect seen by both cameras or cut by a frame edge counts once. This measure is slightly different from Studio’s per-tile box matching.
The whole cascade on the Jetson Orin Nano: recall / precision for both gates and both detectors on the station A and B validation and test frames, with right-camera column gating on. Measured, one run per configuration.
Cascade speed per slice, by gate (Jetson Orin Nano, MAXN_SUPER):
Time per slice on the Jetson Orin Nano by gate mode: 39.0 ms with the gate only, 218.3 ms with every tile sent to YOLO-Pro, 214.6 ms with the best-recall gate and 52.2 ms with the best-F1 gate. Measured, MAXN_SUPER.
The gate choice sets the speed. On these test frames, the best-recall gate passes almost every tile to YOLO-Pro, so it runs close to the every-tile case, while the best-F1 gate sends about one tile in fifteen. Per model, per 640x640 tile (Jetson Orin Nano, float32): YOLO-Pro small takes 17.7 ms on average (p95 20.2 ms) and YOLO-Pro medium takes 34.1 ms (p95 39.4 ms), over 100 runs on the same random tiles. Sustained line speed with the full demo (best-F1 gate, YOLO-Pro small; Jetson Orin Nano, MAXN_SUPER, float32, and all ancillary features running). At the default start speed of 123 m/min (3.80 slices per second needed), the HMI kept up in every run, with the defect map running and polled. The defect map costs about 1% of a CPU core and 44 MB of memory while running and polled, with the inspection rate unchanged.

Facts worthy of mention

These are the things I would have wanted to know before starting: Export TensorRT, not the packaged runtime. On this board, Edge Impulse’s packaged runtime could not run the gate, so I used the ONNX graphs from the TensorRT library export and built engines with the board’s own TensorRT. Building the engines makes the first start take several minutes: the medium detector alone takes 361 seconds to build, once. Match training resolution to the camera. I set the rendered frame to the webcam’s 1920x1080 on purpose, so the demo camera feeds the model at the resolution it was trained at. The gate’s resize also matches Pillow byte for byte. Both choices exist to avoid a train and inference mismatch that would silently cost accuracy. Never let a bond become a mesh. My first attempts to render the adhesive as a solid slab, or to stretch each layer until it touched the next, made every frame about 30% darker. Blender treats every closed mesh as sitting in air, so a touching slab adds its own entry and exit surfaces instead of matching the layers. Leaving a few micrometres of real air between layers fixed it, and it also turns out to suit the thin, void-prone adhesive bonds the defects come from. Check the artwork’s colour space. My first artwork export carried a BT.2020 tag with an HLG transfer curve, which Pillow and Blender both ignore, so every colour was misread as sRGB. Re-exporting as plain sRGB fixed it. If your renders look wrong in colour, check the file’s colour tag before touching the lights. Keep a clean master and expose later. Once the artwork’s colours were read correctly, my first light settings clipped 80.9% of a preview frame, and Blender’s output clips at 1.0, so no exposure change afterwards could bring that detail back. The scene is now rendered at a low light level into an unclipped linear master, and exposure and the camera curve are applied afterwards. That keeps headroom for defects that brighten the image, such as silvering, and it makes it possible to measure exactly how much of the signal clips. Project demo video on YouTube

References

  • Edge Impulse documentation: visual anomaly detection (FOMO-AD) and YOLO-Pro.
  • J. L. Raheja, B. Ajay and A. Chaudhary, Real-Time Fabric Defect Detection System on an Embedded DSP Platform, arXiv:1410.0371
  • P. J. Kühn, S. N. Sinha, T. Kleist, R. Hoffmann, A. Kuijper and M. Weinmann, ScratchSim: A Procedural Synthetic Data Pipeline for Surface Scratch Detection, arXiv:2607.27065