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

**Authors:** Yi-Cheng Huang, Jun-Chang Lin, Yi-Ze Wu

PMC · DOI: 10.1038/s41598-026-39233-9 · 2026-02-13

## TL;DR

This paper introduces a lightweight, real-time metal surface defect detection system using a modified YOLOv7-tiny model for improved accuracy and speed in industrial applications.

## Contribution

A novel anchor-free YOLOv7-tiny architecture with enhancements for real-time metal surface defect detection is proposed.

## Key findings

- The model achieved a 6.24% increase in mean average precision (mAP) compared to existing methods.
- The improved model operates at over 90 FPS, demonstrating strong real-time performance.
- The architecture effectively handles defects with extreme aspect ratios and small-scale features.

## Abstract

Accurate identification of defect morphology and size distribution on metallic surfaces is crucial for manufacturing, particularly in the steel industry where such materials are widely used. This study proposes a novel lightweight architecture based on YOLOv7-tiny to address the challenges of real-time metallic surface defect detection. The original anchor-based detection head is replaced with an anchor-free mechanism to reduce missed detections of defects with extreme aspect ratios, while a logarithmic transformation–based enhancement is introduced to strengthen defect features. The backbone is replaced by the lightweight MobileNetV3-large network to reduce the number of parameters, and an Efficient Multi-Scale Attention (EMA) module is embedded into the bottleneck structure to increase target importance and suppress background interference, especially for small defects. In addition, a bidirectional feature pyramid network with adaptively spatial feature fusion (BAFPN) is integrated as the Head architecture to provide richer semantic information. The improved model was evaluated on the DAGM 2007, NEU-DET, and GC10-DET datasets, which encompass metal surface defects with varying degrees of complexity. The results demonstrate an average increase of 6.24% in mean average precision (mAP) and an inference speed over 90 FPS, confirming both the efficacy and real-time capability of the proposed method.

## Full-text entities

- **Chemicals:** YOLOv7 (-)

## Figures

27 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12976034/full.md

---
Source: https://tomesphere.com/paper/PMC12976034