Skip to main content


Few-Shot Learning Speeds AI Model Training and Inferencing

Few-shot learning

To increase profitability, optimize production, and succeed in a highly competitive business landscape, manufacturers increasingly turn to computer vision technology. But developing solutions that work on the factory floor is an extremely complex and time-consuming process.

That’s because the AI algorithms that computer vision models use to assemble products or spot defects in parts and machinery require heavy training. While pre-trained models are available, they are almost never accurate enough for deployment. And training custom models usually requires huge data sets, skilled workers to guide the training, and months of effort.

It’s a serious development bottleneck for manufacturers looking to implement vision-enabled solutions, and it hampers digital transformation in the sector. But a new approach to AI model training called “few-shot learning” may hold the key to deploying AI solutions much faster.

How Few-Shot Learning Speeds AI Model Training

To see why few-shot learning is such a game changer, it’s useful to understand how computer vision models are usually developed.

Typically, a custom AI model begins with a pre-trained model. Take, for example, a picking use case in an assembly line setting. A development team might start with a generalized computer vision model for object recognition. But that model wouldn’t be able to identify specific components used by the company. To make it accurate enough for deployment, developers often take an approach called “supervised learning,” providing the AI model with annotated training data to help it learn what a particular part or defect can look like and differentiate it from another.

But this task often requires thousands of images. In supervised learning scenarios, the images must also be labeled by domain experts (“this is a widget, this is not”) to teach the model what it needs to know. It’s an expensive, labor-intensive task, because skilled employees must first annotate the images and then tune the model’s hyperparameters over multiple rounds of training.

“Even under the best of circumstances, supervised learning can involve many hours of skilled labor and take months to complete,” explains Lu Han, an Algorithm Researcher at Lenovo Group, a global computing intelligence company.

In some scenarios, supervised learning may not be feasible. For instance, if a manufacturer needs to train a model to spot a new type of part defect, there may not be enough images of faulty parts to use in customizing the model.

Few-shot learning overcomes such challenges by taking a different approach. The “shot” in “few-shot learning” refers to the number of examples of a type of object that a model is given during the training process.

In this process, the AI may be taught to identify the degree of similarity or difference between objects in general. This capability can then be applied to matching a never-before-seen object to a small number of reference examples. For a simplified instance, a model might be given labeled images of nuts, bolts, and screws, with two examples from each category, plus a test image of a bolt, and then be asked to predict which of the three object categories the test image of the bolt most nearly resembles.

Few-shot learning requires far fewer labeled images to customize an AI model—just a few dozen instead of several thousand—and generally takes days or weeks instead of months. The result is a greatly simplified AI development workflow that already helps companies deploy AI solutions more quickly than ever before.

A Few-Shot Learning System for Defect Recognition

Case in point: Lenovo’s defect-recognition implementation at a textile manufacturer.

For quality assurance, the manufacturer had to be able to identify more than 80 different types of surface defects in the textile products they made. Manual inspection did not achieve the desired level of quality control.

The company hoped to develop an AI-powered defect recognition solution but faced several prevalent implementation barriers. Customized model training would be difficult because they had very few defect samples to work with. In addition, they made a wide variety of products using the same production line, so any AI solution would have to be able to quickly update its models at the edge as products and materials changed. Using a traditional training approach, it would take an estimated six to 12 months to construct a working AI solution—an unpalatable time frame, and one that augured poorly for future iteration.

Lenovo, a leader in smart manufacturing, has incubated the Lenovo Edge AI direction within its research division, Lenovo Research. It has strong technical capabilities to solve the above-mentioned difficulty. Working with the manufacturer, Lenovo EdgeAI developed an end-to-end computer vision defect recognition solution using few-shot learning techniques. The initial training and local updates of the model were completed in just one week. The accuracy was impressive: zero missed detections in key items.

The result is a greatly simplified #AI development workflow that’s already helping companies deploy AI solutions more quickly than ever before. @Lenovo via @insightdottech

To reduce latency and enable local management, Lenovo ran the AI inferencing workloads on an edge industrial personal computer (IPC). This enabled near real-time switching between the different AI models used for various product types. It also allowed factory quality assurance workers to retrain models on-site to accommodate for future product modifications or newly appearing defects.

Lenovo credits its technology partnership with Intel in helping to deploy the solution effectively. “Our system uses Intel chips, which provide powerful computing resources in the kind of edge scenarios needed by our customers,” says Han.

Lenovo also used the Intel® OpenVINO toolkit. Han says, “Our inference engine is widely compatible with various toolkits, especially OpenVINO. For inferencing, running on Intel silicon can support around 20 edge AI models. Many of our customers prefer devices built on Intel chips, helping us bring this solution to market more quickly.”

Accelerating Industry 4.0 with Few-Shot Learning

Because few-shot learning is an effective strategy for speeding AI solutions development, it will likely become an attractive choice for solutions developers, systems integrators (SIs), and manufacturers. It could also help lower costs, since few-shot systems can more easily be retrained to adapt to operational changes like new-product models or never-before-seen defects.

As AI uptake increases, the industrial AI ecosystem is likely to mature as well, with SIs and solutions developers offering comprehensive service and consulting packages. Lenovo already markets its defect detection system as an end-to-end solution, with full-lifecycle service packages and subscription-based support for the software.

“Computer vision is becoming indispensable in manufacturing,” says Han. “Few-shot learning helps companies implement innovative computer vision-based solutions faster, speeding their digital transformation and realizing ROI sooner. Both computer vision and few-shot learning have a bright future in this sector.”

This article was edited by Teresa Meek, Contributor for