A remote sensing target counting method and system
Patent Information
- Application Number
- CN202610596619.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-30
- Publication Date
- 2026-08-21
AI Technical Summary
[0004]本发明提出一种遥感目标计数方法及系统,用以解决现有技术中由于双域差异导致基础模型难以直接捕捉遥感微小目标细节信息的问题,以及现有方法对目标与背景语义混淆抑制不足,导致在密集场景下难以准确解耦语义信息的问题
通过在SAM2图像编码器中嵌入差异引导的空频特征重构策略,以自适应方式重构空间域与频率域特征,有效弥补了基础模型在遥感任务中的双域差异。
Smart Images

Figure CN122618436A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition technology, and in particular to a remote sensing target counting method and system. Background Technology
[0002] The goal of remote sensing target counting is to discover and identify tiny targets in remote sensing images and determine their number. As a detection technique in complex backgrounds, remote sensing target counting has received widespread attention in fields such as urban planning and traffic monitoring, and is considered crucial for improving the automatic interpretation capabilities of remote sensing images. These targets are typically extremely small in spatial scale and densely packed. Due to the high similarity between the targets and the background texture, they are often inconspicuous and difficult to distinguish, posing a significant challenge to accurate counting.
[0003] Currently, remote sensing target counting methods are mainly divided into methods based on traditional hand-designed features and methods based on deep learning. Early remote sensing target counting relied primarily on hand-designed features, which distinguished targets from the background through visual features such as color, texture, and edges. However, these methods performed poorly or even failed when targets were extremely small. The advantage of traditional methods is that they do not require a large amount of training data, but they are easily affected by factors such as lighting, shadows, and motion blur, and their performance is limited in complex real-world scenarios. In recent years, with the rapid development of deep learning technology, remote sensing target counting methods have made significant progress, especially with the introduction of visual foundation models, which has brought new opportunities. However, the following problems exist in remote sensing target counting tasks: although existing foundation models have strong general representation capabilities, due to the dual-domain differences between the task and the data, it is difficult to directly capture the detailed information of small remote sensing targets, and the discriminative power of encoder features is insufficient in complex backgrounds; in addition, existing feature fusion strategies are insufficient in suppressing semantic confusion between targets and backgrounds, making it difficult to accurately decouple semantic information in dense scenes, thus restricting the improvement of counting accuracy. Summary of the Invention
[0004] This invention proposes a remote sensing target counting method and system to solve the problem that the basic model is unable to directly capture the detailed information of small remote sensing targets due to the difference between the two domains in the existing technology, and the problem that the existing methods are not good at suppressing the semantic confusion between the target and the background, which makes it difficult to accurately decouple the semantic information in dense scenes.
[0005] To solve the technical problem, the technical solution of the present invention is as follows:
[0006] A remote sensing target counting method, the method comprising: In the feature extraction stage of the remote sensing target counting network, a difference-guided spatial-frequency feature reconstruction strategy is embedded into the SAM2 image encoder to obtain a spatial-frequency feature reconstruction encoder. The difference-guided spatial-frequency feature reconstruction strategy includes: adaptively calibrating spatial domain features and frequency domain features, and fusing the calibrated spatial domain features and frequency domain features to output reconstructed multi-scale features. The remote sensing image to be counted is input into the spatial frequency feature reconstruction encoder to extract the reconstructed multi-scale features; The reconstructed multi-scale features are input into the semantic target decoupling module for decoupling of target and background semantics to obtain decoupling features at different scales; wherein, the decoupling process includes constructing a mutual exclusion mapping between the target and the background, and decoupling the target semantics and background semantics based on the mutual exclusion mapping; A multi-scale adaptive feature fusion strategy is used to integrate the decoupled features at different scales across scales to obtain fused features. The fused features are input into a parallel multi-scale dilated convolutional decoder for decoding to generate the final counting features. The remote sensing target count density map is output based on the final count features, and the density map is integrated to obtain the final count value.
[0007] Furthermore, the difference-guided space-frequency feature reconstruction strategy includes: Receive the intermediate layer features of the SAM2 image encoder; The intermediate layer features are processed using channel and spatial attention mechanisms to extract spatially enhanced features; The intermediate layer features are transformed to the frequency domain by fast Fourier transform, and the amplitude spectrum is processed by a learnable high-pass mask to extract structural features. The original phase spectrum is then combined with an inverse transform to obtain frequency-enhanced features. Calculate the difference between the spatial enhancement feature and the frequency enhancement feature, and guide adaptive calibration of the spatial enhancement feature and the frequency enhancement feature based on the difference; The calibrated spatial enhancement features are fused with the frequency enhancement features to output the reconstructed multi-scale features.
[0008] Furthermore, the adaptive calibration of the spatial enhancement feature and the frequency enhancement feature based on the difference guidance includes: The differences, the frequency enhancement features, and the spatial enhancement features are concatenated to generate dynamic weights; The differences are adaptively reweighted using the dynamic weights to obtain enhanced differences; The enhanced difference is added element-wise to the spatial enhancement feature to obtain the calibrated spatial enhancement feature; The enhanced difference is subtracted element-wise from the frequency enhancement feature to obtain the calibrated frequency enhancement feature.
[0009] Furthermore, the semantic target decoupling module performs decoupling processing between the target and background semantics, including: The reconstructed multi-scale features are input in parallel into the target confidence prediction branch and the background confidence prediction branch to generate the target confidence map and the background confidence map respectively. A cross-attention map is constructed using the mutual exclusion relationship between the target confidence map and the background confidence map; Using the cross-attention map, bidirectional semantic adversarial and feature purification are performed on the reconstructed multi-scale features for both the foreground and background regions, outputting decoupled features at different scales.
[0010] Furthermore, the construction of a mutually exclusive mapping between the target and the background, and the decoupling of target semantics and background semantics based on the mutually exclusive mapping, includes: The background confidence map is inverted and then concatenated with the target confidence map to obtain the target attention map; the target confidence map is inverted and then concatenated with the background confidence map to obtain the background attention map; the target attention map and the background attention map are respectively applied to the reconstructed multi-scale features to obtain the foreground enhancement feature and the background enhancement feature; the foreground enhancement feature and the background enhancement feature are dynamically weighted and fused using learnable gating parameters to obtain the decoupled feature.
[0011] Furthermore, the method of integrating the decoupled features of different scales across scales using a multi-scale adaptive feature fusion strategy to obtain fused features includes: The decoupled features of adjacent scales are extracted by channel attention mechanism to extract intra-scale salient features, and spatial resolution alignment is achieved by combining upsampling operation. An adaptive fusion weight is generated based on the semantic correlation between features of adjacent scales by utilizing a cross-scale gating fusion mechanism. Based on the adaptive fusion weights, the aligned adjacent scale features are dynamically weighted and integrated to obtain the fused features.
[0012] Furthermore, the step of inputting the fused features into a parallel multi-scale dilated convolutional decoder for decoding to generate the final counting features includes: The fused features are input into multiple convolutional branches with different dilation rates to capture spatial context information under different receptive fields in parallel; the multi-scale context information extracted from each branch is subjected to cross-branch feature aggregation and dimensionality normalization to restore spatial resolution and generate the final counting features.
[0013] A remote sensing target counting system, the system being used to perform any of the methods described above, the system comprising: A spatial-frequency feature reconstruction encoder is used to receive remote sensing images to be counted and extract reconstructed multi-scale features. The spatial-frequency feature reconstruction encoder is composed of a SAM2 image encoder with an embedded difference-guided spatial-frequency feature reconstruction strategy. The difference-guided spatial-frequency feature reconstruction strategy includes: adaptively calibrating spatial domain features and frequency domain features, fusing the calibrated spatial domain features and frequency domain features, and outputting the reconstructed multi-scale features. A semantic target decoupling module is used to receive the reconstructed multi-scale features, perform decoupling processing on target and background semantics, and output decoupling features at different scales; wherein, the decoupling processing includes constructing a mutual exclusion mapping between the target and the background, and decoupling target semantics and background semantics based on the mutual exclusion mapping; A multi-scale adaptive feature fusion module is used to integrate the decoupled features of different scales across scales to obtain fused features; A parallel multi-scale dilated convolutional decoder is used to decode the fused features and generate the final counting features; The output module is used to output a remote sensing target count density map based on the final count features, and to integrate the density map to obtain the final count value.
[0014] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a remote sensing target counting method as described above.
[0015] A computer-readable storage medium storing a computer program that, when executed by a processor, implements any one of the remote sensing target counting methods described above.
[0016] This application has the following advantages: By embedding a difference-guided spatial-frequency feature reconstruction strategy into the SAM2 image encoder, spatial and frequency domain features are reconstructed adaptively, effectively compensating for the dual-domain differences of the base model in remote sensing tasks.
[0017] By using a semantic target decoupling module, semantic confusion is alleviated by leveraging a mutual exclusion mapping mechanism between the target and the background, thus achieving accurate purification of dense, small targets in complex backgrounds.
[0018] Through adaptive feature fusion and decoding, multi-scale features are effectively integrated and a high-quality density map is output. Combined with integral processing, robust counting of targets in dense remote sensing scenes is achieved. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart of a remote sensing target counting method provided in this application embodiment; Figure 2 This is a schematic diagram of the structure of a remote sensing target counting system provided in an embodiment of this application; Figure 3 This is a schematic diagram of a remote sensing target counting network training method provided in an embodiment of the present application. Figure 4 A schematic diagram of the visualization analysis of 4 samples from the RSOC dataset for a remote sensing target counting method provided in this application embodiment; Figure 5 A schematic diagram of a CARPK and PUCPR+ dataset 6-sample visualization analysis of a remote sensing target counting method provided in this application embodiment; Figure 6 This is a schematic diagram of a TMS dataset 4-sample visualization analysis of a remote sensing target counting method provided in an embodiment of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] Example 1: like Figure 1 As shown, this embodiment provides a remote sensing target counting method, including: In the feature extraction stage of the remote sensing target counting network, a difference-guided spatial-frequency feature reconstruction strategy is embedded into the SAM2 image encoder. The SAM2 image encoder, with the embedded difference-guided spatial-frequency feature reconstruction strategy, extracts reconstructed multi-scale features from the remote sensing image. In the feature enhancement stage, the reconstructed multi-scale features are input into a semantic target decoupling module for processing to obtain decoupling features at different scales. The decoupling features at different scales are then input into a multi-scale adaptive feature fusion strategy for integration to obtain fused features. The fused features are input into a parallel multi-scale dilated convolutional decoder for decoding to obtain the final counting features. Based on the final counting features, a remote sensing target counting density map is output, and the density map is integrated to obtain the final count value.
[0023] For example, the difference-guided spatial-frequency feature reconstruction strategy achieves feature reconstruction through adaptive calibration and fusion of spatial domain features and frequency domain features.
[0024] For example, the feature reconstruction achieved by adaptive calibration and fusion of spatial domain features and frequency domain features includes: processing the intermediate layer features of the encoder using channel and spatial attention mechanisms to extract spatial enhancement features; converting the intermediate layer features to the frequency domain using fast Fourier transform, and processing the amplitude spectrum using a learnable high-pass mask to extract structural features, and performing an inverse transform combined with the original phase spectrum to obtain frequency enhancement features; calculating the difference between the spatial enhancement features and the frequency enhancement features, and guiding the generation of reconstructed multi-scale features based on the difference.
[0025] For example, the semantic target decoupling module decouples target semantics and background semantics by constructing a mutually exclusive mapping between the target and the background.
[0026] For example, the mutually exclusive mapping between the construction target and the background includes: The reconstructed multi-scale features are input in parallel into the target confidence prediction branch and the background confidence prediction branch to generate corresponding confidence maps; a cross-attention map is constructed using the mutual exclusion between the target confidence map and the background confidence map; bidirectional semantic adversarial and feature purification are performed between the foreground and background regions through the cross-attention map, and the decoupled features are output.
[0027] For example, the remote sensing target counting method is based on the theory of dual-domain feature reconstruction and semantic decoupling, and specifically includes the following steps: First, training samples for the remote sensing target counting network are constructed, including a training set, a validation set, and a test set. Before training begins, the remote sensing images and labels in the training set are normalized to a value between 0 and 1. The density map labels are generated by performing Gaussian kernel convolution on the original point annotation information to achieve continuous representation of target location information and smoothing of counting labels.
[0028] Secondly, the SAM2 image encoder was selected as the feature extractor for the remote sensing image, and the backbone parameters of the image encoder were frozen to maintain the integrity of the feature space.
[0029] Finally, a remote sensing target counting network based on dual-domain feature reconstruction and semantic decoupling is constructed, including a difference-guided spatial-frequency feature reconstruction strategy, a semantic target decoupling module, and feature fusion decoding.
[0030] We selected the TMS, RSOC, CARPK, and PUCPR+ datasets and divided the remote sensing image datasets into three parts: training set, validation set, and test set.
[0031] The training set is used for model training, the validation set is used to tune hyperparameters and prevent overfitting, and the test set is used to evaluate the final model performance. The remote sensing images and their labels in the training, validation, and test sets are normalized. The pixel values of the remote sensing images are converted from their original numerical range to a fixed distribution, and enhancement strategies such as random flipping and color jittering are used to improve training stability and convergence speed.
[0032] In the embodiments of this application, the SAM2 image encoder extracts hierarchical features from multiple Transformer blocks of the original input remote sensing image. Then, a difference-guided spatial-frequency feature reconstruction strategy embedded in each level is used to enhance the feature representation of the multi-scale features, compensating for domain differences through difference-guided spatial and frequency domain collaborative calibration. Subsequently, the reconstructed initial features are fed into a semantic target decoupling module for mutually exclusive mapping between the target and the background, thereby obtaining pure target semantic features and suppressing background noise.
[0033] In the feature extraction stage of the remote sensing target counting network, a difference-guided spatial frequency feature reconstruction strategy is embedded into the SAM2 image encoder; In the embodiments of this application, a reconstruction operator consisting of spatial and frequency branches is inserted into multiple Transformer modules at different stages of the image encoder. The reconstruction operator is coupled with the original attention mechanism of the encoder using a residual connection method, thereby achieving structured reconstruction of the pre-trained feature space while keeping the backbone network parameters frozen.
[0034] The difference-guided space-frequency feature reconstruction strategy receives key layer features from the SAM2 encoder. ,in, (Batch size) (Number of channels) (high), (Width); Spatial features are extracted using the spatial frequency domain feature extraction module. Frequency domain characteristics And the interdomain differences that characterize the relationship between the two. This process can be represented as:
[0035] Subsequently, by using spatial features Frequency domain characteristics Features with inter-domain differences Concatenate to generate directional dynamic weights Using this weight to analyze the differential features Adaptive reweighting enhancement further highlights effective cross-domain complementarity information. Finally, the enhanced difference features are used to perform complementary optimization of spatial and frequency domain features, generating calibrated features. and This process can be represented as:
[0036]
[0037]
[0038] In the formula, This indicates a splicing operation along the channel dimension; This represents a 1×1 convolution operation; This represents the Sigmoid activation function; This represents element-wise multiplication; This represents element-wise addition. This represents element-wise subtraction.
[0039] Subsequently, the optimized features are concatenated to generate adaptive fusion weights. This achieves adaptive weighted fusion of dual-domain features to obtain the final fused features. This process can be represented as:
[0040]
[0041] In the spatial frequency domain feature extraction module, the spatial branch aims to enhance the local texture and edge details of dense small targets in remote sensing images through a channel-spatial attention collaboration mechanism, providing high-quality spatial priors for cross-domain feature transfer. The spatial branch receives input features. Subsequently Parallel entry channel attention and spatial attention Channel weights and spatial weights are generated separately. Finally, the basic features and the two types of attention weights are weighted element-wise to output the spatial augmentation features. This calculation process can be expressed as:
[0042]
[0043] In the formula, and These represent channel attention operations and spatial attention operations, respectively.
[0044] The frequency domain branch aims to extract high-frequency structural information from a global spectral perspective, compensating for the spatial domain path's insufficient local perception of small target boundaries and textures. Through learnable high-pass filtering and spectral reconstruction mechanisms, it enhances the global consistency of dense targets. The frequency domain branch receives the same input features as the spatial domain branch. Frequency domain modeling is achieved through a complete Fourier transform process. First, a two-dimensional fast Fourier transform is performed on the input features to obtain a complex spectrum. Then, a centering operation is performed on the complex spectrum to shift the zero-frequency component to the center of the spectrum and separate the amplitude spectrum. Phase spectrum This calculation process can be expressed as:
[0045]
[0046] In the formula, It is a two-dimensional Fourier transform; For centralized operation; This represents the operation for calculating the phase angle of a complex spectrum.
[0047] Subsequently, a learnable circular high-pass mask is constructed. This is applied only to the amplitude spectrum, preserving the original phase spectrum to ensure structural integrity. Then, the filtered amplitude spectrum... Compared with the original phase spectrum Complex reconstruction is performed to generate a high-pass filtered, centered complex spectrum. Next, inverse centering is applied to the filtered, centered complex spectrum, and spatial domain features are reconstructed using inverse Fourier transform. Finally, compensated convolution is introduced for channel-level semantic alignment, outputting the final frequency domain enhanced features. and will and Differences yield difference features This calculation process can be expressed as:
[0048]
[0049]
[0050]
[0051] In the formula, To normalize the radial frequency, the variable Normalized spatial frequency coordinates; A learnable high-pass threshold; This is a reverse centralization operation; This is the inverse two-dimensional Fourier transform.
[0052] The SAM2 image encoder, which incorporates the difference-guided spatial frequency feature reconstruction strategy, extracts reconstructed multi-scale features from remote sensing images. In the embodiments of this application, the 2nd, 8th, 44th and 48th Transformer blocks in the image encoder, after being calibrated by the reconstruction operator, output feature maps of the corresponding levels to capture multi-dimensional information from low-level texture to high-level semantics. During the extraction process, the features of each level are enhanced by detail enhancement in the spatial domain branch and modeled for structural consistency in the frequency domain branch, thereby simultaneously enhancing the discrimination information of small targets and suppressing complex background noise in the output multi-scale features.
[0053] In the feature enhancement stage, the reconstructed multi-scale features are input into the semantic target decoupling module for processing to obtain decoupling features of different scales; To alleviate the semantic confusion between small targets and background noise, the semantic target decoupling module explicitly decouples features into target semantics and background semantics through bi-branch semantic mutual exclusion attention guidance and adaptive gating fusion. This significantly enhances the response of the target region and suppresses background noise while maintaining global semantic consistency, providing a clean and highly discriminative feature representation for the final density regression.
[0054] like Figure 5 As shown, original features First, initial confidence maps of the target and background are extracted from the input features using two independent convolutional prediction heads. and Two mutually exclusive semantic classes are learned in parallel from the same feature. Then, using... and Based on the potential mutual exclusion relationships, two sets of cross-exclusive attention maps are constructed to achieve bidirectional semantic adversarial communication between the foreground and background. Then, a refined target attention map is generated through convolutional optimization. and background attention map Next, the optimized attention map is applied to the original features. This achieves weighted guidance based on foreground and background; finally, it enhances foreground and background features. and Learnable gating parameters Dynamic fusion, output decoupled features This calculation process can be expressed as:
[0055]
[0056]
[0057]
[0058]
[0059] In the formula, This represents 1×1 convolution, batch normalization, and the ReLU activation function.
[0060] The decoupled features at different scales are input into a multi-scale adaptive feature fusion strategy and integrated to obtain fused features; The adjacent scale features processed by the semantic target decoupling module are used to extract intra-scale salient features through the channel attention mechanism, and spatial resolution alignment is achieved by combining upsampling operation. Then, the cross-scale gating fusion mechanism is used to generate adaptive fusion weights based on the semantic correlation between features, and the aligned adjacent scale features are dynamically weighted and integrated, thereby achieving deep synergy and supplementation of multi-scale semantic information and spatial detail features.
[0061] The fused features are input into a parallel multi-scale dilated convolutional decoder for decoding to obtain the final counting features; The fused features are sampled in parallel by multi-scale dilated convolution groups, and spatial context information under different receptive fields is captured simultaneously by multiple convolution branches with different dilation rates. Then, the multi-scale context information extracted by each branch is fused and dimensionality regularized by cross-branch feature aggregation operation, thereby restoring spatial resolution and enhancing the spatial localization accuracy of densely distributed small targets, and generating the final counting features.
[0062] The remote sensing target count density map is optimized by using a comprehensive loss function.
[0063] In this embodiment, the performance of the remote sensing target counting network is optimized during training by using a comprehensive loss function. An optimal transmission loss is introduced to achieve global distribution matching between the predicted and the true density map; a total variation loss is introduced to enhance local smoothness.
[0064] The total loss function is defined as:
[0065] In the formula, and These are the weighting coefficients for optimal transmission loss and total variation regularization loss, respectively.
[0066] The counting loss provides a hard numerical quantification target for the model by imposing an L1 constraint on the global integral value of the predicted density map and the ground truth count. It ensures the model's baseline accuracy in the macro-statistical dimension, and together with the distribution loss, forms a complementary supervision system of "global numerical constraint + spatial distribution alignment". The counting loss is defined as:
[0067] In the formula, Indicates the number of training samples. and These are the predicted count and the actual count, respectively.
[0068] The optimal transmission loss, based on optimal transmission theory, minimizes the Wasserstein distance between the predicted distribution and the point label distribution by solving the Monge-Kantorovich transmission problem. Optimal transmission loss explicitly achieves global alignment of the probability distribution, effectively mitigating positioning errors and blurring caused by the non-uniformity of target distribution in remote sensing images. The optimal transmission loss is defined as:
[0069] In the formula, This represents the normalized predicted density distribution; This represents the actual distribution of target point locations; Let represent the transfer matrix, and let represent the joint probability distribution. The amount of transmission that transfers probability quality from the predicted distribution to the true distribution; The cost matrix is defined as the pixel points. and The squared Euclidean distance between them is used to measure the spatial cost during transmission.
[0070] The total variation loss achieves density-sensitive smoothing constraints by coupling the standard TV distance with the number of targets. This loss not only promotes local continuity in the prediction results but also suppresses background spurious responses caused by cloud occlusion, shadows, and complex surface textures by penalizing spatial gradients. The total variation regularization loss is defined as:
[0071] In the formula, This represents the normalized predicted density distribution. This represents the normalized true discrete distribution. This represents the actual count value, which is used as a weighting coefficient to adaptively adjust the loss contribution under different density scenarios.
[0072] Example 2: Figure 2 This is a schematic diagram of a remote sensing target counting system provided in an embodiment of the present invention. The system includes an image input module, a network structure and processing module, and an image output module.
[0073] The image input module is used to acquire remote sensing images input to the remote sensing target counting system; The network structure and processing module is used to embed a difference-guided spatial-frequency feature reconstruction strategy into the SAM2 image encoder during the feature extraction stage of the remote sensing target counting network; obtain reconstructed multi-scale features through the SAM2 image encoder with the embedded difference-guided spatial-frequency feature reconstruction strategy; process the reconstructed multi-scale features to obtain decoupled features by calling the semantic target decoupling module during the feature enhancement stage; integrate the fused features based on the multi-scale adaptive feature fusion strategy; and transmit the fused features to the parallel multi-scale dilated convolutional decoder for decoding to obtain the final counting features. The image output module is used to output a remote sensing target count density map based on the final count features and perform integration processing to obtain the final count value.
[0074] The network structure and processing module includes a SAM2 image encoder, a difference-guided spatial frequency feature reconstruction strategy, a semantic target decoupling module, a multi-scale adaptive feature fusion unit, and a parallel multi-scale dilated convolutional decoder. The network structure and processing module also includes a counting loss function unit, which is used to optimize the density map using a counting loss function.
[0075] For example, after acquiring a remote sensing image, the remote sensing target counting system inputs the image into the network structure and processing module for interactive fusion processing to obtain the fused counting features. The image output module then outputs a density map based on these counting features.
[0076] The network structure and processing module consists of an image encoder, a scale-adaptive fusion module, a decoding module, and a multi-supervised constraint module. The image encoder employs the SAM2 encoder with an embedded difference-guided spatial frequency feature reconstruction strategy. It extracts multi-scale features with discriminative counting capabilities by performing feature calibration at key layers of the Transformer block. The scale-adaptive fusion module enhances the distinction between targets and background through a semantic target decoupling module and integrates semantic and detail information across different scales using a cross-scale gated fusion mechanism. The decoding module captures spatial context information from different receptive fields through a multi-branch convolutional structure to restore spatial resolution and generate a remote sensing target count density map. The multi-supervised constraint module consists of a counting loss function, an optimal transmission loss function, and a total variation regularization loss function. By jointly constraining numerical accuracy, global distribution alignment, and local smoothness, it achieves accurate target counting optimization.
[0077] Example 3: like Figure 3 As shown, this embodiment also provides a training method for a remote sensing target counting network.
[0078] First, training samples for the remote sensing target counting network were constructed. The TMS, RSOC, CARPK, and PUCPR+ datasets were selected and divided into training, validation, and test sets. The TMS dataset integrates real and simulated videos captured by low-Earth orbit satellites, containing 9296 images and 128,801 vehicle annotations; the RSOC dataset contains 3057 high-resolution satellite images covering buildings, ships, and various vehicles; the CARPK dataset contains 1448 drone aerial images; and the PUCPR+ dataset contains 125 images covering various weather conditions.
[0079] During the testing phase, the model is evaluated against state-of-the-art methods on test sets across various datasets. The training set is used for model training, optimizing model parameters using data from the training set; the validation set is used to tune hyperparameters and prevent overfitting; and the test set is used to evaluate the model's final performance. During training, input images are randomly cropped to 256×256 pixels.
[0080] The network structure and processing module consists of an image encoder, a scale-adaptive fusion module, a decoding module, and a multi-supervisory constraint module.
[0081] The SAM2-large version of the image encoder was selected as the feature extractor, and its backbone network parameters were frozen to ensure the integrity of the feature space and semantic information. Random horizontal flipping, color dithering, and Gaussian blur were employed to enhance the training data. The entire network was trained on an Intel(R) Core(TM) i7-13700 2.10 GHz and a single NVIDIA RTX 4090 GPU. During training, the initial learning rate was set to 1e-4, the batch size to 8, and the number of training epochs to 600. The AdamW algorithm with a weight decay coefficient of 0.0001 was used to optimize the network parameters.
[0082] In one possible embodiment, the effects of this application will be illustrated by the following examples.
[0083] In remote sensing target counting tasks, the resolution of remote sensing images limits the discriminative information of small targets in the spatial domain. Furthermore, the base model exhibits domain differences when handling specific remote sensing tasks, making it difficult for the model to accurately capture the structural information of targets in complex backgrounds. Therefore, this application addresses these issues by designing a difference-guided spatial-frequency feature reconstruction strategy. This strategy introduces spatial detail enhancement and frequency domain structural consistency modeling into the encoder's Transformer block to adaptively reconstruct the feature space, bridging the domain gap between the base model and the remote sensing task.
[0084] In remote sensing target counting tasks, densely distributed targets often lead to severe semantic confusion, and traditional fusion strategies are difficult to effectively suppress background spurious responses. To address these issues, this application designs a semantic target decoupling module, which achieves bidirectional semantic adversarial by constructing a mutually exclusive mapping relationship between targets and the background. This effectively suppresses background noise during feature purification and significantly improves the model's recognition accuracy in densely overlapping scenes.
[0085] To more intuitively illustrate the effectiveness of the remote sensing target counting method provided in this application, the mean absolute error (MAE) and root mean square error (RMSE) are used for evaluation, with the specific indicators as follows: MAE measures the average deviation between predicted and actual values; a smaller value indicates higher model accuracy. It is calculated as follows:
[0086] In the formula, Indicates the number of test samples. and These are the predicted count and the actual count, respectively.
[0087] RMSE is used to measure the variance sensitivity of prediction errors, and it can better evaluate the robustness of a model in extremely dense scenarios. Its calculation method is as follows:
[0088] In practical evaluations, MAE focuses on the average deviation, reflecting the overall counting accuracy; RMSE is more sensitive to larger errors and can measure the stability of the model in high-density regions or complex backgrounds. Therefore, combining the two can comprehensively reflect the actual performance of the counting model.
[0089] As shown in Tables 1, 2 and 3, the performance comparison of the remote sensing target counting method of this application with other counting methods on the TMS, RSOC, CARPK and PUCPR+ datasets is given. The last row represents the remote sensing target counting method proposed in this application.
[0090] Table 1. Performance comparison of the counting method in this application with other counting methods on the RSOC dataset.
[0091] Table 2. Performance comparison of the counting method in this application with other counting methods on the CARPK and PUCPR+ datasets.
[0092] Table 3. Performance comparison of the counting method in this application with other counting methods on the TMS dataset.
[0093] This application achieves state-of-the-art performance on the RSOC dataset, outperforming existing methods in all four subtasks. In the Building task, it achieves MAE and RMSE scores of 4.84 and 7.22, respectively, representing improvements of 13.88% and 6.11% over the previous best method. In the Small-vehicle task, this application reduces MAE and RMSE by 1.29% and 8.00%, respectively, compared to the second-best method. For the Large-vehicle and Ship tasks, this application also maintains its leading position, with MAE improvements of 5.43% and 5.30%, respectively, compared to the second-best method.
[0094] On the PUCPR+ and CARPK datasets, the remote sensing target counting method provided in this application also achieves state-of-the-art results. On the PUCPR+ dataset, the MAE and RMSE of this application are significantly improved compared to the second-best method, with improvements of up to 31.41% and 25.30%, respectively. On the more challenging TMS dataset, compared to the second-best method, the MAE and RMSE of this application are improved by 1.27% and 5.45%, respectively.
[0095] To further verify the superiority of the remote sensing target counting method provided in this application, the following were conducted: Figure 4 , Figure 5 and Figure 6 The visualization analysis shown. Figure 4 Four typical scenarios from the RSOC dataset were selected. As can be seen from the figure, the density map generated by this application has a concentrated response and accurate spatial distribution, and can clearly distinguish adjacent small targets. Figure 5 The low-altitude parking lot scene from the CARPK and PUCPR+ datasets was selected to demonstrate the performance under tree shadow occlusion or light change interference. The remote sensing target counting method provided in this application shows stronger robustness, and the density map response remains complete and continuous. Figure 6 For the extremely low resolution conditions of the TMS dataset, which demonstrates a scenario where the target and noise are highly confused, this application can still maintain an accurate density response even when the target occupies only a few pixels, significantly improving countability.
[0096] Based on the above analysis results, experimental results on multiple benchmark datasets show that the remote sensing target counting method proposed in this application outperforms other state-of-the-art detection methods in multiple metrics, fully verifying the effectiveness and reliability of the difference-guided spatial-frequency feature reconstruction strategy and semantic target decoupling module proposed in this application in solving key problems such as differences in the basic model domain and semantic confusion of dense small targets.
[0097] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0098] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A remote sensing target counting method, characterized in that, The method includes: In the feature extraction stage of the remote sensing target counting network, a difference-guided spatial-frequency feature reconstruction strategy is embedded into the SAM2 image encoder to obtain a spatial-frequency feature reconstruction encoder. The difference-guided spatial-frequency feature reconstruction strategy includes: adaptively calibrating spatial domain features and frequency domain features, and fusing the calibrated spatial domain features and frequency domain features to output reconstructed multi-scale features. The remote sensing image to be counted is input into the spatial frequency feature reconstruction encoder to extract the reconstructed multi-scale features; The reconstructed multi-scale features are input into the semantic target decoupling module for decoupling of target and background semantics to obtain decoupling features at different scales; wherein, the decoupling process includes constructing a mutual exclusion mapping between the target and the background, and decoupling the target semantics and background semantics based on the mutual exclusion mapping; A multi-scale adaptive feature fusion strategy is used to integrate the decoupled features at different scales across scales to obtain fused features. The fused features are input into a parallel multi-scale dilated convolutional decoder for decoding to generate the final counting features. The remote sensing target count density map is output based on the final count features, and the density map is integrated to obtain the final count value.
2. The remote sensing target counting method according to claim 1, characterized in that, The difference-guided space-frequency feature reconstruction strategy includes: Receive the intermediate layer features of the SAM2 image encoder; The intermediate layer features are processed using channel and spatial attention mechanisms to extract spatially enhanced features; The intermediate layer features are transformed to the frequency domain by fast Fourier transform, and the amplitude spectrum is processed by a learnable high-pass mask to extract structural features. The original phase spectrum is then combined with an inverse transform to obtain frequency-enhanced features. Calculate the difference between the spatial enhancement feature and the frequency enhancement feature, and guide adaptive calibration of the spatial enhancement feature and the frequency enhancement feature based on the difference; The calibrated spatial enhancement features are fused with the frequency enhancement features to output the reconstructed multi-scale features.
3. The remote sensing target counting method according to claim 1, characterized in that, The adaptive calibration of the spatial enhancement feature and the frequency enhancement feature based on the difference guidance includes: The differences, the frequency enhancement features, and the spatial enhancement features are concatenated to generate dynamic weights; The differences are adaptively reweighted using the dynamic weights to obtain enhanced differences; The enhanced difference is added element-wise to the spatial enhancement feature to obtain the calibrated spatial enhancement feature; The enhanced difference is subtracted element-wise from the frequency enhancement feature to obtain the calibrated frequency enhancement feature.
4. The remote sensing target counting method according to claim 1, characterized in that, The semantic target decoupling module performs decoupling processing between the target and background semantics, including: The reconstructed multi-scale features are input in parallel into the target confidence prediction branch and the background confidence prediction branch to generate the target confidence map and the background confidence map respectively. A cross-attention map is constructed using the mutual exclusion relationship between the target confidence map and the background confidence map; Using the cross-attention map, bidirectional semantic adversarial and feature purification are performed on the reconstructed multi-scale features for both the foreground and background regions, outputting decoupled features at different scales.
5. The remote sensing target counting method according to claim 4, characterized in that, The construction of a mutual exclusion mapping between the target and the background, and the decoupling of target semantics and background semantics based on the mutual exclusion mapping, includes: The background confidence map is inverted and then concatenated with the target confidence map to obtain the target attention map; the target confidence map is inverted and then concatenated with the background confidence map to obtain the background attention map; the target attention map and the background attention map are respectively applied to the reconstructed multi-scale features to obtain the foreground enhancement feature and the background enhancement feature; the foreground enhancement feature and the background enhancement feature are dynamically weighted and fused using learnable gating parameters to obtain the decoupled feature.
6. The remote sensing target counting method according to claim 1, characterized in that, The method involves cross-scale integration of decoupled features at different scales using a multi-scale adaptive feature fusion strategy to obtain fused features, including: The decoupled features of adjacent scales are extracted by channel attention mechanism to extract intra-scale salient features, and spatial resolution alignment is achieved by combining upsampling operation. An adaptive fusion weight is generated based on the semantic correlation between features of adjacent scales by utilizing a cross-scale gating fusion mechanism. Based on the adaptive fusion weights, the aligned adjacent scale features are dynamically weighted and integrated to obtain the fused features.
7. The remote sensing target counting method according to claim 1, characterized in that, The step of inputting the fused features into a parallel multi-scale dilated convolutional decoder for decoding to generate the final counting features includes: The fused features are input into multiple convolutional branches with different dilation rates to capture spatial context information under different receptive fields in parallel; the multi-scale context information extracted from each branch is subjected to cross-branch feature aggregation and dimensionality normalization to restore spatial resolution and generate the final counting features.
8. A remote sensing target counting system, characterized in that, The system is used to perform the method according to any one of claims 1-7, the system comprising: A spatial-frequency feature reconstruction encoder is used to receive remote sensing images to be counted and extract reconstructed multi-scale features. The spatial-frequency feature reconstruction encoder is composed of a SAM2 image encoder with an embedded difference-guided spatial-frequency feature reconstruction strategy. The difference-guided spatial-frequency feature reconstruction strategy includes: adaptively calibrating spatial domain features and frequency domain features, fusing the calibrated spatial domain features and frequency domain features, and outputting the reconstructed multi-scale features. A semantic target decoupling module is used to receive the reconstructed multi-scale features, perform decoupling processing on target and background semantics, and output decoupling features at different scales; wherein, the decoupling processing includes constructing a mutual exclusion mapping between the target and the background, and decoupling target semantics and background semantics based on the mutual exclusion mapping; A multi-scale adaptive feature fusion module is used to integrate the decoupled features of different scales across scales to obtain fused features; A parallel multi-scale dilated convolutional decoder is used to decode the fused features and generate the final counting features; The output module is used to output a remote sensing target count density map based on the final count features, and to integrate the density map to obtain the final count value.
9. A computer device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements a remote sensing target counting method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements a remote sensing target counting method according to any one of claims 1 to 7.