## 3 Results and Discussion  
### Image Pre-Processing Results  
The terahertz concealed object image data in this paper contain a total of eight categories (five kinds of dangerous objects, namely scissors, pistol, blades, lighters, and nails, and three non-dangerous objects, namely keys, nail scissors, and pens, where hand knives and small razor blades are classified as blades), and each image is a pseudo-colour image with a size of 512 \(\times\) 256. During image acquisition, we obtained terahertz images of different hues by adjusting the brightness and contrast of the software system, and the original images of the concealed objects hidden in two kinds of packages were obtained and are shown in Figure 10. The image dataset contains eight kinds of samples to be tested in different scales. The small objects such as nails, keys, and small razor blades account for a relatively small proportions of the images. Some of these objects are not displayed completely in images, such as the nail in the bottom of Figure 10i. This is likely to cause omissions. Additionally, the utility knives and pens have similar external outlines and are likely to be mis-detected due to the lack of texture features in the terahertz images, as shown in Figure 10d. Figure 9: LWMD-YOLOv7 model structure diagram. To verify the impact of different image processing methods on the target detection results, this paper uses two methods--non-local mean filtering as well as histogram equalisation--to pre-process the original terahertz image, preserving the results of both processes. The terahertz image before and after non-local means filtering (NLM) processing is shown in Figure 11. The processed terahertz image intuitively retains the original features of the objects while weakening the noise around the targets. The terahertz image after histogram equalisation (HE) enhancement is shown in Figure 12. As shown in Figure 12a, some of the original terahertz images have low contrast and insignificant features, and their corresponding histograms of grey scale distribution have unevenly distributed grey scale values (as shown in Figure 12b). After histogram equalisation, the contrast of some of the images with uneven grey scale distribution is improved (as shown in Figure 12c), and their pixel values are uniformly distributed between 0 and 255 (as shown in Figure 12d). Figure 11: Results of NLM processing. (**a**) Original THz image; (**b**) NLM-processed image. Figure 10: Two types of packaging for concealed object. (**a**) Scissors and two nail scissors (polysthene packaging); (**b**) key and two blades (polysthene packaging); (**c**) pistol and lighter (polythene packaging); (**d**) pen and nail and blade (polythene packaging); (**e**) pistol and two keys (Kraft paper packaging); (**f**) scissors and blade (Kraft paper packaging); (**g**) key and scissors (Kraft paper packaging); (**h**) nail and blade (Kraft paper packaging); (**i**) three nails and two blades (polythene packaging). The original terahertz image dataset is D1, the non-local mean filtering processed is D2, the histogram equalisation processed is D3, and the wavelet transform processed is D4. The four groups of datasets after data augmentation are all expanded to 3556 images, and the size of each image is 640 \(\times\) 640. Some of the images in the dataset after data enhancement are shown in Figure 13 (taking D1 as an example). The four expanded datasets are divided as follows: training set/validation set/test set (8:1:1 ratio). The experiments in this paper were conducted in Windows 10, with a graphics card model NVIDIA GeForce RTX 3060, and using Python 3.7 as the programming language. Using the four sets of the enhanced terahertz image data (D1, D2, D3, D4) mentioned above, the base model of YOLOv7 was trained based on the deep learning framework Pytorch 1.13, and the prediction results were compared to the four datasets. Then, the dataset with the best prediction results was selected to train the improved YOLOv7 model.