Henry Ford once noted that “quality means doing it right when no one is looking.” As a pioneer of industrial processes that made the mass production of affordable automobiles possible, quality control is certainly something that he was well acquainted with. But what Ford may not have been able to envision is today’s modern manufacturing techniques that leave humans out of the loop at many stages of production. In such cases, many crucial components of a product are manufactured entirely by automated systems, so there is literally no one looking.
We cannot count on these machines to always do what is right, so to ensure that quality — and the company’s good reputation — are maintained, those components need to be inspected. For large-scale operations, it is not practical for humans to take on this task. In many cases, the pace of manufacturing is too fast for them to keep up. Moreover, people will grow fatigued and miss problems from time to time, and subjectivity can further contribute to inconsistent levels of quality.
Many organizations turn to automated visual inspection systems to prevent their quality levels from slipping. These tools can operate at superhuman speeds and notice even minor abnormalities in components, keeping defective products from ever reaching the hands of customers. Unfortunately, these systems can be very expensive and complex. Maintaining and operating them may require a great deal of time and effort, in addition to the upfront costs.
![](https://www.edgeimpulse.com/blog/content/images/2024/06/image3.png)
But as is so often the case with technology, what was once inaccessible soon becomes commonplace. The key technologies that underpin automated visual inspection systems are presently making this transition, so machine learning enthusiast Roni Bandini decided to build the core of a custom inspection system to demonstrate how accessible the technologies now are. In fact, Bandini showed that with just a few hundred dollars and a free afternoon, anyone can build their own visual inspection system prototype.
Just about anything can potentially go wrong in producing a product, so naive approaches that look for specific defects quickly become impractical. For this reason, Bandini decided to put Edge Impulse’s new FOMO-AD algorithm to work. FOMO-AD utilizes a Gaussian mixture model to detect anomalies in conjunction with the powerful and highly efficient FOMO object detection algorithm. This approach allows one to train the model on only normal instances of an object, after which it will be able to recognize any deviations from that normal state. Furthermore, FOMO-AD can pinpoint the locations in an image where anomalies exist, making the inspection process as painless as possible.
Computer vision algorithms tend to be very expensive computationally, but due to the efficiency of the FOMO-AD model, Bandini was able to easily run it on edge computing hardware to keep costs and latency down. In this case, he selected the Texas Instruments SK-TDA4VM development kit. The onboard TDA4VM processor offers eight trillion operations per second of hardware-accelerated AI processing power, which is well more than what is required for the project. Yet the SK-TDA4VM is also inexpensive and requires little power for operation, making it suitable for large-scale deployments. He then paired the kit with a USB webcam to allow it to capture images of components for anomaly detection.
![](https://www.edgeimpulse.com/blog/content/images/2024/06/image2.png)
To demonstrate a functional system, Bandini chose to look for anomalies in circuit breakers. But note that the exact same methods shown in this project can be adapted to any type of object by simply swapping the training data with the items that you are interested in. Speaking of training data, Bandini got together about 120 images of normal circuit breakers and uploaded them to Edge Impulse.
With the data in hand, it was time to build the impulse, which defines how data is processed. From the time that the camera captures an image until the moment that the machine learning algorithm makes a prediction, the impulse runs the show. For this application, the impulse first reduces image sizes, which has the effect of minimizing the amount of computations that are needed by downstream steps. It then forwards image features into the FOMO-AD algorithm. This learns what normal objects look like during training so that it can output an anomaly score, predicting the likelihood that an anomaly exists.
![](https://www.edgeimpulse.com/blog/content/images/2024/06/image5.png)
After tweaking a few hyperparameters, Bandini kicked off the model training process with the click of a button. After a short time, training was complete and the model was ready. The Model Testing tool was then utilized to determine how well the algorithm was performing. Satisfied with the results, all that remained was for Bandini to deploy the anomaly detection pipeline to the physical hardware.
Bandini then flashed the operating system to an SD card and installed it on the SK-TDA4VM development kit, then installed Edge Impulse for Linux on the board as well. From there, the Edge Impulse Runner could be used to load the impulse on the device and run some tests. Everything was looking good, so Bandini was able to call it wrap just like that. Not so hard, huh?
![](https://www.edgeimpulse.com/blog/content/images/2024/06/image4.png)
As previously mentioned, this pipeline can easily be adapted to detect anomalies for any type of object. But as Bandini notes in the project write-up, you will want to be sure to collect high-quality training data. Poor quality images can cause poor performance in anomaly detection systems. He also discusses some situations where using a pair of anomaly detection systems may be appropriate. For more tips like these, and detailed instructions for building your own anomaly detector, be sure to read the write-up.
Bookmark this for later if you don’t have the time to run through the process right now, but don’t put it off for too long — it won’t take more than a few hours to get a prototype up and running. You can even “borrow” Bandini’s public Edge Impulse project to get a running start.