# Few-Shot Steel Defect Detection Based on a Fine-Tuned Network with Serial Multi-Scale Attention
###### Abstract
The efficacy of small-sample object detection lies in its capacity to identify new types of objects with a limited set of labeled images, thereby avoiding the need for extensive datasets. Current methodologies for small-sample detection mainly originates from conventional, robust object detection algorithms, such as Faster R-CNN [7], YOLO [8], SSD [9], and M2 Det [10]. Building upon this foundation, numerous researchers have integrated frameworks from few-shot learning to forge specialized solutions tailored for few-shot object detection. Broadly, these methodologies can be categorized into four main types: metric-learning-based, data-augmentation-based, fine-tuning-based, and meta-learning-based methods [11]. A wide range of effective models have emerged, proving useful across diverse applications. While previous advancements in few-shot object detection have made progress across various domains, their accuracy remains generally low, posing the greatest challenge in the field of few-shot object detection [12]. Furthermore, their application in steel surface defect detection still requires further exploration and expansion. The attention mechanism [13] enables networks to selectively process different parts of encoded semantic vectors or input. It can be compared to how humans concentrate on crucial elements within images or text. In the domain of computer vision, attention mechanisms are generally categorized into three types: channel attention, spatial attention, and cross-domain attention. During computation, the attention mechanism relies on the features of input data, dynamically learning and adjusting the weights of neurons. This empowers networks to focus selectively on pivotal information, thereby enhancing performance and precision. This research is primarily focused on steel surface defect detection, an area filled with inherent challenges that surpass those encountered in other domains of surface defect detection. Firstly, the scarcity of high-quality steel defect samples is compounded by the labor-intensive and costly nature of the labeling process. Moreover, the extensive diversity of surface defect types in steel magnifies the difficulty of recognition and detection, placing higher demands on the models employed in practical applications. Lastly, samples of steel surface defects often contain interfering factors such as dirt and spots, posing challenges and obstacles to the detection of steel surface defects. In response to the aforementioned challenges, this article introduces a novel few-shot object detection network that is anchored on a serial multi-scale attention pyramid. An open-source steel defect dataset was employed to craft a small-sample dataset specific to steel defects, and using this dataset, a fine-tuned object detection network was trained. Through this investigation, the contributions of this paper are as follows:  
(1) In consideration of the vast spectrum of steel surface defects and the presence of additional elements on the steel surface, this study develops an object detection network for small samples based on an attention-feature pyramid. The approach encompasses the idea of multi-scale attention and proposes the serial multi-scale attention mechanism (SMSANet). These two modules are seamlessly integrated into the fine-tuned few-shot object detection network. During the initial phase of base class training, the model is aided by an enhanced SSL algorithm, which improves the model's performance. (2) To address the challenges of limited steel defect samples, difficulty in annotation, and high costs, this experiment utilizes the steel defect detection dataset [14] provided by ServerStal company to construct a few-shot dataset. (3) This study conducts a series of ablation studies to assess the impact of the novel modules, evaluating the extent to which each component positively influences model performance. The rest of this paper is organized as follows.