## 3 Results and Discussion
### Results of Comparative Experiments  
The prediction results of the YOLOv7 algorithm on the four datasets D1, D2, D3, and D4 (see Section 3.1 for details) are shown in Table 1. As the results of all four datasets are the evaluations performed on the YOLOv7 baseline model without a modification of the model's structure, there is no need to consider the measurement of object detection speed, such as FPS. Figure 13: Some images in the D1 dataset after data augmentation. As seen in Table 1, the YOLOv7 algorithm achieves the best results on R and mAP@.5 (%) index metrics on dataset D2, indicating that the NLM-processed terahertz image is more conducive for YOLOv7 to learn the important features in the image. To further validate the effectiveness of the improved model in this paper, a series of ablation experiments were conducted in the test set of D2 using YOLOv7 as a benchmark, and the results are shown in Table 2, where \"+\" means we add this module in the network and \"-\" means that this module is not added. For example, model 1 is the benchmark of Yolov7. In model 2, we use MobileNext as the backbone network. In model 4, we use the SPD_Mobile network as the backbone network and DIOU as the training strategy. Model 6 is the LWMD-YOLOv7 network that is proposed in this work. From the information in Table 2, it can be seen that the detection speed FPS of the algorithm can be greatly improved by using MobileNext as the backbone network, but this will also cause a decrease in the detection precision and a decrease in the recall rate. The accuracy of detection can be improved by using DIOU as the loss function. Compared to the MobileNext network, the SPD-Mobile network proposed in this paper can improve the recall rate and improve the phenomenon of emissions of small targets. By introducing the selective attention mechanism LSK module in the network, the detection accuracy can be improved and the phenomenon of false detection due to the similarity of outlines and lack of detailed features in terahertz images can also be improved. In summary, the detection speed (FPS) of the LWMD-YOLOv7 algorithm (model 6) proposed in this paper reaches 112.4 (\(t/s\)), which is 26.9 (\(t/s\)) higher than that of the YOLOv7 benchmark network. It also achieves a precision (P) of 98.5% and a recall (R) of 97.5%, which is higher than that of the YOLOv7 benchmark network. Moreover, the average detection accuracy (mAP@.5) is not much different from that of the YOLOv7 benchmark network, and the detection accuracy (P) reaches the highest average detection accuracy. This indicates that the improved YOLOv7 network effectively improves the detection efficiency without much loss in accuracy. The detection results of the LWMD-YOLOv7 algorithm in each category are shown in Table 3.  
By analysing the overall detection results of this paper's algorithm and the recognition accuracy of different categories, the LWMD-YOLOv7 network reaches an average mAP@.5 (%) metric of 98.6% for all categories. The algorithm proposed in this paper achieves high accuracy (P) for both the pen and blade categories although the blade category contains utility knives, which are similar to the pen's appearance profile. Despite terahertz images lacking texture features, LWMD-YOLOv7 can still accurately identify them, demonstrating the effectiveness of the LWMD-YOLOv7 algorithm in contrab \begin{table}
\begin{tabular}{c c c c} \hline
**Dataset** & **P (\%)** & **R (\%)** & **mAP@.5 (\%)** \\ \hline D1 & 99.0 & 95.5 & 98.1 \\ D2 & 98.2 & 96.4 & 98.7 \\ D3 & 98.3 & 96.0 & 98.3 \\ D4 & 98.2 & 95.7 & 98.2 \\ \hline \end{tabular}
\end{table} 
Table 1: Detection results of YOLOv7 base model on three datasets.