
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.

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.




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.
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 FaceThe 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.
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.
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).









How the cascade runs

- 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.

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.




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 detector



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 YouTubeReferences
- 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