Infrared low speed small target detection method, device, computing equipment and storage medium
By adding the coordinate attention processing module to the YOLOv4-tiny network, the problem that the existing model cannot detect low-speed and small targets is solved, and accurate detection of low-speed and small targets in infrared images is achieved, which is suitable for complex scenes and limited resources. equipment.
Patent Information
- Application Number
- CN202111490363.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-12-08
AI Technical Summary
Existing models cannot directly detect low, slow and small targets, especially in complex scenarios with low flying altitude, small size and strong maneuverability, resulting in poor detection results.
An infrared low-slow and small target detection method based on the YOLOv4-tiny network is adopted. By adding a coordinate attention processing module, the position information is embedded into the channel attention to improve the accuracy of feature recognition of low-slow and small targets in infrared images.
It achieves accurate detection of low-speed and small targets, is suitable for highly mobile devices, and has fast detection speed, making it suitable for hardware environments with limited resources.
Smart Images

Figure CN113989624B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image processing technology, and in particular to an infrared low-speed and slow small target detection method, device, computing device and storage medium. Background Art
[0002] Low, slow and small targets refer to aircraft and airborne objects with all or part of the characteristics of flying speed less than 200km / h, flying altitude below 1km, and small radar reflection area. With the development of aviation, especially the development of general aviation, and especially the state's requirement for the Air Force to open up the low-altitude aviation field, the problem of "low, slow and small" flights has become more and more prominent. In particular, the widespread use of civil drones poses a great threat to air defense security, and effective detection of them can correctly implement monitoring and early warning.
[0003] Since the detection of low, slow and small targets requires complex scenes, and their flight altitude is low, their size is small and their maneuverability is strong, the existing models cannot directly detect low, slow and small targets. Therefore, it is urgent to provide a method that can accurately detect low, slow and small targets. Summary of the invention
[0004] Based on the problem that the existing model cannot directly detect low, slow and small targets, the embodiments of the present invention provide an infrared low, slow and small target detection method, device, computing device and storage medium, which can accurately detect low, slow and small targets.
[0005] In a first aspect, an embodiment of the present invention provides an infrared low speed small target detection method, comprising:
[0006] Acquire an infrared image to be detected;
[0007] The infrared image is input into a pre-trained detection model; the detection model is trained based on a YOLOv4-tiny network, and the YOLOv4-tiny network sequentially uses a backbone network, a neck network, a coordinate attention processing module, and a head network to perform feature recognition on the infrared image;
[0008] According to the result output by the head network of the detection model, the detection result of the low, slow and small target in the infrared image is obtained.
[0009] Preferably, the training method of the detection model includes:
[0010] Acquire a number of data samples annotated with labels, wherein the data samples are images including low, slow and small targets; the data samples satisfy one or more of the following conditions: the image background covers a specified background environment, the target type covers a specified type, and the target size is not less than a set size;
[0011] For each data sample, the following steps are performed: inputting the data sample into the backbone network, inputting the data sample output by the backbone network into the neck network, performing coordinate attention processing on the data sample output by the neck network using the coordinate attention processing module, and inputting the data sample after the coordinate attention processing into the head network;
[0012] The trained detection model is obtained.
[0013] Preferably, the data samples output by the backbone network include: first feature maps and second feature maps of different prediction scales;
[0014] The coordinate attention processing module performs coordinate attention processing on the following data samples output by the neck network: a processed first feature map output after convolution processing on the first feature map, and a spliced feature map obtained by tensor splicing of the processed first feature map and the second feature map after upsampling.
[0015] Preferably, the data samples output by the backbone network further include: a third feature map, wherein the prediction scale of the third feature map is different from that of the first feature map and the second feature map;
[0016] The coordinate attention processing module also performs coordinate attention processing on the following data samples output by the neck network: a feature extraction map obtained by performing feature extraction processing on the spliced feature map after upsampling the spliced feature map and performing tensor splicing with the third feature map.
[0017] Preferably, the using the coordinate attention processing module to perform coordinate attention processing on the data samples output by the neck network comprises:
[0018] Encode each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal tensor matrix and a vertical tensor matrix;
[0019] Performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix, and decomposing the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample;
[0020] Multiply each channel of the data sample with the corresponding horizontal attention weight matrix and vertical attention weight matrix to obtain the data sample after coordinate attention processing.
[0021] Preferably, encoding each channel of the data samples along the horizontal coordinate direction and the vertical coordinate direction to obtain a horizontal tensor matrix and a vertical tensor matrix includes:
[0022] The data samples are encoded along the horizontal coordinate direction according to the following formula:
[0023]
[0024] The data samples are encoded along the vertical coordinate direction according to the following formula:
[0025]
[0026] Where W and H are the width and height of the image, respectively, c is the number of channels of the data sample image, and X is the input data sample. is the output of the cth channel with height h, is the output of the cth channel with width w.
[0027] Preferably, the step of performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix comprises:
[0028] f=δ(F 1 ([B h ,B w ]))
[0029] Among them, δ is the nonlinear activation function, F 1 is a 1×1 convolution operation, [.,.] is a concatenate operation along the spatial dimension, B h is the horizontal tensor matrix, B w is the vertical tensor matrix, and f is the obtained feature map matrix.
[0030] In a second aspect, an embodiment of the present invention further provides an infrared low-speed, slow, small target detection device, comprising:
[0031] An image acquisition unit, used for acquiring an infrared image to be detected;
[0032] A detection model recognition unit, used for inputting the infrared image into a detection model generated by pre-training; the detection model is obtained by training based on a YOLOv4-tiny network, and the YOLOv4-tiny network sequentially uses a backbone network, a neck network, a coordinate attention processing module and a head network to perform feature recognition on the infrared image;
[0033] A detection result generating unit is used to obtain a detection result of a low, slow and small target in the infrared image according to a result output by the head network of the detection model.
[0034] In a third aspect, an embodiment of the present invention further provides a computing device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0035] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.
[0036] The embodiments of the present invention provide an infrared low, slow and small target detection method, device, computing device and storage medium. By adding a coordinate attention processing module to the YOLOv4-tiny network, the position information is embedded into the channel attention, so that when performing feature recognition on the infrared image, the position of the low, slow and small target in the infrared image can be located more accurately, thereby achieving the purpose of accurately detecting the low, slow and small target based on the infrared image. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is a flow chart of an infrared low speed small target detection method provided by an embodiment of the present invention;
[0039] Figure 2 This is a flow chart of another infrared low speed small target detection method provided by an embodiment of the present invention;
[0040] Figure 3 This is a diagram of an infrared low speed small target detection network structure provided by an embodiment of the present invention;
[0041] Figure 4 is a hardware architecture diagram of a computing device provided by an embodiment of the present invention;
[0042] Figure 5 It is a structural diagram of an infrared low-speed, slow, small target detection device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] As mentioned above, the detection of low, slow and small targets requires complex scenes, and the low flying altitude, small size and strong mobility of the targets make the existing models unable to directly detect low, slow and small targets. Therefore, it is possible to consider applying the infrared low, slow and small target detection model to highly mobile devices. Aircraft or other highly mobile devices generally have insufficient hardware resources, so the detection model needs to be made lighter. This solution is based on the improved YOLOv4-tiny network training to obtain the detection model, which has a simple network structure and a fast detection speed. As for the complex background and small size of the detection of low, slow and small targets, it is considered to add a coordinate attention processing module to the YOLOv4-tiny network, which can more accurately locate the position of low, slow and small targets in infrared images. Therefore, this solution can accurately detect low, slow and small targets based on infrared images.
[0045] The specific implementation of the above concept is described below.
[0046] Please refer to Figure 1 , an embodiment of the present invention provides an infrared low speed small target detection method, the method comprising:
[0047] Step 100: Acquire an infrared image to be detected.
[0048] Step 102, input the infrared image into a pre-trained detection model; the detection model is trained based on the YOLOv4-tiny network, and the YOLOv4-tiny network sequentially uses a backbone network, a neck network, a coordinate attention processing module and a head network to perform feature recognition on the infrared image.
[0049] Step 104, obtaining a detection result of a low, slow, small target in the infrared image according to a result output by the head network of the detection model.
[0050] In an embodiment of the present invention, a coordinate attention processing module is added to the YOLOv4-tiny network to embed position information into channel attention, so that when performing feature recognition on infrared images, the positions of low, slow and small targets in infrared images can be more accurately located, thereby achieving the purpose of accurately detecting low, slow and small targets based on infrared images.
[0051] Described below Figure 1 How the various steps are performed.
[0052] First, with respect to step 100 , an infrared image to be detected is acquired.
[0053] In an embodiment of the present invention, each frame of infrared image of the real-time collected infrared video or the collected infrared video can be used as the infrared image to be detected, and low, slow and small targets can be detected and identified for each frame of infrared image through the infrared low, slow and small target detection model, thereby achieving the purpose of real-time detection of low, slow and small targets.
[0054] Then, for step 102, the infrared image is input into a pre-trained detection model; the detection model is trained based on a YOLOv4-tiny network, and the YOLOv4-tiny network sequentially uses a backbone network, a neck network, a coordinate attention processing module, and a head network to perform feature recognition on the infrared image.
[0055] If you want to detect low, slow and small targets in each frame of infrared image in the infrared video through the infrared low, slow and small target detection model, you need to train the infrared low, slow and small target detection network in advance to obtain the detection model.
[0056] Then, the training method of the detection model is explained below.
[0057] In the embodiments of the present invention, please refer to Figure 2 , the detection model can be trained using at least the method shown in steps 200-204 below:
[0058] Step 200, obtain a number of data samples marked with labels, wherein the data samples are images including low, slow and small targets; the data samples satisfy one or more of the following: the image background covers the specified background environment, the target type covers the specified type, and the target size is not less than the set size.
[0059] In practical applications, data samples can be selected according to actual needs. For example, a background image without low, slow, and small objects can be obtained as a negative sample. The background environment, type, and size of low, slow, and small objects in the positive sample can be selected according to needs and actual scenarios.
[0060] In an embodiment of the present invention, an infrared image formed by intercepting low, slow, and small target infrared videos taken by oneself and on the Internet can be used as a data sample. Among them, the image background needs to cover a specified background environment, such as one or more background environments of buildings, clouds, clear space, mountains, and trees, and the target type covers a specified type, for example, the target type can be a drone, a balloon, or a bird. In addition, the target size in the data sample can be no less than a set size, for example, the set size is greater than 10*10 pixels; in this way, the diversity of data samples can be guaranteed, and the model's feature learning ability for low, slow, and small targets can be improved, so that the model can accurately identify targets from images of different background environments and different sizes.
[0061] In order to enable the detection model obtained after training to detect low, slow and small targets from unlabeled infrared images, it is necessary to pre-label the low, slow and small targets in the data sample. In an embodiment of the present invention, the labelImg labeling tool can be used to label each low, slow and small target in the data sample, and the labeled labels may include: the category of the low, slow and small target, the horizontal coordinate of the center point, the vertical coordinate of the center point, the target width and the target length. When training the infrared low, slow and small target detection network, in order to simultaneously input the data sample and its corresponding label into the infrared low, slow and small target detection network, it is necessary to convert the label file output by the labelImg labeling tool from .xml format to .txt format.
[0062] In addition, in order to facilitate the training of the infrared low-speed small target detection network and obtain the optimal detection model, several labeled data samples can be divided into training set, verification set and test set in a ratio of 8:1:1.
[0063] Step 202, for each data sample, execute: input the data sample into the backbone network, input the data sample output by the backbone network into the neck network, use the coordinate attention processing module to perform coordinate attention processing on the data sample output by the neck network, and input the data sample after coordinate attention processing into the head network;
[0064] In an embodiment of the present invention, each data sample in the training set is input into the infrared low-speed small target detection network respectively, and the infrared low-speed small target detection network is based on the YOLOv4-tiny network, and the backbone network, neck network, coordinate attention processing module and head network are used in sequence to perform feature recognition on each data sample.
[0065] In the embodiment of the present invention, the backbone network adopts CSPdarknet53-Tiny network. When processing the residual block, the original stack of residual blocks is split into two parts. The backbone part continues to stack the residual blocks, and its convolution result and the other part introduce a residual edge to enhance the learning ability of the backbone network, which can ensure accuracy and reduce memory cost while ensuring lightweight. In addition, in order to increase the speed, the activation function is changed to LeakyReLU.
[0066] like Figure 3The figure shows the improved YOLOv4-tiny network structure diagram, in which boxes 1, 2, 3 and 4 are the backbone network, neck network, coordinate attention processing module and head network respectively. For each data sample, the backbone network is first used to extract features of the data sample to obtain feature maps of different scales. The feature maps of different scales output by the backbone network are then input into the neck network for feature fusion. In an embodiment of the present invention, for the detection of small targets, it is necessary to strengthen the extraction of small target feature information. In order to obtain more abundant small target position information, a scale is added to the data sample output by the backbone network, and then the feature pyramid structure (FPN) is used to fuse the obtained information of different scales, thereby overcoming the disadvantage that the original YOLOV4-Tiny network only contains two prediction scales and improving its accuracy in extracting small target position information.
[0067] Therefore, the data samples output by the backbone network include not only the first feature map and the second feature map of different prediction scales, but also a third feature map, and the prediction scale of the third feature map is different from that of the first feature map and the second feature map. For example, the feature map sizes of the original backbone network output are 13*13 and 26*26 feature maps, respectively. In the embodiment of the present invention, a feature map with an output size of 52*52 is added as the third feature map.
[0068] In the embodiment of the present invention, the neck network improves the feature pyramid structure (FPN) and performs feature fusion and feature processing on the feature map of the newly added scale. The improved feature pyramid structure (FPN) network can fuse the features between different output layers in the backbone network, which can not only ensure the rich semantic information of the deep network, but also obtain the geometric detail information of the low-level network, so as to enhance the feature extraction capability.
[0069] After the feature map output by the backbone network is processed by the feature fusion of the neck network, the data samples output by the neck network also need to be processed by coordinate attention. Due to the addition of a new scale, the data samples output by the neck network include not only the processed first feature map output after the convolution processing of the first feature map, the spliced feature map obtained by tensor splicing of the processed first feature map and the second feature map after upsampling, but also the feature extraction map obtained by tensor splicing of the spliced feature map and the third feature map after feature extraction.
[0070] For example, combining Figure 3, the backbone network outputs a first feature map of size 13*13 and a second feature map of size 26*26, and a third feature map of size 52*52 is newly output. In the neck network, the 13*13 feature map is convolved and output, and at the same time, it is upsampled and concatenated with the 26*26 feature map, and then convolved and output. For the newly added scale feature map, it is necessary to concatenate the above with the 26*26 feature map, and then upsample the concatenated feature map output by the convolution process, and then concatenate it with the 52*52 third feature map newly output by the backbone network, and then use the "convolution + regularization + excitation" feature extraction process, and then convolve it and output. The purpose is to perform secondary feature extraction on the newly added 52*52 scale feature map to improve the detection accuracy of low, slow and small targets. Therefore, the neck network performs feature fusion processing on the feature maps of sizes 13*13, 26*26 and 52*52 output by the backbone network, and outputs feature maps of sizes 13*13, 26*26 and 52*52.
[0071] In an embodiment of the present invention, a coordinate attention processing module is added to perform coordinate attention processing on the data samples output by the neck network. Coordinate attention processing embeds position information in the channel attention, so that the subsequent network can pay attention to a larger area without introducing a large amount of calculation. It is suitable for lightweight low-speed small target detection networks, which can not only improve the detection and recognition of low-speed small targets, but also will not increase too many computing resources, thereby affecting the detection speed.
[0072] Specifically, the data samples output by the neck network can be processed by coordinate attention through the following steps S1-S3:
[0073] S1, encode each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal tensor matrix and a vertical tensor matrix.
[0074] For example, the input data sample image X is encoded along the horizontal coordinate direction and the vertical coordinate direction using pooling kernels of size (H, 1) and (1, W).
[0075] The data samples are encoded along the horizontal coordinate direction according to the following formula:
[0076]
[0077] The data samples are encoded along the vertical coordinate direction according to the following formula:
[0078]
[0079] Where W and H are the width and height of the image, respectively, c is the number of channels of the data sample image, and X is the input data sample image. is the output of the cth channel with height h, is the output of the cth channel with width w.
[0080] Through the above two encoding formulas, the features of the data sample image X are aggregated in the horizontal and vertical directions respectively to obtain the horizontal tensor matrix B h and the vertical tensor matrix B w .
[0081] S2, feature mapping the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix, and decompose the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix with the same number of channels as the data sample.
[0082] In an embodiment of the present invention, the method of performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain the feature mapping matrix is:
[0083] f=δ(F 1 ([B h ,B w ]))
[0084] Among them, δ is a nonlinear activation function, F 1 is a 1×1 convolution operation, [.,.] is a concatenate operation along the spatial dimension, B h is the horizontal tensor matrix, B w is the vertical tensor matrix, and f is the obtained feature map matrix.
[0085] Then, the feature map matrix is decomposed into two separate tensor matrices along the horizontal coordinate direction and the vertical coordinate direction, and then the two tensor matrices are transformed into a horizontal attention weight matrix and a vertical attention weight matrix with the same number of channels as the data sample image X through a 1*1 convolution operation.
[0086] Specifically, the following methods can be used:
[0087] g h =σ(F h (f h ))
[0088] g w =σ(F w (f w ))
[0089] Among them, g h and g ware the horizontal attention weight matrix and vertical attention weight matrix of the data sample image X, σ is the sigmoid activation function, F h and F w is a 1×1 convolution operation, f h and f w They are the horizontal feature map tensor matrix and the vertical feature map tensor matrix obtained by decomposing the feature map matrix f.
[0090] S3, multiply each channel of the data sample with the corresponding horizontal attention weight matrix and vertical attention weight matrix to obtain the data sample after coordinate attention processing.
[0091] In an embodiment of the present invention, coordinate attention weight processing is performed on each data sample, so that the coordinate attention processing module can capture the long-range dependency along one spatial direction and save the precise position information along another spatial direction, which helps the network to locate the target of interest more accurately.
[0092] The data sample Y after coordinate attention processing can be obtained according to the following formula:
[0093]
[0094] Among them, c is the number of channels of the data sample image, y c (i, j) is the c-th channel image of the data sample Y after coordinate attention processing, x c (i, j) is the c-th channel image of the input data sample image X, is the horizontal attention weight matrix of the c-th channel, is the vertical attention weight matrix of the c-th channel.
[0095] Each data sample after coordinate attention processing is input into the head network. The head network uses the YOLOv3 detection head to detect and identify low, slow and small targets. In order to enable the head network to recognize low, slow and small targets in the feature map more quickly, based on the YOLOv3 detection head, the K-means clustering algorithm is used for pre-training to generate pre-selected anchor boxes based on the self-made data set.
[0096] In the embodiment of the present invention, in order to make the detection model more suitable for the shape of low, slow and small targets in infrared images, accelerate network convergence, and improve training accuracy and speed, the K-means clustering algorithm is trained in advance using the training set to obtain 9 pre-selected anchor boxes of different sizes: (10,10), (14,13), (16,16), (22,18), (24,9), (26,21), (31,13), (40,33), (47,17).
[0097] Then, when the head network performs feature recognition on each data sample after coordinate attention processing, it first generates multiple pre-selected anchor boxes, then predicts the category and offset for each pre-selected anchor box, then adjusts the position of the pre-selected anchor box according to the predicted offset to obtain the predicted bounding box, and finally selects the predicted bounding box containing low-speed small objects. Then, based on each predicted bounding box, the head network identifies whether the box contains low-speed small objects, as well as the category, the horizontal coordinate of the center point, the vertical coordinate of the center point, the object width, and the object length.
[0098] Step 204, obtaining the trained detection model.
[0099] In this step, transfer learning is used to train the infrared low, slow and small target detection network in step 202 using each infrared image in the training set in step 200. The validation set is used to validate each model trained to a set number of times, with the goal of selecting a training model when the loss function converges and pre-selecting a set number of training models. The pre-selected training models are tested using the test set, and the optimal detection model is selected based on the evaluation indicators.
[0100] For example, the number of training times can be preset to 300 according to experience. When the infrared low-speed small target detection network is trained for 300 generations using the training set, a part of the data samples in the validation set is used to verify the training model for 300 generations, and it is found that the loss function is about to converge. Continue to train and verify the training model for 300 generations, and find that the loss function has converged when training for 301 generations, then pre-select the training models for 301, 302, and 303 generations.
[0101] The test set was used to test the training models of 301, 302, and 303 generations, and their training results were evaluated. The evaluation indicators were average accuracy, precision, and recall, respectively.
[0102] Use the following formula to draw the PR curve based on precision and recall:
[0103]
[0104]
[0105] Among them, P is the precision, R is the recall, C is the number of categories, AP is the area between the PR curve drawn according to the precision and recall and the coordinate axis, and mAP is the average AP value of each category.
[0106] According to the evaluation indicators, the higher the average precision, the larger the AP and mAP values, the better the detection performance and effect of the model. The training model with the best evaluation indicators is determined as the optimal detection model.
[0107] Finally, for step 104, the detection result of the low, slow and small target in the infrared image is obtained according to the result output by the head network of the detection model.
[0108] If the result output by the head network contains a low, slow, small target, then the detection result of the infrared image contains the low, slow, small target and the low, slow, small target information annotated with the training label; otherwise, the detection structure of the infrared image does not contain a low, slow, small target.
[0109] like Figure 4 , Figure 5 As shown, an embodiment of the present invention provides an infrared low-speed small target detection device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, such as Figure 4 As shown in FIG. 1 , a hardware architecture diagram of a computing device in which an infrared low-speed small target detection device is provided in an embodiment of the present invention is provided. Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown in the figure, the computing device in which the device is located in the embodiment may also generally include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 5 As shown, as a device in a logical sense, the CPU of the computing device in which it is located reads the corresponding computer program in the non-volatile memory into the memory and runs it. This embodiment provides an infrared low-speed small target detection device, including:
[0110] An image acquisition unit 501 is used to acquire an infrared image to be detected;
[0111] A detection model recognition unit 502 is used to input the infrared image into a detection model generated by pre-training; the detection model is obtained by training based on a YOLOv4-tiny network, and the YOLOv4-tiny network sequentially uses a backbone network, a neck network, a coordinate attention processing module, and a head network to perform feature recognition on the infrared image;
[0112] The detection result generating unit 503 is used to obtain the detection result of the low, slow and small target in the infrared image according to the result output by the head network of the detection model.
[0113] In one embodiment of the present invention, when executing the generation of the detection model, the detection model identification unit 502 is specifically used to obtain a number of data samples marked with labels, and the data samples are images including low, slow and small targets; the several data samples meet: the image background covers the specified background environment, the target type covers the specified type, and the target size is not less than one or more of the set size; for each data sample, the following are executed: input the data sample into the backbone network, input the data sample output by the backbone network into the neck network, use the coordinate attention processing module to perform coordinate attention processing on the data sample output by the neck network, and input the data sample after the coordinate attention processing into the head network; obtain the trained detection model.
[0114] In one embodiment of the present invention, in the detection model identification unit 502, the data samples output by the backbone network include: a first feature map and a second feature map of different prediction scales; the coordinate attention processing module performs coordinate attention processing on the following data samples output by the neck network: a processed first feature map output after convolution processing on the first feature map, and a spliced feature map obtained by upsampling the processed first feature map and performing tensor splicing with the second feature map.
[0115] In one embodiment of the present invention, in the detection model recognition unit 502, the data samples output by the backbone network also include: a third feature map, and the prediction scale of the third feature map is different from that of the first feature map and the second feature map; the coordinate attention processing module also performs coordinate attention processing on the following data samples output by the neck network: a feature extraction map obtained by upsampling the spliced feature map and performing tensor splicing with the third feature map and then performing feature extraction processing.
[0116] In one embodiment of the present invention, when the detection unit 502 executes the coordinate attention processing of the data sample output by the neck network using the coordinate attention processing module, it is specifically used to encode each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal tensor matrix and a vertical tensor matrix; feature mapping the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix, and decompose the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample; multiply each channel of the data sample with the corresponding horizontal attention weight matrix and vertical attention weight matrix to obtain a data sample after coordinate attention processing.
[0117] In one embodiment of the present invention, when the detection unit 502 performs the encoding of each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction to obtain the horizontal tensor matrix and the vertical tensor matrix, it is specifically used to encode the data sample along the horizontal coordinate direction according to the following formula:
[0118]
[0119] The data samples are encoded along the vertical coordinate direction according to the following formula:
[0120]
[0121] Where W and H are the width and height of the image, respectively, c is the number of channels of the data sample image, and X is the input data sample. is the output of the cth channel with height h, is the output of the cth channel with width w.
[0122] In one embodiment of the present invention, when performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain the feature mapping matrix, the identification unit 502 is further specifically used to obtain the feature mapping matrix according to the following formula:
[0123] f=δ(F 1 ([B h ,B w ]))
[0124] Among them, δ is a nonlinear activation function, F 1 is a 1×1 convolution operation, [.,.] is a concatenate operation along the spatial dimension, B h is the horizontal tensor matrix, B w is the vertical tensor matrix, and f is the obtained feature map matrix.
[0125] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on an infrared low-speed, slow, and small target detection device. In other embodiments of the present invention, an infrared low-speed, slow, and small target detection device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0126] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.
[0127] An embodiment of the present invention further provides a computing device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, an infrared low-speed, slow, small target detection method in any embodiment of the present invention is implemented.
[0128] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes an infrared low-speed, slow, small target detection method in any embodiment of the present invention.
[0129] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.
[0130] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0131] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0132] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0133] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0134] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical factors in the process, method, article or device including the elements.
[0135] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting infrared low-speed and slow small targets. It is characterized in that include: Acquire an infrared image to be detected; Inputting the infrared image into a pre-trained detection model; The detection model is obtained based on YOLOv4-tiny network training. The YOLOv4-tiny network sequentially uses the backbone network, the neck network, the coordinate attention processing module and the head network to perform feature recognition on the infrared image. The backbone network adopts the CSPdarknet53-Tiny network. When the CSPdarknet53-Tiny network processes the residual block, the stack of the residual block is split into two parts. The backbone part stacks the residual blocks, and the convolution result and the other part of the residual block introduce a residual edge, and the activation function in the backbone network is modified to LeakyReLU. Obtaining a detection result of a low, slow, small target in the infrared image according to a result output by the head network of the detection model; The training method of the detection model includes: Acquire a number of data samples annotated with labels, wherein the data samples are images including low, slow and small targets; the data samples satisfy one or more of the following conditions: the image background covers a specified background environment, the target type covers a specified type, and the target size is not less than a set size; Divide the data samples into training set, validation set and test set; For each data sample in the training set, the following steps are performed: input the data sample into the backbone network, input the data sample output by the backbone network into the neck network, use the coordinate attention processing module to perform coordinate attention processing on the data sample output by the neck network, and input the data sample after coordinate attention processing into the head network; the head network is pre-trained using the K-means clustering algorithm to generate pre-selected anchor boxes based on the training set; there are 9 pre-selected anchor boxes with different sizes, which are (10, 10), (14, 13), (16, 16), (22, 18), (24, 9), (26, 21), (31, 13), (40, 33), and (47, 17). Using transfer learning, the YOLOv4-tiny network is trained using a training set, and each model trained to a set number of times is verified using a validation set to select a training model when the loss function converges, and a set number of training models are pre-selected; and the pre-selected training models are tested using a test set, and the optimal detection model is selected according to evaluation indicators to obtain the trained detection model; the evaluation indicators are average precision, accuracy and recall rate; The selecting the optimal detection model according to the evaluation index comprises: Use the following formula to draw the PR curve based on precision and recall: Among them, P is the precision, R is the recall, C is the number of categories, AP is the area between the PR curve drawn according to the precision and recall and the coordinate axis, and mAP is the average AP value of each category; According to the evaluation indicators, the higher the average precision, AP, and mAP values, the better the detection performance and effect of the model, and the training model with the best evaluation indicators is determined as the optimal detection model; The step of inputting the data sample after the coordinate attention processing into the head network includes: When the head network performs feature recognition on each data sample after coordinate attention processing, it first generates multiple pre-selected anchor boxes, then predicts the category and offset for each pre-selected anchor box, then adjusts the position of the pre-selected anchor box according to the predicted offset to obtain a predicted bounding box, and finally selects the predicted bounding box containing low, slow and small objects; The head network identifies, based on each predicted bounding box, whether the box contains a low, slow, small object, as well as the category of the low, slow, small object, the horizontal coordinate of the center point, the vertical coordinate of the center point, the object width, and the object length; The using the coordinate attention processing module to perform coordinate attention processing on the data samples output by the neck network includes: Encode each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal tensor matrix and a vertical tensor matrix; Performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix, and decomposing the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample; Multiply each channel of the data sample with the corresponding horizontal attention weight matrix and vertical attention weight matrix to obtain the data sample after coordinate attention processing; The step of performing feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix includes: f=δ(F 1 ([B h ,B w ])) Among them, δ is the nonlinear activation function, F 1 is a 1×1 convolution operation, [.,.] is a concatenate operation along the spatial dimension, B h is the horizontal tensor matrix, B w is the vertical tensor matrix, and f is the obtained feature mapping matrix; Decomposing the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample includes: Decompose the feature map matrix into two separate tensor matrices along the horizontal coordinate direction and the vertical coordinate direction, and then transform the two tensor matrices into a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample through a 1*1 convolution operation; The feature map matrix is decomposed as follows: g h =σ(F h (f h )) g w =σ(F w (f w )) Among them, g h and g w are the horizontal attention weight matrix and vertical attention weight matrix of the data sample, σ is the sigmoid activation function, F h and F w is a 1×1 convolution operation, f h and f w They are the horizontal feature map tensor matrix and the vertical feature map tensor matrix obtained by decomposing the feature map matrix f.
2. The method according to claim 1, It is characterized in that The data samples output by the backbone network include: first feature maps and second feature maps of different prediction scales; The coordinate attention processing module performs coordinate attention processing on the data samples output by the neck network respectively: a processed first feature map output after convolution processing on the first feature map, and a spliced feature map obtained by tensor splicing of the processed first feature map and the second feature map after upsampling.
3. The method according to claim 2, It is characterized in that The data samples output by the backbone network also include: a third feature map, wherein the prediction scale of the third feature map is different from that of the first feature map and the second feature map; The coordinate attention processing module also performs coordinate attention processing on the data samples output by the neck network: the spliced feature map is upsampled, tensor spliced with the third feature map, and then feature extraction processing is performed to obtain a feature extraction map.
4. The method according to claim 1, It is characterized in that The data samples are encoded for each channel along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal tensor matrix and a vertical tensor matrix, including: The data samples are encoded along the horizontal coordinate direction according to the following formula: The data samples are encoded along the vertical coordinate direction according to the following formula: Where W and H are the width and height of the image, respectively, c is the number of channels of the data sample image, and X is the input data sample. is the output of the cth channel with height h, is the output of the cth channel with width w.
5. An infrared low-speed small target detection device, It is characterized in that include: An image acquisition unit, used for acquiring an infrared image to be detected; A detection model recognition unit, used for inputting the infrared image into a detection model generated by pre-training; The detection model is obtained based on YOLOv4-tiny network training. The YOLOv4-tiny network sequentially uses the backbone network, the neck network, the coordinate attention processing module and the head network to perform feature recognition on the infrared image. The backbone network adopts the CSPdarknet53-Tiny network. When the CSPdarknet53-Tiny network processes the residual block, the stack of the residual block is split into two parts. The backbone part stacks the residual blocks, and the convolution result and the other part of the residual block introduce a residual edge, and the activation function in the backbone network is modified to LeakyReLU. A detection result generating unit, configured to obtain a detection result of a low, slow, small target in the infrared image according to a result output by the head network of the detection model; The detection model recognition unit is used to obtain a number of data samples marked with labels when executing the generation of the detection model, wherein the data samples are images including low, slow and small targets; the data samples satisfy one or more of: the image background covers the specified background environment, the target type covers the specified type, and the target size is not less than the set size; Divide the data samples into training set, validation set and test set; For each data sample in the training set, the following steps are performed: input the data sample into the backbone network, input the data sample output by the backbone network into the neck network, use the coordinate attention processing module to perform coordinate attention processing on the data sample output by the neck network, and input the data sample after coordinate attention processing into the head network; the head network is pre-trained using the K-means clustering algorithm to generate pre-selected anchor boxes based on the training set; there are 9 pre-selected anchor boxes with different sizes, which are (10, 10), (14, 13), (16, 16), (22, 18), (24, 9), (26, 21), (31, 13), (40, 33), and (47, 17). Using transfer learning, the YOLOv4-tiny network is trained using a training set, and each model trained to a set number of times is verified using a validation set to select a training model when the loss function converges, and a set number of training models are pre-selected; and the pre-selected training models are tested using a test set, and the optimal detection model is selected according to evaluation indicators to obtain the trained detection model; the evaluation indicators are average precision, accuracy and recall rate; The selecting the optimal detection model according to the evaluation index comprises: Use the following formula to draw the PR curve based on precision and recall: Among them, P is the precision, R is the recall, C is the number of categories, AP is the area between the PR curve drawn according to the precision and recall and the coordinate axis, and mAP is the average AP value of each category; According to the evaluation indicators, the higher the average precision, AP, and mAP values, the better the detection performance and effect of the model, and the training model with the best evaluation indicators is determined as the optimal detection model; The step of inputting the data sample after the coordinate attention processing into the head network includes: When the head network performs feature recognition on each data sample after coordinate attention processing, it first generates multiple pre-selected anchor boxes, then predicts the category and offset for each pre-selected anchor box, then adjusts the position of the pre-selected anchor box according to the predicted offset to obtain a predicted bounding box, and finally selects the predicted bounding box containing low, slow and small objects; The head network identifies, based on each predicted bounding box, whether the box contains a low, slow, small object, as well as the category of the low, slow, small object, the horizontal coordinate of the center point, the vertical coordinate of the center point, the object width, and the object length; When the detection model recognition unit executes the coordinate attention processing of the data sample output by the neck network using the coordinate attention processing module, it is used to encode each channel of the data sample along the horizontal coordinate direction and the vertical coordinate direction to obtain a horizontal tensor matrix and a vertical tensor matrix; feature mapping the horizontal tensor matrix and the vertical tensor matrix to obtain a feature mapping matrix, and decompose the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample; multiply each channel of the data sample with the corresponding horizontal attention weight matrix and vertical attention weight matrix to obtain a data sample after coordinate attention processing; When the detection model recognition unit performs feature mapping on the horizontal tensor matrix and the vertical tensor matrix to obtain the feature mapping matrix, it is also specifically used to obtain the feature mapping matrix according to the following formula: f=δ(F 1 ([B h ,B w ])) Among them, δ is the nonlinear activation function, F 1 is a 1×1 convolution operation, [.,.] is a concatenate operation along the spatial dimension, B h is the horizontal tensor matrix, B w is the vertical tensor matrix, and f is the obtained feature mapping matrix; Decomposing the feature mapping matrix along the horizontal coordinate direction and the vertical coordinate direction respectively to obtain a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample includes: Decompose the feature map matrix into two separate tensor matrices along the horizontal coordinate direction and the vertical coordinate direction, and then transform the two tensor matrices into a horizontal attention weight matrix and a vertical attention weight matrix having the same number of channels as the data sample through a 1*1 convolution operation; The feature map matrix is decomposed as follows: g h =σ(F h (f h )) g w =σ(F w (f w )) Among them, g h and g w are the horizontal attention weight matrix and vertical attention weight matrix of the data sample, σ is the sigmoid activation function, F h and F w is a 1×1 convolution operation, f h and f w They are the horizontal feature map tensor matrix and the vertical feature map tensor matrix obtained by decomposing the feature map matrix f.
6. A computing device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 4.
