← Latest papers
💻 computer science

DRL-Guided Neural Batch Sampling for Semi-Supervised Pixel-Level Anomaly Detection

This paper proposes a semi-supervised deep reinforcement learning framework that integrates a neural batch sampler, autoencoder, and predictor to achieve superior accuracy and localization in industrial pixel-level anomaly detection with limited labeled data, outperforming state-of-the-art methods on the MVTec AD dataset.

Original authors: Amirhossein Khadivi Noghredeh, Abdollah Safari, Fatemeh Ziaeetabar, Firoozeh Haghighi

Published 2026-08-18
📖 8 min read🧠 Deep dive

Original authors: Amirhossein Khadivi Noghredeh, Abdollah Safari, Fatemeh Ziaeetabar, Firoozeh Haghighi

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the factories that build everything from circuit boards to food packaging, quality control is a relentless game of finding the one thing that does not belong. For decades, machines have been trained to spot these flaws, but they face a fundamental problem: they are rarely shown what a broken product looks like. Defects are rare, expensive to create, and often subtle, like a hairline scratch on a polished surface or a tiny chip in a glass component. Because of this scarcity, engineers have traditionally taught computers to learn only the shape of a perfect item. The computer memorizes what "normal" looks like, and when it sees something that deviates from that memory, it flags it as a defect. However, this approach has a blind spot. If a computer learns too perfectly what a normal item looks like, it can become confused by the very small, quiet errors that matter most, or it might simply ignore them because they do not look like the big, obvious mistakes it was trained to expect.

A team of researchers from the University of Tehran has proposed a new way to solve this puzzle, one that moves beyond simply memorizing perfection. Instead of relying on a static memory of what is normal, they created a system that actively learns to hunt for trouble. Their method, detailed in a recent study, combines three distinct tools into a single, self-improving loop. First, a digital "scout" moves across an image, deciding which small sections are worth a closer look. Second, a reconstruction engine tries to rebuild those sections from memory, highlighting where the memory fails to match reality. Third, a classifier learns to read those failures and draw a precise map of the defect. By letting these three parts talk to each other, the system learns to find subtle anomalies with a level of accuracy that previous methods struggled to achieve, all while using only a handful of known defective examples to guide the process.

The core of this new framework is a digital agent that acts like a curious inspector. In traditional systems, a computer might scan an entire image at once or look at random patches without a plan. This new agent, however, uses a technique called reinforcement learning, which is essentially a trial-and-error learning process driven by rewards. Imagine a person walking through a large warehouse looking for a specific type of damage; they do not walk in a straight line or check every single box randomly. Instead, they look for clues, decide which area seems most suspicious, and then move their attention there. This digital agent does the same thing. It looks at an image and decides which small square to examine next based on what it has learned so far. If it picks a spot that helps the system understand the difference between a good part and a bad one, it receives a reward. If it picks a spot that adds no new information, it learns to avoid that area in the future. This allows the system to focus its energy on the most informative parts of the image, rather than wasting time on areas that are clearly perfect.

Once the agent selects a patch, it is passed to a reconstruction engine, which is a type of neural network designed to rebuild images. This engine has been trained extensively on perfect, defect-free samples. When it receives a patch from a good part of the product, it can rebuild it almost perfectly. But when it receives a patch containing a scratch or a chip, it struggles. Because it has never seen that specific flaw during its training, it cannot reconstruct it accurately. The difference between what the engine sees and what it rebuilds creates a "loss profile," a map of errors that glows brightly where the defect is hidden. This map is the key to the system's success. Instead of trying to guess the defect directly from the raw image, the system analyzes this map of reconstruction errors, which often makes even the tiniest flaws much easier to see.

The final piece of the puzzle is a predictor, a specialized network that takes these error maps and turns them into a clear, binary decision: this pixel is good, or this pixel is bad. What makes the researchers' approach unique is how these three components—the scout, the engine, and the predictor—learn together. In many previous attempts at similar systems, the parts were trained separately or relied on rigid rules that limited their ability to adapt. Here, the system uses a semi-supervised approach, meaning it learns from a large pool of normal data and a very small set of labeled defective data. The researchers found that by removing certain complex mechanisms used in earlier versions and simplifying the way the predictor learns, the system became more stable and better at generalizing to new types of defects. The agent learns to balance two competing needs: exploring new areas of the image to find unknown trouble spots, and exploiting the areas it already knows are suspicious to refine the detection.

The results of this approach were tested on a widely used collection of industrial images known as the MVTec AD dataset, which contains high-resolution photos of various objects and textures, from cables and toothbrushes to pills and wooden boards. The researchers compared their method against several leading techniques, including standard deep learning models and other advanced reconstruction-based systems. The new framework consistently outperformed these competitors. On average, it improved the ability to correctly identify and locate defects by a significant margin. In the most challenging cases, where the defects were extremely subtle, the new method showed a dramatic improvement, achieving higher accuracy scores than other systems and detecting flaws that previous methods had struggled to localize effectively. For instance, in tests involving transistors and toothbrushes, the system's accuracy jumped well above the previous best results, proving that the adaptive sampling strategy effectively targeted the right areas.

Beyond just finding the defects, the system also excelled at pinpointing exactly where they were. In industrial settings, knowing that a product is flawed is not enough; the machine must know exactly which part of the surface is damaged so it can be repaired or discarded. The researchers demonstrated that their method produced cleaner, more precise maps of the damage. The visual results showed sharp boundaries around scratches and clear definitions of missing parts, even in complex textures like wood grain or metal grids. This precision is crucial because it reduces the number of false alarms, where a perfect item is mistakenly rejected, and ensures that real defects are not overlooked. The system achieved this high level of performance without requiring massive amounts of labeled defective data, which is often the biggest bottleneck in industrial automation.

The study also highlighted the importance of how the system was trained. The researchers found that if the different parts of the system were not introduced to each other in the right order, the whole process could become unstable. They developed a specific training schedule where the reconstruction engine learned first, followed by the predictor, and finally the agent that selects the patches. This step-by-step approach allowed each component to stabilize before taking on the added complexity of the others. By the end of the training, the system had learned a sophisticated strategy for scanning images, one that was far more efficient and effective than simply scanning everything or relying on random guesses. The researchers noted that while the system is more complex to set up than a simple scanner, the trade-off is a much more robust and reliable detector that can handle the subtle, real-world variations found in actual factories.

This work represents a shift in how machines learn to see. Instead of trying to force a computer to memorize every possible way a product can break, the researchers taught it to be curious. By giving the system the ability to choose what to look at and how to learn from its mistakes, they created a tool that is both powerful and adaptable. The findings suggest that the future of quality control may not lie in bigger databases of broken parts, but in smarter algorithms that know how to find the needle in the haystack by learning to look in the right places. The success of this method on a diverse set of industrial images indicates that it could be a valuable tool for manufacturers looking to improve their inspection processes without the prohibitive cost of collecting thousands of defective samples.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →