Remote sensing image small-scale target detection model training method
By introducing cross-attention feature refinement upsampling module and weighted paradigm guidance into the remote sensing image detection model, the problem of insufficient detection performance of small-scale targets in remote sensing images is solved, and accurate detection and classification of small-scale targets are achieved.
Patent Information
- Application Number
- CN202410640023.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-06
AI Technical Summary
Existing technologies exhibit suboptimal performance in detecting small-scale targets in remote sensing images, making it difficult to accurately detect small-scale target objects, especially in complex backgrounds.
The cross-attention-based feature refinement upsampling module is used, combined with the backbone network, neck network and detection head network, to build the global correlation of multi-scale features through the cross-attention mechanism, refine the upsampling results of deep feature images, and pass The weighted paradigm guides the optimization model to improve target positioning and classification accuracy.
It achieves accurate detection and classification of small-scale targets in remote sensing images, improves detection performance, and can accurately identify small-scale target objects in complex backgrounds.
Smart Images

Figure CN118608942A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of small-scale target detection in remote sensing images, and in particular to a remote sensing image small-scale target detection model training method. Background Art
[0002] Target detection is a classic problem in remote sensing intelligent interpretation tasks. It can be used to classify and locate targets in remote sensing images, and has shown broad application prospects in the fields of ocean monitoring and smart transportation. Affected by factors such as shooting distance, angle, and sensor resolution, there are a large number of small-scale targets in remote sensing images. Compared with targets of regular size, small-scale targets have a more blurred appearance, usually appear densely in remote sensing images, and are easily submerged by complex backgrounds. In addition, small-scale target detection is more sensitive to the error of the regression frame. In summary, small-scale target detection is a difficult problem in the field of target detection.
[0003] With the rapid development of deep learning technology and hardware level, research on target detection technology has made great progress and performed well in natural scene target detection tasks. However, when faced with small-scale target detection tasks in remote sensing images, these target detectors usually can only show suboptimal detection performance. Therefore, how to train a model that can accurately detect small-scale target objects in remote sensing images is an issue that technicians are increasingly concerned about. Summary of the invention
[0004] The embodiments of the present application provide a remote sensing image small-scale target detection model framework and a training method. The remote sensing image small-scale target detection model trained by the method can accurately detect small-scale target objects in remote sensing images.
[0005] In a first aspect, an embodiment of the present application provides a remote sensing image small-scale target detection model training method, including: constructing a remote sensing image small-scale target detection model; training the remote sensing image small-scale target detection model through sample remote sensing images to obtain a trained remote sensing image small-scale target detection model; testing the trained remote sensing image small-scale target detection model; wherein the remote sensing image small-scale target detection model includes a backbone network, a neck network and a detection head network, the backbone network is used to extract feature information in the remote sensing image to obtain N feature images, the neck network is used to fuse the N feature images to obtain a target feature image, the detection head network is used to output the positioning reliability of the target object in the remote sensing image, the classification score of the target object in the remote sensing image and the regression parameters of the target object in the remote sensing image, the regression parameters are used to characterize the size and position information of the target object positioning box in the remote sensing image, and the size and number of channels of each feature image are different.
[0006] In the above embodiment, on the one hand, by adding a feature refinement upsampling module based on cross-attention to the constructed remote sensing image small-scale target detection model, the module relies on the cross-attention mechanism to construct the global correlation of multi-scale features, which can effectively refine the upsampling results of the deep feature image to achieve spatial alignment of multi-scale features, which is beneficial to the precise positioning and classification of the target, so that the remote sensing image small-scale target detection model can accurately detect the target objects in the remote sensing image.
[0007] In combination with the first aspect, in a possible implementation manner, N feature images are fused to obtain a multi-scale feature image, specifically including:
[0008] According to the formula
[0009] Calculate the cross attention image of two adjacent feature images in the N feature images output by the backbone network; according to the formula Refine(C n , C n-1 )=Upsample(C n )+CrossAttention(C n , C n-1 ) obtains the refined processing result of the first image corresponding to the two adjacent feature images of different scales, where the first image is an upsampled image obtained by upsampling the deep feature image in the two adjacent feature images of different scales; the first image is fused with the shallow feature images of the two adjacent feature images to obtain a multi-scale feature image; wherein, C n is the deep feature image in two adjacent feature images, C n-1 is the shallow feature image in two adjacent feature images, Upsample is the upsampling function, P n and the P n-1 is a mapping function used to convert feature images into feature vectors, W q Used to map the feature vector to the query vector Q, the W k Used to map feature vectors to key vectors K, W v Used to map the feature vector to the value vector V,d k is the size of the shallow feature image in two adjacent feature images.
[0010] In combination with the first aspect, in one possible implementation method, a remote sensing image small-scale target detection model is trained using sample remote sensing images to obtain a trained remote sensing image small-scale target detection model, specifically including: calculating the weight value of each positive sample in the remote sensing image small-scale target detection model; calculating the positioning confidence loss of the target object, the classification loss of the target object, and the regression parameter loss of the remote sensing image small-scale target detection model; calculating the overall loss value of the remote sensing image small-scale target detection model based on the positioning confidence loss of the target object, the classification loss of the target object, and the regression parameter loss of the remote sensing image small-scale target detection model; and adjusting the network parameters and / or network structure of the remote sensing image small-scale target detection model based on the overall loss value.
[0011] In combination with the first aspect, in a possible implementation method, the weight value of each positive sample in the remote sensing image small-scale target detection model is calculated, specifically including: according to the formula
[0012] Calculate the weight value of each positive sample in the remote sensing image small-scale target detection model; where w i is the weight value of the i-th positive sample in the remote sensing image small-scale target detection model, IoU i is the intersection-over-union ratio of the i-th positive sample and the corresponding target area, j is the target area number of the current sample remote sensing image, and IoU j,mean is the average intersection-over-union ratio of all positive samples in the jth target region to the corresponding target region, and α(t) is the modulation factor.
[0013] In combination with the first aspect, in a possible implementation method, the positioning confidence loss of the target object, the classification loss of the target object and the regression parameter loss of the remote sensing image small-scale target detection model are calculated, specifically including:
[0014] According to the formula Calculate the positioning confidence loss of the small-scale target detection model of remote sensing images for the target objects in the sample remote sensing images;
[0015] According to the formula Calculate the classification loss of the small-scale target detection model of remote sensing images for the target objects in the sample remote sensing images;
[0016] According to the formula Calculate the regression parameter loss of the remote sensing image small-scale target detection model for the sample remote sensing image;
[0017] Among them, M1 is the number of positive samples of the remote sensing image small-scale target detection model, M2 is the number of negative samples of the remote sensing image small-scale target detection model, is the target confidence score of the i-th positive sample in a single sample remote sensing image output by the detection head network, is the target confidence score of the i-th negative sample in a single sample remote sensing image output by the detection head network, is the actual intersection-over-union ratio between the ith positive sample and the corresponding target, l i is the matching value between the i-th positive sample output by the detection head network and each preset category, c i is the actual matching value between the ith positive sample and each preset category, m i The target area located by the i-th positive sample output by the detection head network, is the actual target area corresponding to the i-th positive sample, and the Loss BCE is the cross entropy loss, according to the formula Calculate, where Nc is the number of target categories in the sample remote sensing image dataset, and Loss IoU is the IoU loss, according to the formula Loss IoU (m,gt)=1-IoU(m,gt) calculation.
[0018] In combination with the first aspect, in a possible implementation, the modulation factor α(t) can be calculated according to the formula
[0019]
[0020] in, epochs is the total number of training iterations of the remote sensing image training set, and epoch is the number of iterations of the current remote sensing image training set training. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The following is an introduction to the drawings used in the embodiments of the present application.
[0022] Figure 1 This is a flowchart of a remote sensing image small-scale target detection model training provided by an embodiment of the present application;
[0023] Figure 2 This is another remote sensing image small-scale target detection model training flow chart provided in an embodiment of the present application;
[0024] Figure 3 It is a flow chart of a remote sensing image small-scale target detection model detection method provided by an embodiment of the present application;
[0025] Figure 4 is an exemplary structural diagram of a remote sensing image small-scale target detection model training device provided in an embodiment of the present application;
[0026] Figure 5 It is an exemplary structural diagram of a remote sensing image small-scale target detection model training device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiments may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0028] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.
[0029] Only the part relevant to the present application but not all content is shown in the accompanying drawings.Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods described as flow charts.Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously.In addition, the order of various operations can be rearranged.Described processing can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings.Described processing can correspond to method, function, procedure, subroutine, subprogram etc.
[0030] As used in this specification, the terms "component", "module", "system", "unit", etc. are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).
[0031] Target detection is a classic problem in remote sensing intelligent interpretation tasks. It can be used to classify and locate targets in remote sensing images, and has shown broad application prospects in the fields of ocean monitoring and smart transportation. Affected by factors such as shooting distance, angle, and sensor resolution, there are a large number of small-scale targets in remote sensing images. Compared with targets of regular size, small-scale targets have a more blurred appearance, usually appear densely in remote sensing images, and are easily submerged by complex backgrounds. In addition, small-scale target detection is more sensitive to the error of the regression frame. In summary, small-scale target detection is a difficult problem in the field of target detection.
[0032] With the rapid development of deep learning technology and hardware level, research on target detection technology has made great progress and performed well in natural scene target detection tasks. However, when faced with small-scale target detection tasks in remote sensing images, these target detectors usually can only show suboptimal detection performance. Therefore, how to train a detection model that can accurately detect target objects in remote sensing images is an issue that technicians are increasingly concerned about.
[0033] Therefore, in order to solve the above problems, the embodiment of the present application proposes a remote sensing image small-scale target detection model framework and training method, and the remote sensing image small-scale target detection model trained by this method can accurately identify the target object in the remote sensing image and improve the accuracy of remote sensing image recognition. Below, the process of a remote sensing image small-scale target detection model training method provided by the embodiment of the present application is introduced in conjunction with the accompanying drawings.
[0034] See also Figure 1 , Figure 1 This is a flowchart of a remote sensing image model training provided by an embodiment of the present application. The specific process is as follows:
[0035] S101: Construct a small-scale target detection model for remote sensing images, wherein the remote sensing target detection model includes a backbone network, a neck network and a detection head network; wherein the backbone network is used to extract feature information in the remote sensing image to obtain N feature images, the neck network is used to fuse the N feature images to obtain a multi-scale feature image, the detection head network performs detection processing on the target feature image, and outputs the positioning reliability of the target object in the remote sensing image, the classification score of the target object in the remote sensing image and the regression parameter of the target object in the remote sensing image, wherein the regression parameter is used to characterize the size and position information of the positioning box of the target object in the remote sensing image, and the size and number of channels of each feature image are different.
[0036] Specifically, before training the remote sensing image small-scale target detection model, a remote sensing image small-scale target detection model can be constructed first. The constructed remote sensing image small-scale target detection model includes a backbone network, a neck network, and a detection head network.
[0037] Among them, the backbone network is used to extract the feature information of the remote sensing image, thereby obtaining N feature images, each of which includes the feature information of the remote sensing image, and the size and number of channels of each feature image are different. The backbone network can use the downsampling method to extract the feature information of the remote sensing image, thereby obtaining the feature image. The backbone network can sample the pixels in the remote sensing image with a step size of n1, thereby obtaining feature image 1, and the size of feature image 1 is smaller than the size of the remote sensing image. After obtaining feature image 1, the backbone network can sample the pixels in feature image 1 with a step size of n2, thereby obtaining feature image 2, and the size of feature image 2 is smaller than the size of feature image 1. After obtaining feature image 2, the backbone network can sample the pixels in feature image 2 with a step size of n3, thereby obtaining feature image 3, and the size of feature image 3 is smaller than the size of feature image 2.
[0038] In this way, the backbone network can downsample the previous feature image to obtain a new feature image, so that multiple feature images of different sizes and different numbers of channels can be obtained. For a remote sensing image small-scale target detection model, its backbone network must extract at least three feature images of the remote sensing image, and the size and number of channels of each frame feature image are different. The embodiment of the present application takes the backbone network extracting three feature images of the remote sensing image as an example for explanation.
[0039] It should be understood that two adjacent feature images can be divided into deep feature images and shallow feature images according to the size of the feature images. For example, feature image 2 is smaller in size than feature image 1, and feature image 2 is a deep feature image relative to feature image 1, while feature image 1 is a shallow feature image relative to feature image 2; feature image 3 is smaller in size than feature image 2, and feature image 3 is a deep feature image relative to feature image 2, while feature image 2 is a shallow feature image relative to feature image 3.
[0040] The neck network is used to fuse the feature information of multiple feature images output by the backbone network to obtain a target feature image, so that the remote sensing image small-scale target detection model can detect the target object in the target feature image. The neck network includes multiple feature refinement upsampling modules based on cross-attention. Each feature refinement upsampling module based on cross-attention can associate the feature information in two adjacent feature images, thereby outputting the first image corresponding to the two adjacent feature images. The first image is an image obtained by refining the upsampled image obtained by upsampling the deep feature image in the two adjacent feature images. If the number of feature images is N, the number of feature refinement upsampling modules based on cross-attention is N-1.
[0041] For example, in the above embodiment, feature images 1 to 3 are included, so feature image 1 and feature image 2 are adjacent feature images, and feature image 2 and feature image 3 are adjacent feature images. Then, feature image 1 and feature image 2 are processed by a feature refinement upsampling module based on cross-attention, and feature image 2 and feature image 3 are processed by a feature refinement upsampling module based on cross-attention. The feature refinement upsampling module based on cross-attention can align the multi-scale feature space of the two feature images through the cross-attention algorithm, thereby obtaining a deep feature map refinement upsampling result.
[0042] The feature refinement upsampling module based on cross attention can obtain the cross attention image CrossAttention (C n , C n-1 ), formula (1) is as follows:
[0043]
[0044] Among them, C n is the deep feature image, C n-1 is the shallow feature image, Upsample is the upsampling function, P n and P n-1 is a mapping function used to convert feature images into feature vectors, W qUsed to map the feature vector to the query vector Q (QueryQ), W k Used to map the feature vector to the key vector K (Key K), W v Used to map the feature vector to the value vector V(ValueV), d k is the size value of the shallow feature image. In a possible implementation, the cross-attention-based feature refinement upsampling module can obtain the cross-attention image of two adjacent feature images according to formula (2), and formula (2) is as follows:
[0045]
[0046] Where M is a compression function used to compress the length of the image sequence.
[0047] After obtaining the cross-attention image, the refinement processing result of the first image, refine(cn), is obtained according to formula (3). The feature refinement upsampling module based on cross-attention can superimpose and fuse the upsampled image based on the deep feature image and the cross-attention image, so as to obtain the refinement processing result of the first image corresponding to two adjacent feature images of different scales. Formula (3) is as follows:
[0048] Refine(C n , C n-1 )=Upsample(C n )+CrossAttention(C n , C n-1 ) (3)
[0049] The cross-attention-based feature refinement upsampling module receives two adjacent feature images output by the backbone network as input, establishes global associations of multi-scale features based on the cross-attention algorithm, and refines the upsampling results of deep feature images, thereby achieving spatial alignment of multi-scale features, which can help the detection head network obtain more accurate multi-scale feature fusion results.
[0050] After obtaining each group of adjacent feature images, the neck network can fuse the first image corresponding to each group of feature images through the FPN+PAN (feature pyramid+path aggregation network) structure to obtain a multi-scale feature image (a group of feature images is two adjacent feature images).
[0051] The detection head network is used to perform detection processing on the multi-scale feature image, and output the positioning confidence score of the target object in the small-scale target detection model of the remote sensing image, the classification score of the target object in the small-scale target detection model of the remote sensing image, and the regression parameters of the target object in the small-scale target detection model of the remote sensing image. The regression parameters are used to characterize the size and position information of the positioning box of the target object in the remote sensing image, and the positioning box is used to identify the target object.
[0052] S102: training the remote sensing image small-scale object detection model using sample remote sensing images to obtain a trained remote sensing image small-scale object detection model.
[0053] Specifically, after building a remote sensing image small-scale target detection model, we can select appropriate sample remote sensing images to tune its network parameters. Figure 2 This article introduces the process of training a small-scale target detection model for remote sensing images. Figure 2 , Figure 2 This is a remote sensing image model training flow chart provided in an embodiment of the present application. The specific process is as follows:
[0054] S201: Calculate the weight value of each positive sample in the sample remote sensing image.
[0055] Specifically, multiple sample remote sensing images can be used as training samples. Multiple target areas can be calibrated in each sample remote sensing image. Each target area includes one or more positive samples. The positive sample is a sample area where the target object can be detected in the sample remote sensing image. One or more negative samples can also be calibrated in the sample remote sensing image. The negative sample is a sample area where the target object cannot be detected in the sample remote sensing image. After the target area, the positive sample and the negative sample in the target area are calibrated in the sample remote sensing image, the intersection over union (IoU) of the positive sample and the target in each target area can be calculated. The IoU is used to characterize the reliability of the positioning frame corresponding to the positive sample. The larger the IoU, the greater the reliability of the positive sample located by the positioning frame, and the smaller the IoU, the smaller the reliability of the positive sample located by the positioning frame. The IoU of the negative sample is set to 0. The weight value of the positive sample in a single sample remote sensing image can be calculated according to formula (4). Formula (4) is as follows:
[0056]
[0057] Among them, w i is the weight value of the i-th positive sample in the remote sensing image small-scale target detection model, IoU i is the intersection-over-union ratio of the i-th positive sample and the corresponding target area, j is the target area number of the current sample remote sensing image, and IoU j,meanis the average intersection-over-union ratio of all positive samples in the jth target region and the corresponding target region.
[0058] In some embodiments, the weight value of the positive sample in a single sample remote sensing image can be calculated by formula (5), and formula (5) is as follows:
[0059]
[0060] Among them, α(t) is the modulation factor. For the stability of training, the modulation factor α(t) based on the training process is added. In the initial stage of training, the weight of the positive sample is not used. As the training iterations, the influence of the positive sample adjustment weight on the loss function continues to increase. At each stage, α(t) is adjusted according to the following criteria: w j,i is the weight value of the i-th positive sample in the j-th target area in a single sample remote sensing image.
[0061]
[0062] in, epochs is the total number of times a single remote sensing training image is trained, and epoch is the number of times the current sample remote sensing image is trained.
[0063] S202: Calculate the positioning confidence loss of the target object, the classification loss of the target object, and the regression parameter loss of the remote sensing image small-scale target detection model.
[0064] Specifically, the target object positioning confidence loss of the remote sensing image small-scale target detection model can be calculated by formula (6), and the target positioning confidence loss is used to characterize the reliability of the target object position information in the sample remote sensing image output by the remote sensing image small-scale target detection model. Formula (6) is as follows:
[0065]
[0066] M1 is the number of positive samples in a single sample remote sensing image, and M2 is the number of negative samples in a single sample remote sensing image. is the target confidence score of the i-th positive sample in a single sample remote sensing image output by the detection head network, is the target confidence score of the i-th negative sample in a single sample remote sensing image output by the detection head network, is the actual intersection-over-union ratio between the ith positive sample and the corresponding target.
[0067]
[0068]
[0069] The classification loss L of the target object in the remote sensing image small-scale target detection model can be calculated by formula (7): cls , formula (7) is as follows:
[0070]
[0071] Among them, l i is the matching value between the ith positive sample output by the detection head network and each preset category, c i is the actual matching value between the ith positive sample and each preset category.
[0072]
[0073] N c The number of target categories preset for the small target detection model in remote sensing images.
[0074] The regression parameter loss L of the remote sensing image small-scale target detection model can be calculated by formula (8): reg , formula (8) is as follows:
[0075]
[0076] Among them, m i The target area located by the i-th positive sample output by the detection head network, is the actual target area corresponding to the i-th positive sample; where:
[0077] It is the loss value between the intersection-over-union ratio of the positioning frame of the i-th positive sample output by the detection head network and the corresponding target area and the true reliable value of the positioning frame in a single sample remote sensing image.
[0078] S203: Calculate the target loss value of the sample remote sensing image according to the positioning confidence loss of the target object in the sample remote sensing image, the classification loss of the target object, and the regression parameter loss.
[0079] Specifically, after calculating the positioning confidence loss, classification loss and regression parameter loss of the target object in the sample remote sensing image, the target loss value Loss of the sample remote sensing image can be calculated according to formula (9), which is as follows:
[0080] Loss = L pos +L cls +γL reg (9)
[0081] Among them, γ is the coefficient for balancing regression loss, and its default value is 5.0.
[0082] S204: Adjusting the network parameters and / or network structure of the remote sensing image small-scale target detection model according to the target loss value.
[0083] S103: Test the trained remote sensing image small-scale target detection model.
[0084] Specifically, after completing the training of the remote sensing image small-scale target detection model and obtaining the model parameters, the remote sensing image small-scale target detection model can be used to detect targets in remote sensing images. The following is an introduction to the process of detecting remote sensing image small-scale target detection models with reference to the accompanying drawings. Figure 3 , Figure 3 This is a flow chart of a remote sensing image small-scale target detection model detection method provided by an embodiment of the present application. The specific detection process is as follows:
[0085] S301: Preprocessing the remote sensing image.
[0086] Specifically, methods such as image cutting and edge filling may be used to adjust the size of the remote sensing image to be detected to 800×800 pixels (800×800 pixels is the value used in this embodiment).
[0087] S302: Loading a remote sensing image small-scale target detection model.
[0088] Load the trained model parameters into the small-scale object detection model.
[0089] S303: The remote sensing image small-scale target detection model detects the target object in the remote sensing image.
[0090] Specifically, the images to be detected with uniform size are input into the trained remote sensing image small-scale target detection model, and after feature extraction and fusion, the target classification score, regression parameters and target positioning confidence score are output.
[0091] S304: Processing the detection result output by the remote sensing image small-scale target detection model.
[0092] Specifically, a large number of detection results output by the detection head network are post-processed. The post-processing process can remove duplicates and filter the detection frames, retain the one with the highest score among the detected targets, and suppress the surrounding highly overlapping frames. Among them, the post-processing can adopt but is not limited to non-maximum suppression (NMS), Soft-NMS, Adaptive NMS, etc. The NMS post-processing method is used in the embodiment of the present application. Among them, NMS no longer filters the detection frame according to the target classification score, but according to the target positioning classification comprehensive score S proposed in this application. objThe detection frame is retained and suppressed, and the comprehensive score of target classification and positioning is calculated as follows:
[0093] S obj =S pos ×S cls
[0094] Among them, S pos is the target location confidence score, S cls is the target classification score.
[0095] The use of the comprehensive score of target positioning classification is more conducive to the screening of the optimal detection results, thereby obtaining better remote sensing small-scale target detection performance.
[0096] In the above embodiment, on the one hand, by adding a feature refinement upsampling module based on cross attention to the constructed remote sensing image small-scale target detection model, the feature refinement upsampling module based on cross attention relies on the cross attention algorithm to construct the global correlation of multi-scale features, which can effectively refine the upsampling results of the deep feature image to achieve the alignment of multi-scale features, which is beneficial to the precise positioning and classification of the target. On the other hand, by introducing a weighted paradigm to guide the optimization of the remote sensing image small-scale target detection model, the training mode of collective improvement of positive samples in the optimization process of the traditional remote sensing image small-scale target detection model is abandoned, and a small number of positive samples with the potential to regress to the optimal detection are given more attention, so that they can be better optimized in subsequent training. This positive feedback weighted paradigm guides the remote sensing image small-scale target detection model to obtain a small but more accurate detection of each target, and is more conducive to the post-processing screening of the target detection frame. In addition, the remote sensing image small-scale target detection model uses the target classification and positioning comprehensive confidence score to know the target detection post-processing procedure. The comprehensive confidence of target classification and positioning fully considers the positioning accuracy and category confidence of the current detection frame, and provides a better reference for the selection and suppression of the detection frame. In summary, the remote sensing image model training method proposed in the embodiment of the present application can train a remote sensing image model with high accuracy, so that the remote sensing image model can accurately detect small-scale target objects in remote sensing images.
[0097] The above describes in detail the method of the embodiment of the present application. The following describes the device, equipment, and computer-readable storage medium of the embodiment of the present application.
[0098] See also Figure 4 , Figure 41 is a schematic diagram of the structure of a remote sensing image small-scale target detection model training device provided in an embodiment of the present application, wherein the remote sensing image small-scale target detection model training device comprises: a construction module 310, used to construct a remote sensing image small-scale target detection model; a training module 320, connected to the construction module, used to train the remote sensing image small-scale target detection model through a sample remote sensing image to obtain a trained remote sensing image small-scale target detection model; a testing module 330, connected to the training module, used to test the trained remote sensing image small-scale target detection model; wherein the remote sensing image The small-scale target detection model includes a backbone network, a neck network and a detection head network. The backbone network is used to extract feature information from the remote sensing image to obtain N feature images. The neck network is used to fuse the N feature images to obtain a multi-scale feature image. The detection head network is used to output the positioning reliability of the target object in the remote sensing image, the classification score of the target object in the remote sensing image and the regression parameter of the target object in the remote sensing image. The regression parameter is used to characterize the size and position information of the positioning box of the target object in the remote sensing image. The size and number of channels of each feature image are different.
[0099] See also Figure 5 , Figure 5 4 is a schematic diagram of the structure of a remote sensing image small-scale target detection model training device 40 provided in an embodiment of the present application. The remote sensing image small-scale target detection model training device 40 may include a memory 401 and a processor 402; wherein each unit is described in detail as follows:
[0100] The memory 401 is used to store program codes.
[0101] The processor 402 is used to call the program code stored in the memory to execute the following steps:
[0102] Construct a small-scale target detection model for remote sensing images; train the small-scale target detection model for remote sensing images through sample remote sensing images to obtain the trained small-scale target detection model for remote sensing images; test the trained small-scale target detection model for remote sensing images; wherein, the small-scale target detection model for remote sensing images includes a backbone network, a neck network and a detection head network, the backbone network is used to extract feature information in the remote sensing image to obtain N feature images, the neck network is used to fuse the N feature images to obtain the target feature image, the detection head network is used to output the positioning confidence of the target object in the remote sensing image, the classification score of the target object in the remote sensing image and the regression parameter of the target object in the remote sensing image, the regression parameter is used to characterize the size and position information of the positioning box of the target object in the remote sensing image, and the size and number of channels of each feature image are different.
[0103] In a possible implementation, N feature images are fused to obtain a target feature image, specifically including:
[0104] According to the formula
[0105] Calculate the cross attention image of two adjacent feature images in the N feature images output by the backbone network; according to the formula Refine(C n , C n-1 )=Upsample(C n )+CrossAttention(C n , C n-1 ) calculates the first image after fine processing corresponding to two adjacent feature images of different scales, the first image is an image obtained by fine processing the upsampled image obtained by upsampling the deep feature image in the two adjacent feature images; the first image corresponding to each group of two adjacent feature images is fused to obtain a multi-scale feature image; wherein, C n is the deep feature image in two adjacent feature images, C n-1 is the shallow feature image in two adjacent feature images, Upsample is the upsampling function, P n and the P n-1 is a mapping function used to convert feature images into feature vectors, W q Used to map the feature vector to the query vector Q, the W k Used to map feature vectors to key vectors K, W v Used to map the feature vector to the value vector V,d k is the size of the shallow feature image in two adjacent feature images.
[0106] In one possible implementation method, a remote sensing image small-scale target detection model is trained using sample remote sensing images to obtain a trained remote sensing image small-scale target detection model, specifically including: calculating the weight value of each positive sample in the remote sensing image small-scale target detection model; calculating the positioning confidence loss of the target object, the classification loss of the target object, and the regression parameter loss of the remote sensing image small-scale target detection model; calculating the overall loss value of the remote sensing image small-scale target detection model based on the positioning confidence loss of the target object, the classification loss of the target object, and the regression parameter loss of the sample remote sensing image; and adjusting the network parameters and / or network structure of the remote sensing image small-scale target detection model based on the overall loss value.
[0107] In one possible implementation, the weight value of each positive sample in the remote sensing image small-scale target detection model is calculated, specifically including: according to the formula Calculate the weight value of each positive sample in the remote sensing image small-scale target detection model; where w i is the weight value of the i-th positive sample in the remote sensing image small-scale target detection model, IoU i is the intersection-over-union ratio of the i-th positive sample and the corresponding target area, j is the target area number of the current sample remote sensing image, and IoU j,mean is the average intersection-over-union ratio of all positive samples in the jth target region to the corresponding target region, and α(t) is the modulation factor.
[0108] In one possible implementation, the positioning confidence loss, classification loss and regression parameter loss of the target object of the remote sensing image small-scale target detection model are calculated, specifically including:
[0109] According to the formula Calculate the positioning confidence loss of the target object of the remote sensing image small-scale target detection model; according to the formula Calculate the classification loss of the target object of the remote sensing image small-scale target detection model; according to the formula Calculate the regression parameter loss of a single sample remote sensing image; where M1 is the number of positive samples in the single sample remote sensing image, M2 is the number of negative samples in the single sample remote sensing image, is the target confidence score of the i-th positive sample in a single sample remote sensing image output by the detection head network, is the target confidence score of the i-th negative sample in a single sample remote sensing image output by the detection head network, is the actual intersection-over-union ratio between the ith positive sample and the corresponding target, l i is the matching value between the i-th positive sample output by the detection head network and each preset category, c i is the actual matching value between the ith positive sample and each preset category, m i is the target area where the i-th positive sample is located in a single sample remote sensing image output by the detection head network. is the actual target area of the i-th positive sample.
[0110] In one possible implementation, the modulation factor
[0111] in, epochs is the total number of training times for the remote sensing image training set, and epoch is the number of times the current remote sensing image training set is trained.
[0112] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the remote sensing image small-scale target detection model training method in the above embodiment and its various possible implementation methods is implemented.
[0113] It should be noted that the memory in the above embodiments may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may be integrated with the processor.
[0114] The processor in the above embodiments may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
[0115] For the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, and the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0117] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0118] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0119] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of software, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc., specifically a processor in a computer device) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. Among them, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (ROM) or random access memory (RAM) and other media that can store program codes.
[0120] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 recorded 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 application.
Claims
1. A remote sensing image small-scale target detection model training method, characterized in that: include: Construct a small-scale target detection model for remote sensing images; The remote sensing image small-scale target detection model is trained by using sample remote sensing images to obtain a trained remote sensing image small-scale target detection model; Testing the trained remote sensing image small-scale target detection model; Among them, the remote sensing image small-scale target detection model includes a backbone network, a neck network and a detection head network. The backbone network is used to extract feature information in the remote sensing image to obtain N feature images. The neck network is used to fuse the N feature images to obtain a multi-scale feature image. The detection head network is used to output the positioning reliability of the target object in the remote sensing image, the classification score of the target object in the remote sensing image, and the regression parameters of the target object in the remote sensing image. The regression parameters are used to characterize the size and position information of the positioning box of the target object in the remote sensing image. The size and number of channels of each feature image are different.
2. The method according to claim 1, characterized in that The fusing the N feature images to obtain a target feature image specifically includes: According to the formula Calculate the crossattention image crossattention (cn, cn-1) of two adjacent feature images of different scales in the N feature images output by the backbone network; According to the formula Refine(C n ,C n-1 )=Upsample(C n )+CrossAttention(C n ,C n-1 ) calculates a refinement processing result refine(cn, cn-1) of a first image corresponding to two adjacent feature images of different scales, wherein the first image upsample(cn) is an upsampled image obtained by upsampling the deep feature image in the two adjacent feature images of different scales; The refined processing outputs of the first images corresponding to each group of two adjacent feature images are fused to obtain the multi-scale feature image; Among them, the C n is the deep feature image in two adjacent feature images, the C n-1 is the shallow feature image in two adjacent feature images, Upsample is the feature image upsampling function, and P n and the P n-1 is a mapping function used to convert the feature image into a feature vector, the W q Used to map the feature vector to the query vector Q, the W k Used to map the feature vector to the key vector K, the W v For mapping the feature vector to the value vector V, the d k is the size of the shallow feature image in two adjacent feature images.
3. The method according to claim 1, characterized in that The step of training the remote sensing image small-scale target detection model using a sample remote sensing image to obtain a trained remote sensing image small-scale target detection model specifically includes: Calculating the weight value of each positive sample in the remote sensing image small-scale target detection model; Calculating the positioning confidence loss, classification loss and regression parameter loss of the target object in the remote sensing image small-scale target detection model; Calculating the overall loss value of the remote sensing image small-scale target detection model according to the positioning confidence loss of the remote sensing image small-scale target detection model, the classification loss of the target object, and the regression parameter loss; The network parameters and / or network structure of the remote sensing image small-scale target detection model are adjusted according to the overall loss value.
4. The method according to claim 3, characterized in that The calculating of the weight value of each positive sample in the remote sensing image small-scale target detection model specifically includes: According to the formula Calculate the weight value of each positive sample in the remote sensing image small-scale target detection model; Among them, the w i is the weight value of the i-th positive sample of the remote sensing image small-scale target detection model, and the IoU i is the intersection-over-union ratio of the i-th positive sample and the corresponding target area, j is the target area number of the current sample remote sensing image, and the IoU j,mean is the average intersection-over-union ratio of all positive samples in the j-th target area to the corresponding target area, and α(t) is the modulation factor.
5. The method according to claim 4, characterized in that The calculating of the positioning confidence loss, the classification loss and the regression parameter loss of the target object of the sample remote sensing image by the remote sensing image small-scale target detection model specifically includes: According to the formula Calculate the positioning confidence loss Lpos of the remote sensing small-scale target detection model for the target object of the sample remote sensing image; According to the formula Calculate the classification loss L of the target object of the remote sensing small-scale target detection model DIO sample remote sensing image cls ; According to the formula Calculate the regression parameter loss L of the remote sensing small-scale target detection model for the sample remote sensing image reg ; Wherein, M1 is the number of positive samples in the single sample remote sensing image, M2 is the number of negative samples in the single sample remote sensing image, and is the target confidence score of the i-th positive sample in the single sample remote sensing image output by the detection head network, is the target confidence score of the i-th negative sample in the single sample remote sensing image output by the detection head network, is the actual intersection-over-union ratio between the i-th positive sample and the corresponding target, and the l i is the matching value between the i-th positive sample output by the detection head network and each preset category, and the c i is the actual matching value between the i-th positive sample and each preset category, and the m i is the target area located by the i-th positive sample output by the detection head network, is the actual target area corresponding to the i-th positive sample, and the Loss BCE is the cross entropy loss, the Loss IoU is the IoU loss.
6. The method according to any one of claims 4 to 5, characterized in that: The modulation factor α(t) is given by the formula in, The epochs is the total number of training iterations of the remote sensing image training set, and the epoch is the number of iterations of the current training of the remote sensing image training set.
Citation Information
Cited By
Image generation method and apparatus, electronic device, computer-readable storage medium, and computer program product
WO2026218876A1
