Dynamic adaptive label allocation method, device and equipment for small target detection

Through dynamic adaptive label allocation and dynamic weight loss function, the problem of insufficient number of positive samples and unreasonable weight calculation in small target detection methods is solved, and the accuracy and robustness of small target detection are significantly improved.

CN118470291BActive Publication Date: 2024-09-24NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410937752.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-09-24
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

Existing small target detection methods have shortcomings in accuracy. In particular, anchor frame-based detectors do not perform well on small targets, and there is a lack of weight calculation methods specifically for small target detection, resulting in positive samples differing from the true value of the target object. The relationship between boxes does not meet linear requirements, and most methods require manual setting of hyperparameters.

Method used

A dynamic adaptive label allocation method is adopted to adaptively allocate positive samples to each target object through a proportion-based label allocation strategy, and train a small target detection model through a pre-built dynamic weight loss function to dynamically adjust the label and weight of the anchor box. Make sure the model pays more attention to small target objects.

Benefits of technology

It significantly improves the accuracy of small target detection, especially the detection accuracy of tiny targets, avoids the need to manually set hyperparameters, and improves the sensitivity and robustness of the model to small targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118470291B
    Figure CN118470291B
Patent Text Reader

Abstract

The present invention relates to a dynamic adaptive label allocation method, device and equipment for small target detection, which obtains an image to be detected, processes the image to be detected according to a ratio-based label allocation method, and obtains a sample label allocation result; extracts features from the image to be detected to obtain detection head features; constructs a small target detection pre-training model, trains the small target detection pre-training model based on a pre-constructed dynamic weight loss function through the sample label allocation result and the detection head features to obtain a trained small target detection model; and performs small target detection on an input image through the trained small target detection model. The present invention can significantly improve the detection accuracy of small targets, even tiny targets, and can better complete the small target detection task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a dynamic adaptive label allocation method, device and equipment for small target detection. Background Art

[0002] Satellite and UAV remote sensing image target detection technology plays a very important role in environmental monitoring and protection, agriculture and natural resource management, urban planning and development, emergency response and risk management, scientific research and educational research, etc. With the development of deep learning technology, the accuracy of conventional target detection has been greatly improved, but the accuracy of conventional target detectors on small targets will be greatly reduced. For example, the accuracy of Faster R-CNN on the MS COCO 2017 dataset is 37.4%, but the accuracy on the AI-TOD dataset is only 11.1%. Therefore, the research on small target detection is of great significance to the breakthrough of deep learning and computer vision.

[0003] Although some existing methods for label assignment have significantly improved the accuracy on small object detection datasets, there are still some issues that have not been fully considered. First, for anchor-based detectors, the center point of each anchor is also the center point of each grid cell, the aspect ratio and size are pre-set and fixed, and the anchor boxes are roughly evenly distributed. Therefore, the larger the true value box of the target object, the more area it overlaps with the image, and the more anchor boxes it should obtain. In other words, the relationship between the number of positive samples and the true value box of the target object should be approximately linear, but the existing methods do not meet this requirement. In addition, most general target detection label assignment strategies and some existing improved methods for small target detection contain at least one hyperparameter that needs to be manually set. In addition, another important part related to label assignment is the weight calculation of the loss function. For example, in the hard label assignment strategy used by Faster R-CNN, the weights of all positive and negative samples are set to 1, and most of the existing soft label assignment strategies calculate the weight of each positive and negative sample based on the prediction results, lacking a weight calculation method specifically designed for small target detection. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device and equipment for dynamically adaptive label allocation of small targets, which can adaptively allocate positive samples to each target object, and improve the accuracy of small target detection through a special weight allocation method, in order to solve the above technical problems.

[0005] A dynamic adaptive label allocation method for small target detection, the method comprising:

[0006] Acquire an image to be detected, and process the image to be detected according to a ratio-based label assignment method to obtain a sample label assignment result;

[0007] Extracting features from the image to be detected to obtain detection head features;

[0008] Constructing a small target detection pre-training model, and training the small target detection pre-training model through the sample label assignment result and the detection head feature based on the pre-constructed dynamic weight loss function to obtain a trained small target detection model;

[0009] Perform small target detection on the input image using the trained small target detection model;

[0010] The step of obtaining an image to be detected and processing the image to be detected according to a ratio-based label assignment method to obtain a sample label assignment result includes:

[0011] Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object;

[0012] Obtain the number of anchor boxes whose center points fall within the true value box, recorded as the number of first anchor boxes; and dynamically obtain the number of anchor boxes within the true value box of the target object, recorded as the number of second anchor boxes;

[0013] Calculate the number of positive samples of the target object according to the number of the first anchor boxes and the number of the second anchor boxes;

[0014] Perform sample labeling on the anchor frame of the target object according to the number of positive samples, and output a sample labeling assignment result;

[0015] Performing sample labeling on the anchor frame of the target object according to the number of positive samples, and outputting sample labeling assignment results, including:

[0016] Calculate the IoU between the target object's true value box and each anchor box to obtain the corresponding IoU matrix;

[0017] Based on the IoU matrix, according to the number of positive samples, the anchor frame with the largest IoU corresponding to the number is marked as a positive sample; the anchor frame whose center point is not in the true value frame is marked as a negative sample; the other anchor frames except positive samples and negative samples are marked as ignored samples; and the sample label assignment result is output.

[0018] A dynamic adaptive label allocation device for small target detection, the device comprising:

[0019] A data processing module is used to obtain an image to be detected, process the image to be detected according to a label assignment method based on a ratio, and obtain a sample label assignment result; perform feature extraction on the image to be detected, and obtain a detection head feature;

[0020] A model training module is used to construct a small target detection pre-training model, and based on a pre-constructed dynamic weight loss function, the small target detection pre-training model is trained through the sample label allocation result and the detection head feature to obtain a trained small target detection model;

[0021] Small target detection module, used to detect small targets in input images using a trained small target detection model;

[0022] In the data processing module, an image to be detected is obtained, and the image to be detected is processed according to a label assignment method based on a ratio to obtain a sample label assignment result, including:

[0023] Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object;

[0024] Obtain the number of anchor boxes whose center points fall within the true value box, recorded as the number of first anchor boxes; and dynamically obtain the number of anchor boxes within the true value box of the target object, recorded as the number of second anchor boxes;

[0025] Calculate the number of positive samples of the target object according to the number of the first anchor boxes and the number of the second anchor boxes;

[0026] Perform sample labeling on the anchor frame of the target object according to the number of positive samples, and output a sample labeling assignment result;

[0027] Performing sample labeling on the anchor frame of the target object according to the number of positive samples, and outputting sample labeling assignment results, including:

[0028] Calculate the IoU between the target object's true value box and each anchor box to obtain the corresponding IoU matrix;

[0029] Based on the IoU matrix, according to the number of positive samples, the anchor frame with the largest IoU corresponding to the number is marked as a positive sample; the anchor frame whose center point is not in the true value frame is marked as a negative sample; the other anchor frames except positive samples and negative samples are marked as ignored samples; and the sample label assignment result is output.

[0030] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0031] Step 202, obtaining an image to be detected, processing the image to be detected according to a ratio-based label assignment method to obtain a sample label assignment result; performing feature extraction on the image to be detected to obtain a detection head feature;

[0032] Step 204, constructing a small target detection pre-training model, based on the pre-constructed dynamic weight loss function, training the small target detection pre-training model through the sample label allocation result and the detection head feature to obtain a trained small target detection model;

[0033] Step 206, performing small target detection on the input image using the trained small target detection model;

[0034] The step of obtaining an image to be detected and processing the image to be detected according to a ratio-based label assignment method to obtain a sample label assignment result includes:

[0035] Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object;

[0036] Obtain the number of anchor boxes whose center points fall within the true value box, recorded as the number of first anchor boxes; and dynamically obtain the number of anchor boxes within the true value box of the target object, recorded as the number of second anchor boxes;

[0037] Calculate the number of positive samples of the target object according to the number of the first anchor boxes and the number of the second anchor boxes;

[0038] Perform sample labeling on the anchor frame of the target object according to the number of positive samples, and output a sample labeling assignment result;

[0039] Performing sample labeling on the anchor frame of the target object according to the number of positive samples, and outputting sample labeling assignment results, including:

[0040] Calculate the IoU between the target object's true value box and each anchor box to obtain the corresponding IoU matrix;

[0041] Based on the IoU matrix, according to the number of positive samples, the anchor frame with the largest IoU corresponding to the number is marked as a positive sample; the anchor frame whose center point is not in the true value frame is marked as a negative sample; the other anchor frames except positive samples and negative samples are marked as ignored samples; and the sample label assignment result is output.

[0042] The above-mentioned dynamic adaptive label allocation method, device and equipment for small target detection obtains the image to be detected, processes the image to be detected according to the label allocation method based on the ratio, and obtains the sample label allocation result; extracts the feature of the image to be detected to obtain the detection head feature; constructs a small target detection pre-training model, and trains the small target detection pre-training model based on the pre-constructed dynamic weight loss function through the sample label allocation result and the detection head feature to obtain the trained small target detection model; and performs small target detection on the input image through the trained small target detection model. The present invention can adaptively allocate the number of positive samples to the target object according to the size ratio of the target object through the label allocation method based on the ratio, thereby dynamically performing label allocation without manually setting hyperparameters; and, the small target detection pre-training model is trained through the pre-constructed dynamic weight loss function, so that the whole training process pays more attention to the small target object, thereby significantly improving the detection accuracy of small targets, even tiny targets, and thus better completing the small target detection task. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0044] Figure 1 A schematic diagram of a flow chart of a dynamic adaptive label allocation method for small target detection in one embodiment;

[0045] Figure 2 A schematic diagram of the framework structure of a small target detection model training process in an embodiment;

[0046] Figure 3 This is a schematic diagram of the comparison of the first group of detection effects in an embodiment, wherein: Figure 3 (a) is the detection result obtained by using the original label assignment strategy. Figure 3 (b) is the test result obtained using DALA;

[0047] Figure 4 : is a schematic diagram for comparing the detection effects of the second group in one embodiment, wherein: Figure 4 (a) is the detection result obtained by using the original label assignment strategy. Figure 4 (b) is the test result obtained using DALA;

[0048] Figure 5 It is a structural block diagram of a dynamic adaptive label allocation device for small target detection in one embodiment;

[0049] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment.

[0050] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0052] It should be noted that in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0053] The following will describe the implementation of the present invention in detail with reference to the accompanying drawings in the embodiment diagram of the present invention.

[0054] In one embodiment, Figure 1 As shown, a dynamic adaptive label allocation method for small target detection is provided, comprising the following steps:

[0055] Step 202, obtain the image to be detected, process the image to be detected according to the ratio-based label assignment method, and obtain the sample label assignment result; perform feature extraction on the image to be detected to obtain the detection head feature.

[0056] It can be understood that first, a data set is obtained, and then the data set is divided to obtain a training set, a test set, and a validation set; the data set includes a number of images to be detected, and after sample allocation of the target images in the images to be detected, they are input into the small target detection pre-training model together with the detection head features for training. Preferably, existing small target detection data sets such as AI-TOD, visdrone, etc. can be used, or images can be collected manually, and the images can be annotated and processed before use as data sets.

[0057] The ratio based label assignment strategy (RLA) proposed in the present invention adaptively allocates an appropriate number of positive samples to each target object according to the ratio of the target object size in the image to be detected, so as to ensure that there are enough positive samples for small targets, so that the model can better learn the characteristics of small targets, thereby improving detection accuracy and avoiding false detection.

[0058] Moreover, in conventional object detection, the number of positive samples is usually much less than the number of negative samples. For small objects, if there are not enough positive samples, the model may ignore these small objects. The ratio-based label assignment method ensures that each small object has a positive sample, which helps to balance the positive and negative samples, improve the model's sensitivity to small objects, and avoid missed detection.

[0059] Step 204, construct a small target detection pre-training model, based on the pre-constructed dynamic weight loss function, train the small target detection pre-training model through the sample label allocation results and the detection head features to obtain a trained small target detection model.

[0060] It can be understood that the pre-built dynamic weighting loss function (DLA) is mainly used to assign larger training weights to target objects with smaller sizes (fewer positive samples), so that the entire model training process pays more attention to the area where small targets are located, focuses more on small targets that are difficult to detect, improves the accuracy of small target detection, and thus better completes the small target detection task.

[0061] Step 206: Perform small target detection on the input image using the trained small target detection model.

[0062] See also Figure 2 , which is a schematic diagram of the framework structure of the training process of the small target detection pre-training model. It can be seen that in the training stage, on the one hand, a ratio-based label assignment method is used to assign sample labels to the images to be detected, and the sample label assignment results are obtained; on the other hand, the images to be detected are sequentially input into the backbone network, feature pyramid, and detection head for data processing, and the detection head features including classification features, regression features, and confidence features are obtained; then, based on the pre-constructed dynamic weight loss function, the small target detection pre-training model is trained through the sample label assignment results and the detection head features, so as to obtain a trained small target detection model.

[0063] After training, in the inference stage, the image is sequentially input into the backbone network, feature pyramid, and detection head for data processing. After the detection head features are obtained, it is input into the small target detection model for small target detection marking.

[0064] The above-mentioned dynamic adaptive label allocation method for small target detection obtains an image to be detected, processes the image to be detected according to a label allocation method based on a ratio, and obtains a sample label allocation result; performs feature extraction on the image to be detected to obtain a detection head feature; constructs a small target detection pre-training model, and trains the small target detection pre-training model based on a pre-constructed dynamic weight loss function through the sample label allocation result and the detection head feature to obtain a trained small target detection model; performs small target detection on the input image through the trained small target detection model. The present invention can adaptively allocate the number of positive samples to the target object according to the size ratio of the target object through a label allocation method based on a ratio, thereby dynamically performing label allocation without manually setting hyperparameters; and, the small target detection pre-training model is trained through a pre-constructed dynamic weight loss function, so that the entire training process pays more attention to small target objects, thereby significantly improving the detection accuracy of small targets, even tiny targets, and thus better completing the small target detection task.

[0065] In one embodiment, an image to be detected is obtained, and the image to be detected is processed according to a ratio-based label assignment method to obtain a sample label assignment result, including:

[0066] Identify the target object in the image to be detected and determine the true value box and anchor box of the target object.

[0067] The number of anchor boxes whose center points fall within the true value box is obtained, which is recorded as the number of first anchor boxes; and the number of anchor boxes in the true value box of the target object is dynamically obtained, which is recorded as the number of second anchor boxes.

[0068] The number of positive samples of the target object is calculated based on the number of the first anchor boxes and the number of the second anchor boxes.

[0069] The anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment results are output.

[0070] In one embodiment, the number of positive samples of the target object is calculated based on the number of first anchor boxes and the number of second anchor boxes. The process expression is:

[0071] ;

[0072] In the formula, Indicates the number of positive samples of the target object; Indicates the number of first anchor boxes; Indicates the number of second anchor boxes dynamically acquired during training; Indicates the maximum value operation; Represents an operation to take the average value.

[0073] It can be seen that the above formula ensures that each target object has at least one positive sample. In addition, the number of second anchor boxes It is the number of anchor boxes in the true value box of each target object during the training process. This number accumulates with the training process and is a dynamically changing variable. Therefore, by dynamically obtaining the number of second anchor boxes, the number of positive samples of the target object can be adaptively changed to adapt to different target object sizes and numbers, improve detection accuracy, provide more reliable and accurate detection results, and enhance robustness.

[0074] In one embodiment, the anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment result is output, including:

[0075] Calculate the IoU between the target object truth box and each anchor box to get the corresponding IoU matrix.

[0076] Based on the IoU matrix, according to the number of positive samples, the anchor box with the largest IoU corresponding to the number is marked as a positive sample; the anchor box whose center point is not in the true value box is marked as a negative sample; the other anchor boxes except positive samples and negative samples are marked as ignored samples; the sample label assignment result is output.

[0077] In one embodiment, the dynamic weight loss function expression is:

[0078] ;

[0079] In the formula, Represents the number of true value boxes in the image to be detected; Indicates The number of positive samples of the true value box, Indicates the number of negative samples; Indicates The first truth frame Positive sample weights; Represents the weight of negative samples; represents the basic loss function of regression; Represents the basic loss function for positive sample classification; Represents the basic loss function for negative sample classification; Indicates Negative samples.

[0080] In one of the embodiments, the average value of the positive sample weights is used as the negative sample weight.

[0081] In one embodiment, the expression of the positive sample weight is:

[0082] ;

[0083] In the formula, Indicates The area of ​​the truth box.

[0084] In one embodiment, the expression of negative sample weight is:

[0085] .

[0086] It can be understood that the positive sample weight is calculated according to the size of the target object corresponding to each positive sample. The smaller the area of ​​the target object, the greater the positive sample weight of each anchor box, so as to ensure that they obtain sufficient supervision signals. Specifically, the core operation of the positive sample weight formula is to calculate the average area of ​​the true value box and the The ratio of the area of ​​the ground truth box.

[0087] In addition, taking the average of the positive sample weights as the negative sample weight can balance the weights of positive and negative samples, prevent the bias caused by weight imbalance, improve the detection ability of small targets, reduce false positives and false negatives, and improve the generalization performance of the model.

[0088] It is worth noting that the loss function based on regression can adopt the L1 loss function; the loss function based on classification can adopt the cross entropy loss function.

[0089] In one of the embodiments, in order to verify the effectiveness of the dynamic adaptive label assignment method for small object detection (DALA) proposed in the present invention, the general object detector Faster R-CNN is used as a benchmark, and the original label assignment strategy based on IoU and fixed threshold and the DALA proposed in the present invention are used for detection. For fairness, we train and test on the small object detection benchmark dataset AI-TOD.

[0090] The comparison results are as follows Figure 3 , Figure 4 As shown, Figure 3 (a) Figure 4 (a) is the detection result obtained using the original label assignment strategy. Figure 3 (b) Figure 4 (b) is the detection result obtained by using the DALA proposed in the present invention, wherein the correctly detected target object is marked with a green rectangular frame, the falsely detected target object is marked with a blue rectangular frame, and the missed target object is marked with a red rectangular frame. It can be seen that the detection effect of the DALA proposed in the present invention is significantly improved.

[0091] In addition, a detailed experimental comparison was carried out on the AI-TOD dataset, and the results are shown in Table 1, where the 1st to 7th rows are a two-stage anchor-based detection method, the 8th to 10th rows are a one-stage anchor-based detection method, the 11th to 14th rows are a one-stage anchor-free detection method, and the last 5 rows are the detection results obtained by applying the DALA proposed in the present invention to the basic detector. It can be found that the DALA proposed in the present invention improves the detection accuracy of the basic detectors RetinaNet, FCOS, Faster R-CNN, Cascade R-CNN and DetectoRS by 7.4, 4.7, 12.5, 11.3 and 11.5 respectively, which shows that the DALA proposed in the present invention is very effective for small target detection tasks.

[0092] Table 1 Comparison of some test results on the small target detection dataset AI-TOD

[0093]

[0094] In summary, the dynamic adaptive label allocation method for small target detection proposed in the present invention can handle small target detection tasks well, especially for very small target objects, the improvement of detection accuracy is more obvious.

[0095] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0096] In one embodiment, Figure 5 As shown, a dynamic adaptive label allocation device for small target detection is provided, including: a data processing module 402, a model training module 404 and a small target detection module 406, wherein:

[0097] The data processing module 402 is used to obtain the image to be detected, process the image to be detected according to the ratio-based label assignment method to obtain the sample label assignment result; and perform feature extraction on the image to be detected to obtain the detection head feature.

[0098] The model training module 404 is used to construct a small target detection pre-training model. Based on the pre-constructed dynamic weight loss function, the small target detection pre-training model is trained through the sample label allocation results and the detection head features to obtain a trained small target detection model.

[0099] The small target detection module 406 is used to perform small target detection on the input image using a trained small target detection model.

[0100] In the data processing module 402, an image to be detected is obtained, and the image to be detected is processed according to a label assignment method based on a ratio to obtain a sample label assignment result, including:

[0101] Identify the target object in the image to be detected and determine the true value box and anchor box of the target object.

[0102] The number of anchor boxes whose center points fall within the true value box is obtained, which is recorded as the number of first anchor boxes; and the number of anchor boxes in the true value box of the target object is dynamically obtained, which is recorded as the number of second anchor boxes.

[0103] The number of positive samples of the target object is calculated based on the number of the first anchor boxes and the number of the second anchor boxes.

[0104] The anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment results are output.

[0105] The anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment results are output, including:

[0106] Calculate the IoU between the target object truth box and each anchor box to get the corresponding IoU matrix.

[0107] Based on the IoU matrix, according to the number of positive samples, the anchor box with the largest IoU corresponding to the number is marked as a positive sample; the anchor box whose center point is not in the true value box is marked as a negative sample; the other anchor boxes except positive samples and negative samples are marked as ignored samples; the sample label assignment result is output.

[0108] For the specific limitations on the dynamic adaptive label allocation device for small target detection, please refer to the limitations on the dynamic adaptive label allocation method for small target detection in the above text, which will not be repeated here. Each module in the above-mentioned dynamic adaptive label allocation device for small target detection can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0109] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store dynamic adaptive label allocation data for small target detection. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a dynamic adaptive label allocation method for small target detection is implemented.

[0110] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0111] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0112] Step 202, obtain the image to be detected, process the image to be detected according to the ratio-based label assignment method, and obtain the sample label assignment result; perform feature extraction on the image to be detected to obtain the detection head feature.

[0113] Specifically, an image to be detected is obtained, and the image to be detected is processed according to a ratio-based label assignment method to obtain a sample label assignment result, including:

[0114] Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object.

[0115] The number of anchor boxes whose center points fall within the true value box is obtained, which is recorded as the number of first anchor boxes; and the number of anchor boxes in the true value box of the target object is dynamically obtained, which is recorded as the number of second anchor boxes.

[0116] The number of positive samples of the target object is calculated based on the number of the first anchor boxes and the number of the second anchor boxes.

[0117] The anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment results are output.

[0118] The anchor boxes of the target objects are labeled according to the number of positive samples, and the sample label assignment results are output, including:

[0119] Calculate the IoU between the target object truth box and each anchor box to get the corresponding IoU matrix.

[0120] Based on the IoU matrix, according to the number of positive samples, the anchor box with the largest IoU corresponding to the number is marked as a positive sample; the anchor box whose center point is not in the true value box is marked as a negative sample; the other anchor boxes except positive samples and negative samples are marked as ignored samples; the sample label assignment result is output.

[0121] Step 204, construct a small target detection pre-training model, based on the pre-constructed dynamic weight loss function, train the small target detection pre-training model through the sample label allocation results and the detection head features to obtain a trained small target detection model.

[0122] Step 206: Perform small target detection on the input image using the trained small target detection model.

[0123] It will be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program may be stored in a non-volatile computer-readable storage medium, and when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0124] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0125] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A dynamic adaptive label allocation method for small target detection, characterized in that: The method comprises: Acquire an image to be detected, process the image to be detected according to a ratio-based label assignment method, and obtain a sample label assignment result; perform feature extraction on the image to be detected, and obtain a detection head feature including a classification feature, a regression feature, and a confidence feature; Constructing a small target detection pre-training model, and training the small target detection pre-training model through the sample label assignment result and the detection head feature based on the pre-constructed dynamic weight loss function to obtain a trained small target detection model; Perform small target detection on the input image using the trained small target detection model; The step of obtaining an image to be detected and processing the image to be detected according to a ratio-based label assignment method to obtain a sample label assignment result includes: Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object; Obtain the number of anchor boxes whose center points fall within the true value box, recorded as the number of first anchor boxes; and dynamically obtain the number of anchor boxes within the true value box of the target object, recorded as the number of second anchor boxes; Calculate the number of positive samples of the target object according to the number of the first anchor boxes and the number of the second anchor boxes; Perform sample labeling on the anchor frame of the target object according to the number of positive samples, and output a sample labeling assignment result; Performing sample labeling on the anchor frame of the target object according to the number of positive samples, and outputting sample labeling assignment results, including: Calculate the IoU between the target object's true value box and each anchor box to obtain the corresponding IoU matrix; Based on the IoU matrix, according to the number of positive samples, the anchor frame with the largest IoU corresponding to the number is marked as a positive sample; the anchor frame whose center point is not in the true value frame is marked as a negative sample; other anchor frames except positive samples and negative samples are marked as ignored samples; and the sample label assignment result is output; The number of positive samples of the target object is calculated based on the number of the first anchor boxes and the number of the second anchor boxes. The process expression is: ; In the formula, Indicates the number of positive samples of the target object; Indicates the number of first anchor boxes; Indicates the number of second anchor boxes dynamically acquired during training; Indicates the maximum value operation; Represents an operation to take the average value.

2. The dynamic adaptive label allocation method for small target detection according to claim 1 is characterized in that: The dynamic weight loss function expression is: ; In the formula, Represents the number of true value boxes in the image to be detected; Indicates The number of positive samples of the true value box, Indicates the number of negative samples; Indicates The first truth frame Positive sample weights; Represents the weight of negative samples; represents the basic loss function of regression; Represents the basic loss function for positive sample classification; Represents the basic loss function for negative sample classification; represents the kth negative sample.

3. The dynamic adaptive label allocation method for small target detection according to claim 2 is characterized in that: The average value of the positive sample weights is used as the negative sample weight.

4. The dynamic adaptive label allocation method for small target detection according to claim 3 is characterized in that: The expression of the positive sample weight is: ; In the formula, Indicates The area of ​​the truth box.

5. The dynamic adaptive label allocation method for small target detection according to claim 3 is characterized in that: The expression of the negative sample weight is: 。 6. A dynamic adaptive label allocation device for small target detection, characterized in that: The device comprises: The data processing module is used to obtain the image to be detected, process the image to be detected according to the ratio-based label assignment method, and obtain the sample label assignment result; perform feature extraction on the image to be detected to obtain the detection head feature including classification feature, regression feature and confidence feature; A model training module is used to construct a small target detection pre-training model, and based on a pre-constructed dynamic weight loss function, the small target detection pre-training model is trained through the sample label allocation result and the detection head feature to obtain a trained small target detection model; Small target detection module, used to detect small targets in input images using a trained small target detection model; In the data processing module, an image to be detected is obtained, and the image to be detected is processed according to a label assignment method based on a ratio to obtain a sample label assignment result, including: Identify the target object in the image to be detected, and determine the true value box and anchor box of the target object; Obtain the number of anchor boxes whose center points fall within the true value box, recorded as the number of first anchor boxes; and dynamically obtain the number of anchor boxes within the true value box of the target object, recorded as the number of second anchor boxes; Calculate the number of positive samples of the target object according to the number of the first anchor boxes and the number of the second anchor boxes; Perform sample labeling on the anchor frame of the target object according to the number of positive samples, and output a sample labeling assignment result; Performing sample labeling on the anchor frame of the target object according to the number of positive samples, and outputting sample labeling assignment results, including: Calculate the IoU between the target object's true value box and each anchor box to obtain the corresponding IoU matrix; Based on the IoU matrix, according to the number of positive samples, the anchor frame with the largest IoU corresponding to the number is marked as a positive sample; the anchor frame whose center point is not in the true value frame is marked as a negative sample; other anchor frames except positive samples and negative samples are marked as ignored samples; and the sample label assignment result is output; The number of positive samples of the target object is calculated based on the number of the first anchor boxes and the number of the second anchor boxes. The process expression is: ; In the formula, Indicates the number of positive samples of the target object; Indicates the number of first anchor boxes; Indicates the number of second anchor boxes dynamically acquired during training; Indicates the maximum value operation; Represents an operation to take the average value.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the dynamic adaptive label allocation method for small target detection according to any one of claims 1 to 5 are implemented.