# DScanNet: Packaging Defect Detection Algorithm Based on Selective State Space Models
However, YOLO often suffers from insufficient detection accuracy when dealing with the task of small target detection because small targets occupy fewer pixels in the image and their features are not obvious. To solve this problem, researchers have proposed a variety of improvement strategies based on transformers, including a multi-scale feature fusion and attention mechanism. For example, [PERSON] et al. [8] proposed the SwinYOLOv7 model, which achieves 96.59% ship detection accuracy by combining the YOLOv7 framework, feature pyramid network and swin transformer with an anchorless detection algorithm. [PERSON] et al. [9] proposed YOLO-Faster, an enhanced lightweight remote sensing target detection network, which solves the problem of detecting small-scale targets that are more difficult to detect in large and complex backgrounds through lightweight design, adaptive multi-scale feature fusion, and decoupling of the detection head. [PERSON] et al. [10] introduces the small target feature enhancement module (STFEM) and transformer-based Jump Connected Path Aggregation Network (Tr-PANet) in YOLO, fully extracts the contextual information of the small targets, and uses the self-attention mechanism to model the non-local contextual features of the small targets, which maximizes the retention of the global structural information in the small targets and solves the problem of low accuracy of small target detection. [PERSON] et al. [11] embedded a novel prior enhancement transformer (PETNET) module and a One-to-Many Feature Fusion (OMFF) mechanism in YOLO networks to improve the performance of target detection for aerospace images. The above studies can indeed enhance the model's ability to detect small targets, but these methods require complex network structures and large computational resources. Subsequently, more researchers started to use hybrid architectures, such as MobileViT [12], EdgeViT [13], and EfficientFormer [14], to reduce model complexity; however, such hybrid architectures degrade model performance. Therefore, finding a balance between performance and speed has been a concern for researchers [15]. To solve the above problems, this paper designs a both efficient and accurate small target defect detection model, DSCanNet, based on the YOLO framework to improve the accuracy and efficiency of small target defect detection. The main contributions of this paper are as follows:* We propose the DScanNet model, a detection algorithm based on deep learning and selective state-space models, to successfully design an efficient model for defect detection in logistics packaging. A new technical solution is provided to solve the real-time defect detection problem. * The multi-scale enhanced feature extractor (MEFE Block), PCR, Mampa Block, and local feature extraction module (LFEM Block) modules are proposed. MEFE Block captures the detailed features and contextual information in the image better through multi-scale feature extraction, PCR optimizes the feature extraction process and reduces redundant computation through partial convolution, Mampa Block optimizes the model by using Mampa's linear complexity, and LFEM Block fully extracts the local spatial information. Block optimizes the model using the linear complexity of Mampa, and LFEM Block fully extracts the local spatial information. These modules work in concert to effectively improve the model's ability to capture and focus on defective features and enhance the detection accuracy. * Based on the current shortage of packaging defect datasets, we conducted experiments on our own dataset BIGC-LP. After a large number of experiments, our proposed algorithm performs excellently on the defect dataset. Compared with the mainstream detection algorithms, the accuracy is as high as 96.8%, which is an obvious advantage in detection accuracy; at the same time, the number of model parameters and computation volume are effectively controlled, which achieves a good balance between performance and efficiency.