Skip navigation

Defect detection with image analysis


Image classification is a popular area of artificial intelligence. One application of image classification that’s already being used in industry is the detection of quality issues on assembly lines during manufacturing. In a typical production line, components travel down the assembly line from one station to another, at the end of which an inspector steps in to look for problems—a manual and error-prone process. AI-driven image classification reduces human effort and automatically classifies images as pass or fail. This improves not only the efficiency of the human operators in the validation process, but also the quality of the overall manufacturing process.

Preparing data

When preparing your data for an image classification solution, you need two sets of images to train your model: one to represent pass examples and one to represent fails. These images can be either chosen from a generic dataset such as Kaggle or customised-made for your business. Consider having homogeneous images; for example, a set of similarly sized JPG files at the same scale resolution. Preparing the data also requires dividing the images into training and validation sets.

Build and train

Once you have a homogeneous and organised set of images, the data is read into an analytics engine. Neural networks and transfer learning are good ways to handle image data in AI solutions. Transfer learning lets you use trained models that already know how to classify an image. An existing model may perform a certain task very well—for example, detecting people or cats. However, the task it was trained for probably differs from the specific scenario you’re solving for. Retraining an existing model is usually much faster than starting from scratch, so transfer learning substantially shortens the training process. Finally, in image classification, a neural network is sometimes paired with a secondary model to provide the final prediction. For example, a convolutional neural network architecture with 50 hidden layers can be used to process the image. Pair it with a boosted decision tree to classify the image as pass or fail.


Once a trained image classification model is ready, the model can be deployed as a web service with a REST endpoint. Analytics dashboards and alerts can call the web service for information and predictions. Because image processing tends to be computationally expensive, many similar solutions make use of cloud-based cluster deployments that can be scaled when needed. A service such as Azure Machine Learning can assist with this, creating a REST endpoint easily deployed to an Azure Kubernetes cluster.

Customers are doing great things with AI