So many things in food production could go wrong: from fruits and vegetables getting moldy to insects and small animals invading bagged salads and packaged pastry. Let’s look how utomated visual inspection helps prevent these faults from coming into customers’ view.

Discovering a rotten apple, a moldy cherry or a nasty insect in the produce section of a supermarket may ruin customers’ appetite and reverse their decision to buy a product. Discovering such things in a restaurant may even lead to unpleasant legal consequences. That’s why it’s vital for a food company to ensure proper visual inspection of their product before it reaches a customer.

With the pace of life speeding up, so does food production and foodservice. The same applies to food quality inspection, which is becoming ever more challenging. A conveyor belt’s dead run doesn’t leave enough time for a human to examine items thoroughly, and human inspectors gradually get replaced by machine-learning-based automated visual inspection (AVI).

What is Automated Visual Inspection?

An automated visual inspection system (also called automated optical sorting system) combines special equipment with image analysis software to detect and discard any defective items. In addition, it can sort products into several classes according to their characteristics (size, shape, maturity, etc.).


  • Visual inspection equipment usually consists of three main parts:

Feed system

  • Spreads items evenly and moves them at a constant speed, so that the optical system could capture frames of individual items.

Optical system

  • Consists of a specifically adjusted lighting source and a sensor (usually, a digital camera). The optical system captures images of inspected items so that the software can process and analyze them.

Separation system

  • Removes defective items and/or grades and separates products into several categories according to their quality.


The software part of an automated visual inspection system features state-of-the-art image analysis algorithms. These algorithms process images to adjust their quality, locate interesting points and regions, and, finally, make a decision based on the features found.

Modern AVI systems are based on machine learning algorithms. Trained on thousands of images of, for example, pastries, a machine-learning algorithm gradually learns to detect any meaningful deviations from a “normal” appearance of a pastry dessert. When the training is completed, such an algorithm becomes an irreplaceable tool for quality control in the bakery industry, detecting color, size and shape defects, and more.

Machine learning is widely used today in image analysis, from reading barcodes on parcels to teaching self-driving cars to maneuver in crowded streets.

Speaking about quality control of food, machine-learning algorithms, such as convolutional neural networks, support vector machines, Bayesian classifiers, etc., are already employed to solve inspection challenges.

Notably, with technology advances, their implementation becomes easier every year. For example, recently a Japanese engineer designed and implemented a system to grade and sort cucumbers right at his farm. The system is based on deep neural networks and classifies cucumbers according to their color, size, and shape.

How to Get an AVI System?

The most important part, as always, is to find reliable consultants. There are many factors to consider before designing a food AVI system: lighting conditions; the number of products to inspect; types of defects to look for, etc.

An automated visual inspection system can be an integral part of a food production line or feature a standalone system. What to choose depends on the existing processes. For example, adding a digital camera and a sorting mechanism to an existing conveyor belt may be easier than installing entirely new machinery.

Speaking about the software part, it’s always a custom solution tailored to the specific inspection needs (say, a neural network trained to inspect cans of a particular manufacturer). Still, the software can be based on existing open source libraries and frameworks (such as OpenCV and Caffee), which substantially reduces the price of a complex AVI system.

Is The Future Already Here?

Machine learning is revolutionizing our daily and working routine here and now. From Google search by image to complex industrial systems ensuring product quality—computer vision makes our lives easier undertaking the most mundane and/or complex tasks. And it is possible that very soon visual quality inspection tasks will be mostly machine-based, allowing humans to focus on more sophisticated tasks.

Oksana Bandura is a general radiologist with 3-plus years of experience in dental radiology. Now she works as a medical and industrial image analysis researcher at ScienceSoft, an IT consulting company. Based on her knowledge and skills gained in clinical radiology, as well as working experience in IT, Oksana monitors computer-aided diagnosis industry and writes articles on the state of the art in computer vision and its applications in healthcare. For more information, email her at
Food Safety, Outside Insights, Story, Technology