A small target detection method in infrared night vision scenes
Through k-means++ clustering and YOLOv4 model optimization, it solves the problem of small target detection in infrared night vision scenarios, improves detection accuracy and generalization capabilities, is suitable for a variety of scenarios, and achieves more efficient infrared night small target detection.
Patent Information
- Application Number
- CN202210396793.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-04-15
AI Technical Summary
It is difficult to detect small targets in infrared night vision scenarios. Traditional methods rely on manual design of feature templates, which require high experience and weak generalization capabilities. In addition, infrared images are easily affected by the environment and equipment and generate noise, making it difficult to distinguish noise from weak and small targets.
The k-means++ algorithm was used to perform cluster analysis on the data, and the backbone network CSPDarknet53 of the YOLOv4 model was optimized. The number of convolution layers was increased and stride was set to 1 to form a new detection model. Data set processing and model training were combined to improve a priori frame adaptation. performance and detection accuracy.
Significantly improves the accuracy and generalization ability of infrared small target detection at night, is suitable for a variety of scenarios, improves detection accuracy and learning efficiency, and reduces training loss.
Smart Images

Figure CN114821138B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence target detection, and particularly relates to a small target detection method in an infrared night vision scenario. Background Art
[0002] For infrared small and weak targets, they occupy few pixels and lack detailed information such as color, shape, and texture, making detection very difficult. Moreover, the acquisition of infrared images is affected by environmental factors and equipment, resulting in background noise and inherent noise, and it is difficult to distinguish noise from small and weak targets, making the detection of infrared small and weak targets even more difficult.
[0003] Traditional infrared image target detection algorithms use artificially designed scale templates and, through artificially designed target contour extraction methods, extract features of the target contour in the image and compare them with the scale templates to judge and locate the targets in the image. The main traditional detection methods include: Histogram of Oriented Gradients (HOG) algorithm, Local Binary Pattern (LBP) feature algorithm, Scale-Invariant Feature Transform (SIFT) algorithm, and Haar feature algorithm, etc. The design of feature extraction methods and scale templates requires high experience and professional knowledge of designers, and has a single application scenario and weak generalization ability. Summary of the Invention
[0004] The purpose of the present invention is to provide a small target detection method in an infrared night vision scenario, which can obtain prior boxes more suitable for small targets and significantly improve the accuracy of detecting small targets at night.
[0005] To solve the above technical problems, the technical solution of the present invention is: A small target detection method in an infrared night vision scenario, including the following steps:
[0006] Collect images or videos with small targets at night;
[0007] Analyze the collected images or videos frame by frame, screen and remove the miscellaneous point images that do not contain the preset small targets, obtain valid data and integrate them to form a valid data set;
[0008] Perform Gaussian noise addition, salt-and-pepper noise addition, brightening processing, and darkening processing on the valid data respectively and save them to obtain augmented data, and integrate them to form an augmented data set;
[0009] Use the k-means++ algorithm to perform clustering analysis on the augmented data, where the k-means++ algorithm selects K clustering centers according to the following principle: Assume that n clustering centers have been selected (0 < n < K), then when selecting the (n + 1)-th clustering center, the points farther away from the current n clustering centers will have a higher probability of being selected as the (n + 1)-th clustering center;
[0010] The backbone network CSPDarknet53 in the YOLOv4 model is optimized. Specifically, each small residual block in the CSPDarknet53 network is deepened, the stride of the convolution layer is set to 1, and the number of convolution layers of the small residual block is increased by two layers on the original basis to obtain a new backbone network CSPDarknet53-deeper;
[0011] Train the optimized YOLOv4 model to form a new detection model;
[0012] Perform object detection on the augmented data using a new detection model.
[0013] The specific steps of k-means++ to select K cluster centers are:
[0014] Select several random points as "seed points", calculate the distance D(x) between each random point and the nearest "seed point" and save it in an array, then add up these distances to get Sum(D(x));
[0015] Take another random value and use the weighted method to calculate the next "seed point". The calculation principle of the weighted method is: first take a random value Random that falls within Sum(D(x)), then let Random = Random-D(x), until Random ≤ 0, the point at this time is the next "seed point";
[0016] Repeat the above steps until K cluster centers are obtained.
[0017] The optimization of the YOLOv4 model also includes: setting the input shape of YOLOv4 to 640*640 so that the convolution layer can obtain more target features.
[0018] A computer device is also provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the computer program.
[0019] A computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0020] Compared with the prior art, the present invention has the following beneficial effects:
[0021] 1. The data set is collected using surveillance videos in various scenarios. The shooting scenes and angles of small targets at night are different. Such a data set has stronger generalization and can be applied to small target detection in various scenarios in life.
[0022] 2. The original prior frame of YOLOv4 was optimized before training: The k-means++ clustering method was used to obtain a prior frame that is more suitable for small targets in infrared night vision scenes, which can improve the learning efficiency of the training process and improve the final detection accuracy.
[0023] 3. Improve the backbone network CSPDarknet53 of YOLOv4. The improved backbone network is called CSPDarknet53-deeper. More convolutional layers are used to obtain more detailed information such as shape and texture of small targets. The learning rate of the improved CSPDarknet53-deeper is improved.
[0024] 4. The present invention has a good detection effect on small targets in infrared night scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a schematic diagram of a flow chart of an embodiment of the present invention;
[0026] Figure 2 is a scatter plot of k-means++ algorithm clustering in an embodiment of the present invention;
[0027] Figure 3 This is the first large residual block structure diagram of the improved CSPDarknet53-deeper in an embodiment of the present invention;
[0028] FIG4( a ) is a graph showing a curve of the decrease in training set loss during the improved YOLOv4 training process in an embodiment of the present invention;
[0029] FIG4( b ) is a graph showing a decrease in the validation set loss during training in an embodiment of the present invention;
[0030] Figure 5 1 is a diagram of detection results of different night vision scenes in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] This aspect will be further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0032] Combination Figure 1 The embodiment of the present invention provides a method for detecting small targets in infrared night vision scenes based on the improved YOLOv4, and the steps are as follows:
[0033] S1: Collect a dataset of small targets at night (taking mice as an example), which are surveillance videos of four scenes: restaurant kitchens, milk tea shops, warehouse corners, and home kitchen cabinets. If the video FPS is 60, a picture is captured every 10 frames as a dataset. If the video FPS is 30, a picture is captured every 5 frames. Finally, 8,800 pictures are collected as a dataset.
[0034] S2: Analyze the monitored videos collected in S1 frame by frame, screen and remove the pictures that do not contain small targets (mice) to obtain a valid data set. Perform Gaussian noise addition, salt-and-pepper noise addition, brightening, and darkening processing on this valid data set respectively to obtain an augmented data set.
[0035] S3: Optimize the Anchor of YOLOv4: Use the k-means++ algorithm to perform clustering analysis on the data set. As Figure 2 is the scatter plot of clustering in this experiment. The abscissa is the length of the target box, and the ordinate is the width of the target box. The light-colored points are the length and width information of all the anchor boxes in the training set, and the dark-colored points are the clustering centers. K-means++ selects K clustering centers according to the following idea: Assume that n initial clustering centers have been selected (0 < n < K), then when selecting the (n + 1)-th clustering center: The points farther away from the current n clustering centers will have a higher probability of being selected as the (n + 1)-th clustering center. When selecting the first clustering center (n = 1), it is also done by a random method. The 9 anchor boxes obtained by K-means++ clustering in the experiment are: (9,12) (18,23) (14,39) (15,124) (42,71) (70,48) (40,105) (38,125) (43,137).
[0036] S4: The target to be detected in the experiment is single and occupies a small proportion in the image. The length and width of the target may be less than 10 pixels. The original input shape of YOLOv4 is 416*416, but if the input width is too small, some features of the small target will disappear. In order to enable the convolutional layer to obtain more target features, the input shape is set to 640*640. There are 5 large residual blocks in the CSPDarknet53 network, and each large residual block contains several small residual blocks. In this paper, each small residual block is deepened, which is more conducive to extracting the feature information of the target. As Figure 3 is the structure diagram of the first large residual block for improving the original backbone network of YOLOv4 into CSPDarknet53-deeper. In this network, the stride set for the convolutional layer is 1, so during the convolution process, the width of the picture will not change. Based on this idea, add two more convolutional layers to the convolutional layers of the small residual block ( Figure 3Layer_add1 and Layer_add2 in the network are more conducive to the extraction of target features. Here, the new backbone network is called CSPDarknet53-deeper. The structure of CSPDarknet53-deeper contains 5 large residual blocks, and the number of small residual units contained in each large residual block is 1, 2, 8, 8, and 4, so there are a total of 23 small residual blocks. Each small residual block adds 2 layers of convolution, so the entire backbone network adds a total of 46 layers of convolution. More convolution layers are used to obtain more detailed information such as the shape and texture of the target. The improved CSPDarknet53-deeper has a slower training iteration speed, but the learning rate is improved.
[0037] S5: Train a new detection model. Through the improvement, the backbone network is deepened, the convolution process has a more obvious effect on target feature extraction, and the learning rate of the training process is improved. Therefore, the training iterations are 100 times, and it is close to the optimal at iteration 44, and then gradually converges. The training set loss and validation set loss of the traditional YOLOv4 after 100 training are about 3.3 and 3.1 respectively, while the training set loss of the improved YOLOv4 in the 100th training is 1.9, and the validation set loss is 1.8, which is reduced by about 38%. As shown in Figure 4 (a) is the training set loss reduction curve of the improved YOLOv4 during the training process, and Figure 4 (b) is the validation set loss reduction curve during the training process.
[0038] S6: Prediction. This experiment is about detecting small targets at night. We use surveillance videos to test. Since small targets basically appear at night when there is no one around and it is dark, and the surveillance images are infrared images, in order to analyze the model detection performance more intuitively, Figure 5 Shown are the detection results of small targets (mouse) in monitoring under various scenarios.
[0039] Experimental results analysis and summary
[0040] In order to verify the effectiveness of the improved algorithm, YOLOv3, YOLOv4 and the improved YOLOv4 were used to test the same small target dataset, and the training iterations were 100 times. The experimental results are shown in Table 1:
[0041] Table 1
[0042]
[0043] It can be seen that compared with YOLOv3, the AP of the improved YOLOv4 has increased by 12.31%, and the FPS has increased by 7.59, while compared with YOLOv4, the AP of the improved YOLOv4 has increased by 6.35%, and the FPS has decreased by 0.85. Although the improved network is deeper, which slightly reduces the FPS, the accuracy of detection is more important for the life application scenario of small target detection and early warning at night. Although the detection effect of the improved YOLOv4 is relatively outstanding, it has not reached 100%. This is mainly due to the presence of highlighted edges, noise and backgrounds with large changes in light and dark in the image, which are extremely similar to mice and produce a small number of false alarms. The present invention can allow restaurants, canteens and other public places to know their own hygiene conditions and whether there are mice, which plays a very important role in ensuring catering hygiene.
[0044] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.
Claims
1. A small target detection method in an infrared night vision scene, characterized in that: It includes the following steps: Collect images or videos with small targets at night; Analyze the collected images or videos frame by frame, screen out and eliminate the miscellaneous point images that do not contain the preset small targets, obtain the effective data and integrate them to form an effective data set; Perform Gaussian noise addition, salt and pepper noise addition, brightening processing and darkening processing on the effective data respectively and save them to obtain the augmented data, and integrate them to form an augmented data set; Use the k-means++ algorithm to perform clustering analysis on the augmented data. The k-means++ algorithm selects K clustering centers according to the following principle: assume that n clustering centers have been selected (0 < n < K), then when selecting the (n + 1)-th clustering center, the points farther away from the current n clustering centers will have a higher probability of being selected as the (n + 1)-th clustering center; Optimize the backbone network CSPDarknet53 in the YOLOv4 model. The specific optimization is as follows: deepen each small residual block in the CSPDarknet53 network, set the stride of the convolutional layer to 1, and increase the number of convolutional layers of the small residual block by two layers on the original basis to obtain the new backbone network CSPDarknet53-deeper; Train the optimized YOLOv4 model to form a new detection model; Perform object detection on the augmented data through the new detection model.
2. The method for detecting small targets in infrared night vision scenes according to claim 1, characterized in that: The specific steps for k-means++ to select K clustering centers are as follows: Select several random points as "seed points". For each random point, calculate its distance D(x) from the nearest "seed point" and save it in an array, and then add up these distances to get Sum(D(x)); Take another random value and use a weighted method to calculate the next "seed point"; the calculation principle of this weighted method is: first take a random value Random that can fall within Sum(D(x)), and then let Random = Random - D(x) until Random ≤ 0, and the point at this time is the next "seed point"; Repeat the above steps until K clustering centers are obtained.
3. The method for detecting small targets in infrared night vision scenes according to claim 1, characterized in that: The optimization of the YOLOv4 model also includes: setting the input shape of YOLOv4 to 640*640 so that the convolutional layer can obtain more target features.
4. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-3.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1-3.
Citation Information
Patent Citations
Small target detection network model based on darknet53 network and detection method
CN111199255A
ADAS infrared night vision method and night vision system
CN112464884A
