Manufacturing defects often lead to not only costly customer returns, but also a tarnished reputation. Even minor flaws can result in significant financial losses and permanently erode customer trust. For reasons such as these, it is in the best interests of manufacturers to have strong quality control processes in place. These days, automated inspection systems are being integrated into these processes at an accelerating rate. By using a computer vision-based inspection system, the risk of flawed products slipping through the cracks and reaching end customers is virtually eliminated.
There are still some industries where automated inspection systems have not yet made much headway. Textile manufacturing, for example, still relies heavily on manual inspections carried out by trained inspectors. This is due in large part to the multitude of problems that can be present, ranging from stains or holes to color variations and weave irregularities. Effectively capturing such a wide range of potential issues with an automated system has proven to be too difficult.
As we all know, humans can be quite subjective in their assessments. Furthermore, we get fatigued and distracted over time and the likelihood that quality problems will be missed increases. Engineer and machine learning enthusiast Naveen Kumar recently came up with a plan that could help to solve this problem in the future, however. He suspected that an anomaly detector might be the ideal tool for the job. These algorithms only need to know what normal products look like, then they can pick out anything that does not fit that mold. This sounds perfect for fabrics, where the potential list of flaws is too great for each to be considered individually.
To test out this theory, Kumar built a proof of concept system to inspect dust cloths for manufacturing defects. At the core of this system is Edge Impulse's FOMO-AD visual anomaly detection algorithm. This algorithm was designed for real-time edge computing applications, making it suitable for inspecting products as they whiz by on an assembly line. And much like the FOMO algorithm it is based on, it has very minimal hardware requirements, which keeps costs under control.
All processing for the device is done locally on a Raspberry Pi 5 single board computer. Textile defects can be very subtle, so he paired this with a Raspberry Pi High Quality Camera to capture high-resolution images of the manufactured goods. This hardware alone would be sufficient to carry out the inspections, but Kumar wanted the setup to be realistic, so he also built a small conveyor system for the fabric to be carried on. He used an M5Stack 6060-PUSH Linear Motion Control module, as well as an M5Stack Atom Lite with an ATOMIC RS485 Base to control its motion. Finally, he added an M5Stack Flashlight Unit in to brightly illuminate the items being inspected and to prevent false positives from shadows or other lighting issues.
With the hardware assembled, Kumar next collected a dataset for the FOMO-AD algorithm to learn from. This process only requires images of normal items, but he also collected a handful of defects like holes and stains to test the model. After creating a new project, he uploaded these images to it using the Edge Impulse CLI. Less than 100 images were captured to prove the concept. (For a real-world application, a larger training dataset would be advisable.)
The next step was for Kumar to define the impulse, which is the series of steps that specify how data will be handled from the time it is captured by the camera until a prediction is made. For this project, that meant downsizing images for computational efficiency before generating features from the raw data and forwarding them into the FOMO-AD visual anomaly detector. The output is a score that predicts the likelihood that an anomaly is present in the image frame.
He trained the model using the previously collected dataset to give the anomaly detector knowledge of what normal dust cloths look like. After that, he used the model testing tool to help assess how well the algorithm was working. It was able to identify both normal cloths and those with defects with 100 percent accuracy, so there was no further room for improvement. Accordingly, it was time to deploy the model to the Raspberry Pi for a little more testing before wrapping up the build.
There are a number of ways to deploy an impulse to a Raspberry Pi, but in this case, Kumar went with a Linux binary that is compatible with 64-bit Arm processors. After downloading it, he developed a Python script to capture images from the camera, run an inference, and display the anomaly detection results on a web page.
When in operation, the Linear Motion Control module moves the cloth along beneath the camera. A web page loaded on a nearby laptop displays the view from the camera, and if an anomaly is detected, the Linear Motion Control module stops moving and the defect is highlighted on the screen with a red box to draw attention to it. During testing, Kumar showed that the system could easily detect even very small defects.
Kumar’s aim in this project was to do nothing less than revolutionize quality control in the textile industry. With the help of FOMO-AD, it looks like he may be well on his way to doing just that. Not only did the inspection system prove to be accurate and fast, but it is also inexpensive and simple to implement. As time goes by, this technology will be hard for manufacturers that are tired of dealing with quality issues to pass up.
If you happen to be someone that is interested in enhancing a quality control process, be sure to check out Kumar’s full project write-up for lots of tips that will help you get up and running quickly. You can even clone the public Edge Impulse project for a head start.