4. Results and Discussion
4.1. Comparison of Attention Mechanisms
To investigate the impact of different attention mechanisms on detection performance, four mainstream attention modules—SE, CBAM, CA, and Shuffle—were integrated into the YOLOv8n model separately, while keeping the rest of the network architecture unchanged. The detection performance of these variants was then compared using the same dataset.
As shown in
Table 3, the introduction of all attention mechanisms improved model performance, particularly evident in the mean average precision metrics mAP@0.5 and mAP@[0.5:0.95]. Among them, the SE module exhibited the best performance, with both precision (P) and recall (R) increasing to 94.3%, mAP@0.5 rising to 93.5%, and mAP@[0.5:0.95] reaching 39.6%, ranking first among the four modules. This indicates that its channel recalibration mechanism is effective in enhancing attention to small defect targets in printed materials.
CBAM and Shuffle modules also demonstrated good performance in terms of precision and recall, with mAP values comparable to SE, indicating that the incorporation of spatial attention or feature shuffling structures can also enhance detection capability. In contrast, the CA module showed limited improvements, particularly with no significant advantage observed in mAP@[0.5:0.95].
Overall, incorporating attention mechanisms enhances the model’s ability to recognize small defects under complex backgrounds. Notably, the SE module achieved the best performance across multiple metrics, confirming its effectiveness in channel feature enhancement.
4.2. Comparison of Loss Functions
To evaluate the performance improvement introduced by the EIoU loss function, the original CIoU loss in YOLOv8n was replaced with WIoU-V3, GIoU, and EIoU. Model performance metrics were then compared under a consistent experimental setup. As shown in
Table 4:
As shown in
Table 4, for the Precision (P) metric, all three improvements showed enhancements over the baseline model, with EIoU exhibiting the most significant increase, reaching 94.1%. In terms of Recall (R), EIoU also achieved the highest value of 95.0%, representing a 0.8-percentage-point improvement over the original model, indicating stronger robustness in object completeness regression.
Regarding detection accuracy, WIoU-V3 and GIoU showed slight improvements in mAP@0.5 to 93.1% and 93.2%, respectively, whereas EIoU further increased it to 93.8%. For mAP@[0.5:0.95], EIoU achieved 39.6%, marking a 0.5-percentage-point improvement over the baseline.
Overall, although WIoU-V3 and GIoU showed improvements in certain metrics, EIoU outperformed them across precision, recall, and both mAP metrics. This confirms its superior capability in fitting bounding box positions and scales, making it particularly suitable for high-precision detection of small defect targets in printed materials. Therefore, EIoU was ultimately adopted as the regression loss function for YOLOv8n.
4.3. Detection Results by Defect Type: Before vs. After Optimization
To further validate the detection capability of the proposed optimization strategy across different types of printed defects, three representative defect categories—cracks, missing prints, and spots—were selected. Precision and recall were compared between the original YOLOv8n model and the optimized YOLOv8n model, with the results presented in
Table 5.
As shown in
Table 5, the optimized YOLOv8n model achieved consistent improvements in detection performance across all defect categories:
For Cracks, the optimized model achieved a precision of 98.5% and a recall of 96.8%, representing a 2.6-percentage-point improvement in precision over the original model (95.9%, 96.5%). This indicates that the optimized model possesses stronger discriminative capability in modeling boundary details.
For missing print defects, the optimized model achieved a precision of 97.9% and a recall of 96.4%, showing higher consistency and detection stability compared to the original YOLOv8n model (95.0%, 96.3%). This demonstrates improved robustness when handling low-contrast targets.
For Spot defects, which are relatively more challenging, the optimized model still achieved a slight precision increase from 89.4% to 89.5% and an improvement in recall from 89.7% to 90.5%, indicating that the optimization strategy also has potential to enhance detection of small targets with low-texture contrast.
4.4. Ablation Study
To evaluate the specific performance improvements contributed by the EIoU loss function and SE attention mechanism in the proposed optimization strategy, an ablation study was conducted. Based on the YOLOv8n model, three configurations were tested: incorporation of EIoU loss, integration of SE attention, and the combination of both. The impact of each configuration on detection accuracy was assessed. The experimental results are presented in
Table 6.
As shown in
Table 6, the original YOLOv8n model achieved a precision (P) of 93.2%, recall (R) of 94.2%, and a mean Average Precision at IoU 0.5 (mAP@0.5) of 92.8%. After incorporating the EIoU loss function, the model’s bounding box regression capability was enhanced, with precision increasing to 94.1%, recall to 95.0%, and mAP@0.5 to 93.8%, indicating that EIoU positively optimizes object localization performance. Furthermore, introducing the SE attention mechanism also improved model performance, particularly in the comprehensive metric mAP@[0.5:0.95], which increased from 39.1% to 39.6%, demonstrating the effectiveness of the SE mechanism in enhancing channel feature representation.
When EIoU and the SE mechanism were combined, the model achieved optimal overall performance, with precision reaching 95.1%, mAP@0.5 at 94.1%, and mAP@[0.5:0.95] at 39.6%. This confirms the synergistic effect of EIoU loss and SE attention, as they respectively enhance model performance in bounding box regression accuracy and channel feature responsiveness, exhibiting complementary benefits. Therefore, both the proposed EIoU and SE modules independently improved object detection performance, and their combined use produced more stable and significant enhancements, providing an effective pathway for subsequent model optimization. As shown in
Figure 5, the proposed method can detect various defects such as missing prints, cracks, and spots in printed materials, intuitively demonstrating the detection performance of the improved model on real samples.
4.5. Comparison with Other Models
To further evaluate the effectiveness of the proposed optimization strategy in printing defect detection, this study conducted a comparative analysis with current mainstream object detection models, including YOLOv3-tiny, YOLOv5s, YOLOv6s, YOLOv8s, and YOLOv8m. The analysis focused on comprehensive performance in terms of accuracy and efficiency, with the optimized YOLOv8n model included for evaluation. The experimental results are presented in
Table 7.
As shown in
Table 7, YOLOv3-tiny has an advantage in lightweight design (model size 23.2 MB, 18.9 GFLOPs), but its accuracy remains relatively low (mAP@0.5 = 92.4%), which is insufficient for high-precision industrial inspection requirements. YOLOv5s and YOLOv6s achieved a balance between model complexity and inference speed. Notably, YOLOv6s reached a maximum inference speed of 145.6 FPS with relatively low computation (11.8 GFLOPs), demonstrating strong real-time capability. However, its detection accuracy (mAP@0.5 = 92.1%) remained suboptimal.
Overall, the YOLOv8 series outperformed previous models in accuracy. YOLOv8m achieved an mAP@0.5 of 93.4%, but its computational cost and model size increased substantially (78.7 GFLOPs, 49.6 MB), limiting practical deployment. YOLOv8s reduced model size and computation to some extent, yet its inference speed offered no significant advantage.
In contrast, the proposed optimized YOLOv8n model achieved the best overall performance while remaining lightweight. The model contains only 3.02M parameters, requires 8.1 GFLOPs, and has a size of 6 MB, yet exhibits significant accuracy improvements, achieving an mAP@0.5 of 94.1% and precision of 95.1%. Its inference speed reaches 100.2 FPS, meeting the dual requirements of real-time processing and high accuracy for high-speed printing production lines. In summary, the optimized YOLOv8n demonstrates advantages in detection accuracy, inference speed, and lightweight design, highlighting its strong potential for practical engineering applications.
To visually illustrate the comprehensive advantages of the optimized YOLOv8n model in terms of accuracy, computational cost, and model size,
Figure 6 compares key detection metrics—precision (P), recall (R), and mAP@0.5—across mainstream models, overlaid with GFLOPs to depict computational complexity. As shown, the optimized YOLOv8n achieves excellent performance with only 8.1 GFLOPs and a 6 MB model size, reaching 95.1% precision, 94.3% recall, and 94.1% mAP@0.5, outperforming YOLOv3-tiny, YOLOv5s, YOLOv6s, and YOLOv8s. These results confirm the effectiveness of the proposed optimization strategy and its strong potential for industrial deployment.
As shown in
Figure 6, the improved YOLOv8n outperforms the comparison models in Precision, Recall, and mAP@0.5. Despite requiring only 8.1 GFLOPs of computation and 6 MB of storage, it still achieves an inference speed of 100.2 FPS, demonstrating an outstanding balance between accuracy and computational complexity. Based on these results, the following section discusses the engineering and industrial implications of the proposed method from the downstream production perspective of the “forest–wood–pulp–paper–printing” value chain, with a particular focus on wood-based manufacturing processes.
4.6. Results Discussion and Industrial Implications
(1) Material efficiency: The improved YOLOv8n enhances the detection rate and localization accuracy of small defects, enabling timely identification and handling during production and reducing scrap and rework. Under equal production output, the consumption of pulp, paper materials, and release liners per qualified product decreases. Without increasing model complexity, the proposed method achieves material efficiency improvement in the printing stage, aligning with the resource-saving goals of the wood-based value chain.
(2) Energy consumption and carbon intensity: The energy use and emissions across the forest–wood–pulp–paper–printing chain exhibit a cumulative effect. With the improvement in yield brought by online quality inspection, the energy consumption and carbon intensity per unit of output are reduced accordingly. This outcome is consistent with the decarbonization pathways of the wood-derived circular bioeconomy.
(3) Cross-category transferability: The proposed strategies for small-target enhancement and channel attention can be extended to defect recognition tasks on wood and board surfaces. Related studies have already verified the effectiveness of improved YOLO models in wood-based scenarios, indicating strong potential for cross-domain applicability and technical reuse.