Clear Sky Science · en

Design of lightweight metal surface defect detection technology for YOLOv7-tiny using Anchor-Free algorithm

· Back to index

Why tiny flaws in metal matter

From the body of a car to the beams in a skyscraper, sheets of steel are everywhere. Yet hairline cracks, faint scratches, or tiny pits on these metal surfaces can quietly weaken parts, shorten their lifetime, and cost manufacturers money. Inspecting every square centimeter by eye is slow and error‑prone, so factories are turning to artificial intelligence to spot flaws automatically as steel rushes past on production lines. This paper presents a faster, lighter computer‑vision system designed to catch even very small, hard‑to‑see defects on metal surfaces in real time.

Figure 1
Figure 1.

How cameras and smart software watch steel

Modern defect inspection relies on digital cameras and deep learning: software that learns patterns directly from images. A popular family of such systems is known as YOLO, short for “You Only Look Once,” which scans an image in one pass and draws boxes around objects of interest. The authors build on a compact version called YOLOv7‑tiny and adapt it specifically for industrial steel inspection. Their goal is to keep the model small and fast enough to run on limited hardware while still detecting a wide range of flaws—from thin weld lines and creases to round pits and stains—on moving steel strips and plates.

Seeing defects without pre‑set boxes

Earlier YOLO versions rely on “anchor boxes,” a set of predefined shapes the model uses as starting guesses for where objects might be. While convenient, these preset shapes struggle with extreme cases, such as very long, thin cracks or very tiny specks, and can simply miss them. The new system switches to an “anchor‑free” approach: instead of starting from fixed boxes, it learns to focus on the center of a defect and then predicts how far its edges extend in four directions. This change makes the detector more flexible and better suited to the odd shapes and sizes that real defects present, especially in heavy industry.

Making faint flaws stand out

On many steel surfaces, defects are barely brighter or darker than their surroundings; they can blend into the metallic grain like a smudge in fog. To help the computer see what people might miss, the authors apply a two‑step contrast‑boosting process before detection. First, they use a logarithmic transformation that expands differences in the bright parts of a grayscale image—where both steel and defects often cluster—while compressing darker regions. Then they stretch the resulting brightness range back across the full scale. Together, these steps sharpen subtle textures linked to flaws while keeping background patterns subdued, giving the detector clearer visual cues to work with.

Figure 2
Figure 2.

Smaller brain, sharper focus

To keep the system lightweight, the researchers replace YOLOv7‑tiny’s original core with a more compact network called MobileNetV3‑large, originally designed for smartphones and embedded devices. This “brain” uses specialized building blocks to reduce the number of computations without losing much accuracy. On top of that, they add an attention module that learns to emphasize important regions—such as tiny defects—while ignoring irrelevant background. A special feature pyramid structure then blends information from different image scales, so the system can recognize both small and large flaws in the same frame. The team also carefully re‑labeled two public defect image datasets to correct missing or imprecise markings, ensuring the system learned from cleaner examples.

How well the new system performs

The improved detector was tested on three widely used metal‑defect datasets that range from simple, synthetic patterns to complex real‑world steel strips. Across these benchmarks, the new design increased a key accuracy measure by about six percentage points on average compared with the standard YOLOv7‑tiny model, while still processing more than 90 images per second—fast enough for real‑time inspection in many factories. It also compared favorably with a range of state‑of‑the‑art detectors, achieving higher accuracy than several heavier and newer models when all were trained on the same refined steel‑defect data.

What this means for everyday products

In plain terms, the study shows that it is possible to build a compact, efficient vision system that reliably spots very small, oddly shaped flaws on fast‑moving metal surfaces. By combining smarter defect highlighting, more flexible box prediction, better attention to tiny details, and careful data cleanup, the authors deliver a tool that can help steel makers catch more problems before products reach the road, the factory floor, or the construction site. The result is a practical step toward safer, more reliable metal parts—and toward factories where intelligent cameras quietly guard quality in the background.

Citation: Huang, YC., Lin, JC. & Wu, YZ. Design of lightweight metal surface defect detection technology for YOLOv7-tiny using Anchor-Free algorithm. Sci Rep 16, 8601 (2026). https://doi.org/10.1038/s41598-026-39233-9

Keywords: metal surface defects, automatic visual inspection, real-time object detection, lightweight deep learning, industrial quality control