An urban illegal construction intelligent detection method and system based on adaptive cross-temporal attention
Patent Information
- Application Number
- CN202611204829.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-10
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2046-08-10
AI Technical Summary
[0007]本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种基于自适应跨时序注意力的城市违建智能检测方法及系统,旨在解决现有技术中参数效率与性能矛盾、特征融合自适应能力不足、变化特征增强能力弱、训练策略复杂度高以及部署成本高的问题
(1)参数效率与性能的平衡:本发明采用冻结视觉基础模型的参数高效微调策略,可训练参数仅为3.43百万,占模型总参数的1.12%,相比全参数微调方法,本发明参数量减少98.88%,训练时间缩短大半,在LEVIR-CD256数据集上,本发明F1分数达到91.59%,交并比达到84.48%,与全参数微调方法性能相当,实现了参数效率与性能的良好平衡。
Smart Images

Figure CN122695489B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of remote sensing image change detection and intelligent urban planning supervision, and in particular to an intelligent detection method and system for illegal urban construction based on adaptive cross-temporal attention. Background Technology
[0002] In urban planning and management, illegal construction disrupts the overall urban planning layout and harms the public interest. Traditional methods of inspecting illegal construction rely on manual patrols and public reports, which suffer from narrow coverage, delayed detection, and high labor costs. Remote sensing and artificial intelligence technologies offer solutions for automated detection of illegal construction, but existing change detection technologies still have many shortcomings when applied to urban illegal construction identification.
[0003] Existing methods mostly employ full-parameter fine-tuning training of the visual transformer backbone network. This approach is prone to overfitting on small-scale remote sensing datasets of illegal constructions, resulting in poor generalization ability. Furthermore, the number of parameters in the backbone network can reach over 300 million, and training with all parameters requires high computing power and storage resources, leading to high deployment costs.
[0004] At the temporal feature fusion level, existing technologies use fixed rules to splice or average the features of two temporal phases and use uniform fusion weights for all spatial locations. This cannot adapt to the differentiated change features of different illegal buildings such as newly built, expanded, and temporary buildings in urban scenarios, resulting in limited detection accuracy in complex scenarios.
[0005] Existing efficient parameter fine-tuning methods include two categories: low-rank adaptation and fixed adapter. Low-rank adaptation is constrained and has insufficient feature representation capabilities, while fixed adapter fusion logic is not adjustable, making it difficult to simultaneously balance parameter quantity and detection performance. At the same time, existing schemes lack explicit enhancement of dual-temporal difference features, and subtle visual changes in illegal construction areas are easily masked by environmental noise, resulting in significant missed detections of small-scale illegal constructions.
[0006] In terms of training strategies, existing algorithms generally adopt joint training with multiple losses such as cross-entropy, Dice, and contrastive loss, which makes hyperparameter tuning complex. In addition, they are often paired with learning rate decay strategies such as cosine annealing. In fine-tuning scenarios where only a small number of parameters are involved in the update, the model is prone to insufficient optimization in the later stage, resulting in unstable training process and high risk of overfitting. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide an intelligent detection method and system for illegal urban buildings based on adaptive cross-temporal attention, which addresses the above-mentioned deficiencies of the prior art. The aim is to solve the problems of parameter efficiency versus performance contradiction, insufficient adaptive capability of feature fusion, weak ability to enhance changing features, high complexity of training strategies, and high deployment cost in the prior art.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: A smart method for detecting illegal urban buildings based on adaptive cross-temporal attention includes the following steps: S1. Input steps: Receive two urban remote sensing images X_A and X_B of different time phases with dimensions H=W=256 for urban illegal construction identification, and perform adaptive preprocessing to adapt to the illegal construction scenario; S2. Freeze-down feature extraction step: Input the two remote sensing images of illegal constructions into the pre-trained visual base model, and use... The freezing strategy extracts multi-scale features at four scales to capture information on changes in land features caused by illegal construction in urban areas; the feature extraction layer indices are lists 5, 11, 17, and 23, the single-scale feature dimension is 768, and the corresponding feature map resolutions are 64×64, 32×32, 16×16, and 8×8, respectively. S3, Adaptive cross-temporal attention is a large architecture for the visual transformer, with a total model parameter count greater than or equal to 300 million. Processing steps: For each scale feature pair... The process sequentially completes differential feature enhancement, spatial gating weight generation, and adaptive feature fusion. The processing uses 3×3 depthwise separable convolution with a local window size of 3×3. Then, it enters the spatial gating weight generation process, extracting local contrast features and global perception features in parallel, and generating fusion weights adapted to each spatial location based on the gating network. Finally, adaptive feature fusion is carried out, using the aforementioned gating weights to perform weighted fusion of the enhanced differential features, and outputting the corresponding scale fusion features. S4. Lightweight decoder upsampling steps: Upsample the fused features at four scales step by step. The four-level upsampling increases the resolution from 8×8 to 128×128. Each level of the decoder includes depthwise separable convolution, channel attention, and bilinear interpolation. Finally, a single-channel probability map is output after convolutional mapping. S5. Training and Loss Steps: The model is trained using a single loss function. An adaptive optimizer with weight decay is selected, and a fixed learning rate, weight decay coefficient, batch size, and maximum training period are configured. An early stopping mechanism based on the validation crossover and union window is also provided to improve the model's generalization ability to identify various types of illegal constructions in cities.
[0009] Furthermore, the adaptive preprocessing includes three operations: brightness compensation based on histogram intersection-union ratio, color correction based on chromaticity shift, and data augmentation with lightweight geometric consistency constraints, which weakens the interference caused by urban lighting and color differences on the extraction of illegal building features. when When adaptive histogram equalization is enabled, brightness compensation is achieved; when Enable color correction to eliminate chromaticity shift; The data augmentation of the lightweight geometric consistency constraint is used to stabilize the pre-trained feature distribution and ensure the effectiveness of feature extraction for changes in illegal construction.
[0010] Furthermore, the visual pre-trained basic model is a visual transformer ultra-large architecture with a total number of parameters greater than or equal to 300 million. The freezing strategy only locks the backbone network parameters and does not participate in gradient updates. It only updates the parameters of the lightweight adaptation module, bottleneck adapter, gated network 1×1 convolution, and channel attention module designed for illegal construction feature extraction. It iteratively learns the multi-scale change features of illegal construction in urban areas based on a small number of parameters. The model has a total of 3.43 million trainable parameters, which account for 1.12% of the total parameters. This significantly reduces the computational cost of training while ensuring the accuracy of illegal construction identification.
[0011] Furthermore, the complete computational logic of the adaptive cross-temporal attention processing step is as follows: (1) Calculate the difference characteristics Then, through depthwise separable convolution, batch normalization, and ReLU activation, differential enhancement features are obtained to highlight the changes in illegal construction areas. ; (2) Output local contrast features through spatial perception gating network With global awareness features Generate spatial gating weights adapted to the distribution characteristics of illegal constructions in urban areas. ; (3) Combining gating weights With difference enhancement features Complete adaptive fusion and output fusion features that carry information on changes in illegal construction. .
[0012] Furthermore, the spatial perception gating network consists of a local feature comparison module, a global feature aggregation module, and a gating weight generation module; The local feature comparison module uses a 3×3 local window for calculation. To capture the local feature differences of small-scale illegal constructions; The global feature aggregation module calculates through a spatial attention mechanism. To comprehensively address background interference from various features across a large urban area; The gate weight generation module sequentially processes the weights using 1×1 convolution, BN, ReLU, and Sigmoid mapping to obtain gate weights ranging from 0 to 1. Used for element-wise weighted fusion of features to enhance the effective features of illegal construction areas; Gating parameters can be configured for multi-scale sharing or scale-specific settings.
[0013] Furthermore, the depth-separable convolutions within the decoder include DWConv and PWConv; after each level of upsampling, channel fusion is achieved through convolution. The decoder architecture is equipped with a cross-level feature interaction mechanism, which completes the interactive mapping of two sets of dual-temporal remote sensing features at the second and fourth feature levels, respectively, to fully explore the hierarchical change information of illegal construction areas in the images before and after the time phases and suppress the detection interference caused by static land features in urban areas. Channel attention can be achieved using either Squeeze-and-Excitation or channel attention boxes; Compared to traditional convolutional decoders, this lightweight decoder reduces the number of parameters by 60%, computation by 50%, and inference speed by 40%.
[0014] Furthermore, the single loss function used for training is the binary classification cross-entropy loss. Currently, the mainstream solutions for remote sensing change detection generally adopt joint training with multiple loss functions. This training process does not introduce Dice loss, Focal loss, or contrast loss. It can complete the fitting learning of urban illegal construction characteristics by relying on a single loss function. Freezing the backbone network combined with an early stopping mechanism reduces the risk of model overfitting, simplifies the hyperparameter tuning process, and improves training stability.
[0015] The present invention also proposes an intelligent detection system for illegal urban construction based on adaptive cross-temporal attention, the system being used to perform the above-mentioned detection method.
[0016] The beneficial effects of this invention are: (1) Balance between parameter efficiency and performance: This invention adopts a parameter-efficient fine-tuning strategy of freezing the basic vision model. The number of trainable parameters is only 3.43 million, accounting for 1.12% of the total parameters of the model. Compared with the full parameter fine-tuning method, the number of parameters in this invention is reduced by 98.88%, and the training time is shortened by more than half. On the LEVIR-CD256 dataset, the F1 score of this invention reaches 91.59%, and the intersection-union ratio reaches 84.48%, which is comparable to the performance of the full parameter fine-tuning method, achieving a good balance between parameter efficiency and performance.
[0017] (2) Spatial perception gating effect: The spatial perception gating network designed in this invention generates spatial perception gating weights through local feature comparison and global feature aggregation. Experiments show that compared with the hard-coded gating method, the spatial perception gating network improves the F1 score by 0.48 percentage points. Especially when dealing with complex urban scenarios, the performance is significantly improved and it can effectively distinguish different types of illegal construction changes such as newly built buildings, expanded buildings and temporary buildings.
[0018] (3) Lightweight decoder effect: The lightweight decoder designed in this invention adopts depth-separable convolution and channel attention mechanism, which greatly reduces the amount of computation while maintaining decoding accuracy. Experiments show that compared with traditional decoders, the lightweight decoder reduces the number of parameters by 60%, the amount of computation by 50%, the inference speed by 40%, and the F1 score by 0.12 percentage points, achieving a good balance between accuracy and efficiency.
[0019] (4) Improved training stability and simplicity: This invention uses only binary cross-entropy loss, avoiding complex combinations of multiple loss functions, simplifying hyperparameter tuning, and improving training stability. Experiments show that compared with the method using multiple loss functions, the training convergence speed of this invention is improved by 35%, the validation set curve is smoother and more stable, and the conflict between different loss terms is avoided.
[0020] This invention trains only 1.12% of the network parameters, improves inference speed by 40%, has excellent recognition effect on minor illegal constructions, and is stable in training. It is suitable for automated remote sensing inspection of illegal constructions in cities. Attached Figure Description
[0021] Figure 1 This is a diagram illustrating the overall architecture of the adaptive cross-temporal attention urban illegal construction detection system of the present invention. Figure 2 This is a diagram of the spatial perception gating network structure of the present invention; Figure 3 This is a structural diagram of the lightweight decoder of the present invention; Figure 4 This is a flowchart of the single loss function optimization process of the present invention; Figure 5 This is a rendering of the urban illegal construction detection effect of the present invention; Figure 6 This is a rendering of the urban expansion testing effect of the present invention; Figure 7 This is a rendering of the urban temporary building inspection effect of the present invention. Detailed Implementation
[0022] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0023] The purpose of this invention is to study an efficient, accurate, and low-cost intelligent detection system for illegal urban construction by employing techniques such as parameter-efficient fine-tuning of the visual basic model, adaptive cross-temporal attention module, spatial perception gating network, lightweight decoder, and single loss function optimization.
[0024] Reference Figures 1-7A smart detection method and system for illegal urban construction based on adaptive cross-temporal attention, with the architecture design as follows: Figure 1 As shown, the specific steps include: Step 1: Input Data Preparation and Adaptive Preprocessing The system input consists of two urban remote sensing images from different time periods, labeled as image A and image B, respectively. The image size is 256 x 256 pixels, and the color space is red, green, and blue (3 channels). As shown in formula (1): ; in, These represent remote sensing images from two different time phases.
[0025] In the preprocessing stage, the input image is first subjected to adaptive preprocessing. The histogram difference between the two temporal images is calculated to determine whether there is a significant brightness difference. For temporal images with a brightness difference exceeding a threshold, an adaptive histogram equalization method is used for brightness compensation, with the threshold set to a histogram intersection-union ratio of less than 0.7. This judgment can be written as formula (2): ; Calculate the color distribution difference between two temporal images to determine if there is a significant color shift. For temporal images where the color distribution difference exceeds a threshold, a color correction matrix is used for color compensation, with the threshold set to a chromaticity shift greater than 30. This judgment can be written as formula (3): ; Data augmentation is performed on the training set images using a pre-trained feature distribution preservation enhancement technique. This technique introduces only basic geometric perturbations that do not change the target semantics through lightweight geometric consistency constraints, avoiding excessive perturbation to the feature representations formed by the visual base model during massive data pre-training. This maintains the stability of the pre-trained feature distribution and improves the model's generalization performance. Unlike traditional complex data augmentation strategies, this invention does not introduce high-amplitude enhancements such as strong color perturbations, random cropping, or affine deformation, in order to reduce the impact of domain offset on detection accuracy.
[0026] Step 2: Freeze the visual base model and extract features A large-scale pre-trained visual foundation model is constructed using a frozen pre-training representation preservation backbone extraction technique as the feature extraction backbone network. The model adopts a visual transformer ultra-large architecture with more than 300 million parameters. This technique uses parameter freezing, cross-layer multi-scale feature readout, and representation stability constraints to use only the visual foundation model as a feature extractor, thereby preserving the general visual knowledge accumulated in the pre-training stage and avoiding catastrophic shifts in the learned feature representations on small-scale datasets. The parameter freezing process can be expressed as formula (4): ; in, Represents the parameters of the visual basic model. The freeze operation indicates no update operation. Equation (4) corresponds to the frozen pre-training representation preservation backbone extraction technique of the present invention. Image A and image B are respectively input into the frozen visual base model to extract multi-scale features at four different scales. The layer index of feature extraction is set to list (5, 11, 17, 23), corresponding to the middle and high layers of the visual base model. The resolutions of the feature maps at these four scales are 64 x 64, 32 x 32, 16 x 16 and 8 x 8, respectively, and the feature dimension of each scale is 768. The features are represented as features A1 to A4 and features B1 to B4, where features A1 and B1 are the first scale, features A2 and B2 are the second scale, features A3 and B3 are the third scale, and features A4 and B4 are the fourth scale.
[0027] Step 3: Adaptive cross-temporal attention module processing For each scale of feature pairs (features) ,feature Each step is processed through an adaptive cross-temporal attention module. The adaptive cross-temporal attention module consists of three core steps: difference enhancement, spatially aware gating, and adaptive fusion.
[0028] For the (i)th scale, let the input feature pair be... The subsequent difference enhancement, gating, and fusion processes are shown below.
[0029] Step 3.1: Difference Enhancement First, calculate the absolute difference between the two time-series features. The formula is: Feature difference = Absolute value of the feature(s) within parentheses. Subtract features The absolute difference is calculated element-wise along the channel dimension to obtain the difference feature map. Then, the difference feature map is enhanced by depthwise separable convolution, which includes two steps: channel-wise convolution and pointwise convolution. The kernel size of channel-wise convolution is 3 x 3, the stride is 1, and the padding is 1. Pointwise convolution restores the number of channels to 768. After depthwise separable convolution, a batch normalization layer and a modified linear unit activation function are added. The calculation formula is: feature difference enhancement equals modified linear unit (batch normalization (depthwise separable convolution (feature difference))). The role of difference enhancement is to highlight the subtle changes between two time series and enhance the feature response of the non-constructed region. The process is shown in formula (5): ; Equation (5) gives the process of differential feature extraction and differential enhancement, where For absolute difference features, This is a feature to enhance the difference.
[0030] Step 3.2: Spatial Awareness Gating Network Design a spatial perception gating network to generate spatial perception gating weights. The spatial perception gating network, such as... Figure 2 As shown, it specifically includes three sub-modules: local feature comparison, global feature aggregation, and gating weight generation.
[0031] The local feature comparison module calculates the similarity between two temporal features within a local window. The calculation formula is: the similarity is locally equal to the negative feature within the brackets. Local subtraction features The local L2 norm squared is used, with a local window size set to 3 x 3. Local contrast features capture local change patterns, which are particularly important for small-scale illegal constructions.
[0032] The global feature aggregation module aggregates global context information through a spatial attention mechanism. The calculation formula is: global feature equals spatial attention feature. Add features Divide by 2. Spatial attention mechanisms aggregate global context by calculating the weight distribution of features in spatial dimensions, which is particularly important for large-scale illegal constructions.
[0033] The gate weight generation module concatenates local contrastive features and global aggregated features along the channel dimension. The calculation formula is: feature concatenation equals concatenation (local similarity, global feature), and the number of channels after concatenation is 1537. Then, a gate weight map is generated through a lightweight gate network. The gate network contains a 1x1 convolutional layer, a batch normalization layer, a modified linear unit activation function, and a sigmoid activation function. The calculation formula is: weight gate, as shown in formula (6). The shape of the gate weight map is batch size multiplied by 1 multiplied by height multiplied by width, and the weight value at each position is between 0 and 1. The closer the weight value is to 1, the more the model is biased towards feature Ai, and the closer the weight value is to 0, the more the model is biased towards feature Bi.
[0034] ; Equation (6) corresponds to the local comparison, global aggregation, and gating weight generation process of the spatial perception gating network, where For local similarity features, This is a globally perceived feature. This is a gating weight graph.
[0035] Step 3.3: Adaptive Fusion Adaptive fusion is achieved through a linear combination of gated weighting and differential enhancement, calculated as follows: feature fusion equals feature... Multiply by weighted gate plus feature Multiply by 1 (within parentheses) and subtract the weight gate plus feature difference enhancement. The fusion formula consists of three parts: the first part is the feature... Multiply by the gating weight, the second part is the feature. Multiplying by (1 minus the gating weight), the third part is the difference enhancement feature. The gating term enables the model to adaptively select features at a certain time, the difference term directly enhances the changing signal, and the combination of the three achieves both selection and enhancement effects. As shown in formula (7): ; Equation (7) gives the adaptive fusion formula, where This indicates element-wise multiplication. This formula, together with formulas (5) and (6), constitutes the core computational link of the adaptive cross-temporal attention module.
[0036] Step 4: Lightweight decoder upsampling Decoder structure as follows Figure 3 As shown, the decoder progressively upsamples the fused features at four scales output by the adaptive cross-temporal attention module.
[0037] The decoder comprises four upsampling stages. Each upsampling stage contains three sub-modules: depthwise separable convolution, channel attention, and bilinear interpolation. The depthwise separable convolution has a 3x3 kernel size, a stride of 1, and padding of 1, with channel-wise convolution followed by pointwise convolution. The channel attention mechanism enhances the feature responses of important channels and suppresses the feature responses of irrelevant channels by calculating the weight distribution of features along the channel dimensions. Bilinear interpolation doubles the width and height of the feature map.
[0038] The first upsampling stage increases the resolution from 8x8 to 16x16; the second upsampling stage increases it from 16x16 to 32x32; the third upsampling stage increases it from 32x32 to 64x64; and the fourth upsampling stage increases it from 64x64 to 128x128. Finally, a 1x1 convolutional layer reduces the number of channels to 1, outputting a change detection probability map.
[0039] Compared to traditional decoders, the lightweight decoder reduces the number of parameters by 60%, from 12.5 million to 5.0 million; reduces computation by 50%, from 85.2 x 10^9 floating-point operations to 42.6 x 10^9 floating-point operations; and increases inference speed by 40%, from 25 frames per second to 35 frames per second.
[0040] Step 5: Single Loss Function Optimization Single-loss optimization uses only binary cross-entropy loss to train the model, avoiding complex combinations of multiple loss functions. The formula for calculating binary cross-entropy loss is: loss equals the negative true label multiplied by the logarithm of the predicted probability, plus 1 minus the true label multiplied by the logarithm of the predicted probability, where a true label of 1 represents a region of change and 0 represents a region of no change, and the predicted probability is the change probability output by the model after being processed by a normalized exponential function.
[0041] The training objective function is defined by formula (8): ; in, This represents the true label of the nth pixel. This represents the corresponding predicted probability. This represents the total number of pixels. Equation (8) corresponds to the single loss function optimization strategy of this invention.
[0042] Compared to the combination of multiple loss functions used in traditional methods, this invention uses only a single binary cross-entropy loss, which has the following advantages: First, it simplifies hyperparameter tuning and eliminates the need to balance the weights of multiple loss terms; Second, the training is more stable, avoiding conflicts between different loss terms; Third, in scenarios where parameters are finely tuned efficiently, the model capacity is limited, and a single loss function is sufficient to drive learning; Fourth, the pre-trained visual base model already has strong feature representation capabilities and does not require an additional loss function to guide learning.
[0043] Step Six: Training Parameter Settings and Early Stopping Strategy The training process employs an adaptive weight decay optimizer with a learning rate of 3e-4, a weight decay of 0.05, and a batch size of 16. Compared to the full-parameter fine-tuning method, this invention uses a larger learning rate because, in scenarios requiring efficient parameter fine-tuning, only a small number of parameters are trained, necessitating a larger learning rate for rapid convergence. The weight decay coefficient is set to 0.05 to apply regularization to the trainable parameters, preventing overfitting.
[0044] A constant learning rate strategy is used, without learning rate decay scheduling. This is because in scenarios involving efficient parameter fine-tuning, only a small number of parameters are trained, and the model capacity is limited. Significant learning rate decay could cause the model to miss later optimization opportunities. The constant learning rate strategy is simpler and more effective, and combined with an early stopping mechanism, it can stop training promptly when performance on the validation set no longer improves, avoiding overfitting.
[0045] An early stopping strategy is employed during training. The cross-union ratio (CUI) of the validation set is monitored within a 30-cycle monitoring window. Training stops when the CUI does not improve for 30 consecutive training cycles, and the model with the highest CUI is saved as the final model. The total number of training cycles is set to 200, but in most cases, the model will reach the early stopping condition within 80 to 120 training cycles.
[0046] Based on the above description, this invention can be tested on the LEVIR-CD dataset, which includes various scenarios, such as the following three scenario examples: Example 1: Application of the present invention in the detection of illegal construction in cities The application scenario is the detection of illegal construction in cities. The task is to detect the changing areas of illegal construction from two temporal urban remote sensing images with an image resolution of 256 x 256 pixels.
[0047] The model parameters are configured as follows: The visual base model adopts a massive visual transformer architecture with over 300 million parameters, and parameters are not updated in the frozen state. The feature extraction layer index is set to a list (5, 11, 17, 23), extracting multi-scale features at four scales. The differential enhancement of the adaptive cross-temporal attention module uses 3x3 depthwise separable convolutions, with a local window size of 3x3. The spatially aware gating network uses 1x1 convolutional layers. The lightweight decoder uses depthwise separable convolutions and channel attention mechanisms. The training parameters are configured as follows: batch size of 16, learning rate of 3e-4, weight decay of 0.05, number of training epochs of 200, and early stopping monitoring window of 30 training epochs. The loss function is configured as follows: only binary classification cross-entropy loss is used.
[0048] The training process was performed on a single GPU, an NVIDIA RTX 3090 with 24 gigabytes of VRAM. The total training time was approximately 12 hours. The validation set intersection-union ratio reached its highest value of 84.48% during the 78th training cycle, triggering the early stopping condition and ending the training prematurely. The model's detection performance is shown below. Figure 5 As shown.
[0049] Example 2: Application of the present invention in urban expansion inspection The application scenario is urban expansion detection. The task is to detect expanded areas from two temporal urban remote sensing images, with an image resolution of 256 x 256 pixels. The model configuration is the same as in Example 1, and the model detection results are shown below. Figure 6 As shown.
[0050] Application Results: This invention successfully detected expansion changes in urban areas, including various types such as residential expansion, commercial expansion, and factory expansion. Compared to traditional manual verification methods, this invention shortens the verification cycle from weeks to hours, significantly improving the timeliness and accuracy of urban planning management. Compared to full-parameter fine-tuning methods, this invention maintains high performance while reducing deployment costs by 72%, meeting the needs of large-scale deployment.
[0051] Example 3: Application of the present invention in the inspection of temporary urban buildings The application scenario is the detection of temporary buildings in cities. The task is to detect newly constructed temporary buildings, such as construction fences, temporary sheds, and prefabricated houses, from two temporal urban remote sensing images. The image resolution is 256 x 256 pixels, and the model configuration is the same as in Example 1. The detection results are as follows. Figure 7 As shown.
[0052] All key technical parameters of the experiment of this invention are shown in Table 1. Table 1 Key Technical Parameters of Urban Illegal Construction Detection System name Urban illegal construction detection system — backbone network ResNet-50 Time-frequency domain input, without re-entry Input image size 512×512×3 300 single-frame inputs Optional backbone VGG-16 — Training strategy Learning rate 1e-5 4 scales and multiple features Activation function ReLU Local receptive field, weight sharing Pooling method Depthwise separable convolution Local receptive field, reduce weight loss function Focal Loss Adaptive positive and negative sample weights Batch number 32 Stable training, easy to debug loss function Phase 1 Cross-Entropy Single Classification Loss Data Augmentation Translation, rotation, flipping Improve model generalization Activation function Sigmoid Probability output Model advantages Fast and accurate Low transmission and storage costs The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A smart detection method for illegal urban construction based on adaptive cross-temporal attention, characterized in that, Includes the following steps: S1. Input steps: Receive two urban remote sensing images X_A and X_B from different time periods. Through histogram and color compensation mechanism, the histogram removes extremely discrete outlier noise points, and the color compensation mechanism improves the feature map to improve small-scale feature defects or feature deficiencies that may exist. Perform adaptive preprocessing. S2. Freezing-type illegal construction feature extraction steps: Input the two remote sensing images of illegal constructions into a large-scale visual pre-trained basic model, with an input size of 256*256. The freezing strategy extracts multi-scale features of illegal construction at four scales; The indexes of the illegal construction feature extraction layers are List 5, 11, 17, and 23. The dimension of the single-scale illegal construction feature is 768, and the corresponding resolutions of the illegal construction feature maps are 64×64, 32×32, 16×16, and 8×8, respectively. S3, Adaptive cross-temporal attention processing steps: For each scale of illegal construction features... Complete in sequence: (1) Enhancement of "different temporal differences" in response to "illegal construction characteristics"; (2) Spatial gating weight generation for "enhanced intertemporal difference features"; (3) Adaptive feature fusion of “illegal construction features in different time periods” using “spatial gating weight”. During the processing, “different time difference feature enhancement” scan covers the global features of illegal construction features and strengthens and highlights the local difference features generated by newly added buildings. While enhancing local difference features, in order to solve the problem of unbalanced feature map weights caused by such differences, "spatial gating weights" and "adaptive feature fusion" adaptively weight and fuse the enhanced local illegal construction features and global features to obtain an illegal construction feature layer at each scale after cross-temporal attention enhancement. S4. For the semantic segmentation task of illegal construction in 256×256 dual-input images, an end-to-end training strategy with a single supervised loss and an adaptive convergence control mechanism are adopted to adapt to the characteristics of illegal construction scenes, such as low target proportion, strong building background interference, and easy overfitting. The specific implementation method is as follows: For the semantic segmentation of illegal construction in cities, the loss function configuration is as follows: a single pixel-level cross-entropy loss is used as the global supervision signal, and multiple loss weighted combinations are not introduced to reduce the complexity of parameter tuning and the risk of training instability. To address the characteristics of illegal construction targets having a low pixel proportion and an extremely unbalanced distribution of positive and negative samples in a 256×256 image, the class balance weights are calculated in reverse based on the actual proportion of pixels of each class in the training set. Higher loss weights are assigned to the illegal construction foreground class to suppress gradient shift dominated by large-area building backgrounds and improve the segmentation recall rate of small-scale illegal construction areas. For the semantic segmentation of urban illegal construction scenarios, the optimizer and hyperparameter configuration are as follows: an adaptive gradient optimizer with embedded decoupled weight decay is selected to update the network parameters, and a fixed initial learning rate, weight decay coefficient, batch size and maximum training period are configured as basic training parameters. By applying regularization constraints to the network weights through weight decay, the parameter size characteristics of the dual-input feature fusion network are adapted to ensure the model's convergence stability while suppressing the model's overfitting to non-essential features such as building texture and lighting, thereby improving the model's generalization ability to detect illegal buildings under different architectural styles and lighting scenarios. Design of an early stopping mechanism for semantic segmentation of illegal construction in urban areas: Introduce a sliding window early stopping strategy based on the cross-union ratio of illegal construction categories in the validation set. The cross-union ratio of the validation categories of illegal construction is used as the core convergence criterion. When the improvement of the cross-union ratio of the validation categories is less than a preset threshold within a consecutive preset round, the model is automatically judged to have converged and training is terminated. At the same time, the weight of the model with the highest validation accuracy is saved. This approach avoids overfitting the model to the architectural background details of the training set, reduces invalid training iterations, and lowers the computational cost of training in small-sized input scenarios.
2. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, The adaptive preprocessing includes three operations: brightness compensation based on histogram intersection-union ratio, color correction based on chromaticity shift, and data augmentation with lightweight geometric consistency constraints. when When adaptive histogram equalization is enabled, brightness compensation is achieved; when Enable color correction to eliminate chromaticity shift; The data augmentation of the lightweight geometric consistency constraint is used to stabilize the pre-trained feature distribution.
3. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, The visual pre-training base model is a visual transformer ultra-large architecture with a total number of parameters greater than or equal to 300 million. The freezing strategy only locks the parameters of the backbone network and does not participate in gradient updates. It only updates the parameters of the lightweight adaptation module, bottleneck adapter, gated network 1×1 convolution, and channel attention module. The model has a total of 3.43 million trainable parameters, which account for 1.12% of the total parameters.
4. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, The complete computational logic for the adaptive cross-temporal attention processing step is as follows: 1) Calculate the differential characteristics Differential enhancement features are then obtained through depthwise separable convolution, batch normalization, and ReLU activation. ; 2) Output local contrast features through a spatial perception gating network With global awareness features Generate spatial gating weights ; 3) Combining gating weights With difference enhancement features Complete adaptive fusion and output fused features. .
5. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 4, characterized in that, The spatial perception gating network consists of a local feature comparison module, a global feature aggregation module, and a gating weight generation module. The local feature comparison module uses a 3×3 local window for calculation. ; The global feature aggregation module calculates through a spatial attention mechanism. ; The gate weight generation module sequentially processes the weights using 1×1 convolution, BN, ReLU, and Sigmoid mapping to obtain gate weights ranging from 0 to 1. Used for element-wise weighted fusion of features; gating parameters can be configured for multi-scale shared settings or scale-specific settings.
6. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, The depthwise separable convolutions within the decoder include DWConv and PWConv; channel fusion is achieved through convolution after each upsampling stage. Channel attention can be achieved using either Squeeze-and-Excitation or channel attention boxes; Compared to traditional convolutional decoders, this lightweight decoder reduces the number of parameters by 60%, computation by 50%, and inference speed by 40%.
7. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, The single loss function used for training is binary classification cross-entropy loss. The training process does not introduce Dice loss, Focal loss, or contrast loss; Freezing the backbone network combined with an early stopping mechanism reduces the risk of model overfitting, simplifies the hyperparameter tuning process, and improves training stability.
8. The intelligent detection method for illegal urban construction based on adaptive cross-temporal attention as described in claim 1, characterized in that, Optimizer learning rate set to The weight decay coefficient is 0.05, the training batch size is 16, the upper limit of the training cycle is set to 200, and the window size for monitoring and verifying the early stopping mechanism is 30.
9. An intelligent detection system for illegal urban construction based on adaptive cross-temporal attention, characterized in that, The system is used to execute the intelligent detection method for illegal urban buildings based on adaptive cross-temporal attention as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Cable channel monitoring and risk grading method based on working condition adaptive enhancement and cross-modal unified modeling
CN121305475A
Remote sensing cloud removal method and system integrating multiple time sequences and multiple modes
CN122391015A