Posts with «anomaly detection» label

Package Inspection with Anomaly Detection and a VLM on the Arduino UNO Q

Inspecting a parcel before shipping means looking at it, recognising a defect and deciding what to do about it. SolomonGithu’s project does all of this on the Arduino UNO Q: a visual anomaly detection model finds dents, tears and liquid leaks, then SmolVLM-500M describes the defect in natural language. Both models run locally on the board, with no cloud. Package inspection with Arduino thus becomes a self-contained block, ready to be mounted on a packaging line.

The logic is a cascade. The first stage is a detector trained with Edge Impulse Studio and exported as an .eim binary. The second stage is the VLM, which only comes into play when needed. This split reduces false alarms: the lightweight model does the heavy lifting in 31 ms, and the heavy model only speaks up if there really is something to report.

The Edge Impulse detector: 31 ms, 3.3 MB of RAM and 372 KB of flash

Anomaly detection model trained with Edge Impulse Studio

The anomaly detection model is the part that sets the performance figures. On the UNO Q it has an on-device inference time of 31 ms, a RAM peak of 3.3 MB and takes up 372 KB of flash. These are numbers that leave room for the rest of the application, because the board still has to handle the webcam, the web interface and loading the VLM. The model is exported from Edge Impulse Studio as an .eim binary and copied into the /home/arduino/.arduino-bricks/ei-models/ directory of the UNO Q, along with a model.yaml file that describes its configuration.

The reference Edge Impulse project has ID 1030618. Anyone who wants to rebuild it can start from there and replace the dataset with their own images of parcels, then re-export the binary. The vlm_anomaly_threshold threshold decides when the second stage steps in: below that threshold the image is considered clean and the VLM is not loaded.

SmolVLM-500M and the application on App Lab

Deploying the models on the UNO Q

When the anomaly exceeds the threshold, the system loads SmolVLM-500M and passes it the image together with a text prompt defined by vlm_prompt. The processing takes about 29 seconds, during which the UNO Q’s CPU peaks at 99% utilisation. The natural-language answer can be useful to a human inspector or to an AI agent that adjusts operating parameters, for example the gripping force of robots if the parcel is dented.

The application, backend and frontend, is cloned from a GitHub repository and copied into the /home/arduino/ArduinoApps/ directory of the UNO Q. It is started from App Lab with the Run button and opens in the browser at the board’s local IP address on port 7000. The image is chosen from the sample ones in the img folder or uploaded as a JPG or PNG file up to a maximum of 500 KB. Pressing Run Detection starts the anomaly model first and then, if needed, the VLM.

  • Arduino UNO Q as the only computing board
  • Logitech HD Pro webcam connected via USB
  • USB hub powered from the mains
  • Anomaly model exported from Edge Impulse as .eim
  • SmolVLM-500M loaded on-device

To rebuild the project you need an Arduino UNO Q, a USB webcam and a USB hub powered from the mains: the webcam alone can draw more current than the board makes available on a single port. For the computing side, the board from the catalogue with the STM32U585 microcontroller and the integrated processor is the one the project is built on, so no other hardware is needed. The full description of the flow and the files can be found on the SolomonGithu project page on Hackster.io.

The SmolVLM-256M model is a lighter alternative, but according to the author’s tests it shows limits in captioning: it hallucinates text, misidentifies objects and is less reliable at following instructions. The 256M has only 18% of its training data dedicated to image captioning, so the choice of the 500M is not random. Those in a hurry can still try it, accepting less precise descriptions.

Source: https://www.hackster.io/sologithu/genai-on-arduino-uno-q-spots-and-describes-anomalies-5d1a49

The post Package Inspection with Anomaly Detection and a VLM on the Arduino UNO Q appeared first on Open Electronics.

Turn Arduino® UNO™ Q into your local 3D printing watchdog

A lot of newer 3D printers incorporate sophisticated sensor suites and cameras to detect problems with print jobs, like the dreaded “spaghetti failure.” Those work pretty well and prevent wasted time, wasted filament, and even damage to the printer. But what if you don’t have a printer with those features? Or if you want to protect your privacy? Then you can follow Philipp Schweizer’s guide to use an Arduino UNO Q as your local 3D printing watchdog.

Schweizer’s approach is to use the UNO Q and a camera to detect anomalies, rather than specific problems. It doesn’t look for spaghetti failure or clogging. Instead, it looks for a normal print. Anything abnormal gets flagged. That dramatically reduces the amount of training data required and accounts for all visible issues, whether they were anticipated and trained for or not.

The hardware required for this includes an UNO Q (4GB model), an Arduino®UNO Media Carrier, an V2-style IMX219 camera module, and a custom-printed mount with fasteners. The goal with that mount is to point the camera at the hot end and below, so it will likely require customization to fit the 3D printer model in question.

All of the magic happens thanks to the FOMO-AD anomaly model from Edge Impulse, implemented through Arduino App Lab. That requires training on images of normal prints and Schweizer explains how it is easy to collect those automatically during print jobs. By keeping the image resolution low (632×480), the overhead remains minimal and the model efficient.

As Schweizer points out, an overeager watchdog is worse than not having a watchdog at all. For that reason, Schweizer built his app so that it only automatically pauses a print if at least three out of the last four images show an anomaly. When that is the case, it pauses the job through the Moonraker API (standard for Klipper-based systems). For those who don’t use Klipper, it is possible to integrate the watchdog into Octoprint or other control software. It also sends an MQTT message compatible with Home Assistant for notifications and hosts a webpage where the status is visible.

All of that works without leaving the local network, so it is great for those who value privacy and security. Even if those factors don’t concern you, this is an affordable watchdog solution that doesn’t require a specific 3D printer model or a subscription service.

The post Turn Arduino® UNO™ Q into your local 3D printing watchdog appeared first on Arduino Blog.