Construction site target detection method and system based on multi-scale gating re-weighting and contrast learning
By employing a multi-scale gating reweighting and contrastive learning approach, the problems of small targets and occlusion in construction site scenarios were solved, improving detection accuracy and cross-class adaptability, and enabling real-time stable detection on edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF SCI & TECH
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-29
AI Technical Summary
Existing few-sample target detection methods struggle to effectively handle small targets, occlusion, and intra-class differences in complex construction site scenarios, resulting in low detection accuracy, insufficient cross-class adaptability, and high computational overhead, making it difficult to achieve real-time inference on resource-constrained edge devices.
We employ a multi-scale gated reweighting and contrastive learning approach. By using a multi-scale gating mechanism to select the set of scales participating in the interaction, we design a proposal reweighting module (PRM) and a refined reweighting module (RRM). By combining cross-batch contrastive learning and meta-learning strategies, we optimize the loss function and computational constraints to improve detection accuracy and cross-class adaptability.
It significantly improves detection accuracy and cross-class adaptability in construction site scenarios, ensures real-time performance, and can be stably deployed on edge devices.
Smart Images

Figure CN122115950A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of construction site target detection with few samples, specifically a construction site target detection method and system based on multi-scale gating reweighting and contrastive learning. Background Technology
[0002] With the rapid development of intelligent construction engineering, the demand for automated target detection technology in construction site scenarios is becoming increasingly urgent. However, construction site environments are characterized by diverse target types, complex and ever-changing scenarios, and high data annotation costs, posing numerous challenges to traditional target detection methods. Existing few-sample target detection methods perform poorly in adapting to complex construction site scenarios, struggling to effectively handle complex situations such as a large number of small targets (e.g., safety helmets, tools), severe occlusion (mutual occlusion between mechanical equipment), and significant intra-class differences (different models of excavators, bulldozers, etc.), resulting in low detection accuracy. Furthermore, traditional methods lack cross-class adaptability, requiring extensive sample fine-tuning to achieve good results when facing new construction site target categories. Their cross-class generalization ability is limited, making it difficult to quickly adapt to the constantly emerging new equipment and targets in construction site scenarios.
[0003] Existing few-shot detection methods often employ strategies such as metric learning, attention enhancement, meta-learning, and self-supervised comparison, which can achieve certain cross-class transfer with a small number of samples. However, in complex scenarios such as construction sites with high occlusion, dense small targets, strong background interference, and significant distribution drift, accuracy and recall tend to decline significantly. At the same time, the model's computational overhead and memory usage are high, making it difficult to achieve stable real-time inference on resource-constrained edge devices, and thus failing to meet the dual requirements of "high accuracy + low latency" for continuous monitoring of construction sites.
[0004] The paper "Data-efficient Object Detection on Construction Sites Using Reweighting Mechanism and Cross-batch Contrastive Learning" proposes a few-shot detection framework based on CenterNet2. It designs two reweighting modules, achieving support-query feature fusion and pixel-level alignment, and introduces cross-batch contrastive learning and joint loss to improve occlusion and similarity class confusion. However, its attention mechanism remains computationally intensive, lacking relative position and sparsity optimization; alignment does not model deformable geometry and uses only a single-source mask; contrastive learning lacks momentum encoding / class equalization and temperature scheduling; and it does not incorporate computational constraints for scale / candidates, resulting in limited edge real-time performance and robustness. Summary of the Invention
[0005] The purpose of this invention is to provide a construction site target detection method and system based on multi-scale gating reweighting and contrastive learning.
[0006] The technical solution for achieving the objective of this invention is as follows: Firstly, this invention provides a construction site target detection method based on multi-scale gating reweighting and contrastive learning, comprising:
[0007] S1. Construct a few-sample detection framework: Extract multi-scale features based on the CenterNet2 detector, calculate the gating coefficients to adaptively select the scale, and introduce FiLM conditional modulation in the cascade head to improve cross-class adaptability.
[0008] S2, Design Proposal Reweighting Module (PRM): Parallel execution of local branches, sparse attention branches, and global context branches, merging to generate high-quality candidate regions;
[0009] S3. Construct a refined reweighted module RRM: predict the displacement field to deformably align the prototype, fuse attention and semantic mask to form a dual-source mask, and weight and aggregate RoI and prototype for classification and regression.
[0010] S4. Introduce cross-batch contrast learning: Maintain a category grouping memory, adopt a momentum encoder and class balance update strategy, and combine cross-batch contrast loss, angle interval prototype contrast loss and queue decorrelation regularization, and temperature parameter cosine annealing scheduling.
[0011] S5. Employ a meta-learning training strategy: Construct an N-way K-shot subtask, combine construction site scene enhancement and FiLM modulation to obtain cross-domain meta-knowledge and rapid adaptability;
[0012] S6. Construct joint loss and computational constraints: Jointly optimize CenterNet loss, cascade head loss, contrastive learning loss and regularization term; set computational constraints to limit the number of participating scales and candidates to meet real-time requirements.
[0013] Secondly, the present invention provides a construction site target detection system based on multi-scale gated reweighting and contrastive learning, for implementing the method described in the first aspect, the system comprising:
[0014] The feature extraction and gating module is used to extract multi-scale features and calculate gating coefficients to generate a set of scales that participate in the interaction;
[0015] The proposal reweighting module is used to perform a three-branch interaction and generate candidate regions at the selected scale;
[0016] The refined reweighting module is used to predict the displacement field, generate aligned prototypes, calculate the affinity matrix, and output aggregated features;
[0017] The cross-batch contrastive learning module includes a class-grouped memory, a momentum encoder, and an update strategy for generating key vectors and calculating cross-batch contrastive loss, prototype contrastive loss with angular intervals, and queue decorrelation regularization.
[0018] The meta-learning training module is used to construct N-way K-shot subtasks for basic training and fine-tuning, combined with enhancement strategies adapted to construction site scenarios and FiLM conditional modulation.
[0019] The loss calculation and computational constraint module is used to jointly optimize each loss function and set computational constraints, limiting the number of scales involved in each image and the number of candidates involved in the reweighting of the refinement.
[0020] Thirdly, the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described in the first aspect.
[0021] Fourthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0022] Fifthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect.
[0023] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0024] (1) Multi-scale adaptive processing capability: Through the multi-scale gating mechanism and the three-branch proposal reweighting module PRM, the system can adaptively select the set of scales to participate in the interaction, effectively handle the complex distribution of small targets (safety helmets, tools) to large targets (excavators, tower cranes) in the construction site scene, and significantly improve the detection accuracy of targets of different scales.
[0025] (2) Occlusion and background interference suppression: The Refined Reweighting Module (RRM) can effectively reduce the interference of mutual occlusion between mechanical devices and complex backgrounds through deformable geometric alignment and dual-source mask fusion technology, thereby improving the detection accuracy in occluded scenarios.
[0026] (3) Enhanced ability to distinguish similar categories: The cross-batch contrast learning strategy combined with prototype contrast loss with angular interval significantly enhances the ability to distinguish similar construction site targets (such as different models of excavators and bulldozers), reducing false detections and false negatives. Attached Figure Description
[0027] Figure 1 This is a flowchart of the method of the present invention.
[0028] Figure 2 Flowchart for the Proposal Reweighting Module (PRM).
[0029] Figure 3Flowchart for the Refined Reweighting Module (RRM).
[0030] Figure 4 A flowchart for introducing cross-batch learning comparison is provided.
[0031] Figure 5 This is the flowchart of the original learning and training strategy. Detailed Implementation
[0032] Currently, most few-shot object detectors combine support features with query features to generate interactive features to produce candidate regions, aiming to highlight similar regions in the query image using support images. Existing reweighting methods, such as Fully Guided Networks (FGN), typically achieve feature reweighting simply through a deep multiplication of support and query features. However, this simple deep multiplication interaction has significant limitations: on the one hand, due to the lack of effective modeling of spatial location information, it cannot fully capture the accurate spatial correspondence between support and query features; on the other hand, simple element-wise multiplication is difficult to handle complex feature matching requirements, especially when facing multi-scale targets and complex backgrounds in construction site scenarios, easily leading to inaccurate feature activation.
[0033] Furthermore, due to differences in shooting perspective or variations in intrinsic factors (such as posture, shape, and degree of occlusion), there are often significant visual differences between similar targets in the query image and the supporting images. For example, due to the diversity of clothing and posture, there are obvious visual differences between construction workers in the query image and those in the supporting images. Generally, when trained with sufficient labeled data, deep learning detectors can identify similar objects with different appearances. However, in few-shot learning scenarios, the detector exhibits sensitivity to targets with significant visual differences from the training samples, lacking sufficient robustness and struggling to effectively handle complex situations common in construction site environments, such as mutual occlusion between mechanical equipment and differences in the appearance of different equipment models.
[0034] To address the aforementioned issues, this invention proposes a construction site target detection method and system based on multi-scale gated reweighting and contrastive learning, utilizing a lightweight two-stage detector based on CenterNet2. This method adaptively selects the set of scales participating in the interaction through gating coefficients, designs a Proposal Re-weighting Module (PRM), and combines local branches, sparse attention branches, and global context branches in parallel execution to improve robustness and efficiency. Simultaneously, a Refined Re-weighting Module (RRM) is constructed to predict the two-dimensional displacement field to achieve geometric alignment of class prototypes, and integrates attention masks and semantic masks for feature weighting. A cross-batch contrastive learning strategy is introduced, maintaining a class grouping memory, using a momentum encoder to generate key vectors, and combining class balance and hard example priority strategies. Within the embedding space, cross-batch contrastive loss and prototype contrastive loss are jointly used, and an N-way K-shot subtask is constructed through meta-learning, combined with Feature-wise Linear Modulation (FiLM) to acquire cross-domain knowledge. Furthermore, computational constraints are set to limit the participating scales and the number of candidates. This technology significantly improves detection accuracy and cross-class adaptability in construction site scenarios, while ensuring real-time performance.
[0035] This invention introduces multi-scale gating and FiLM conditional modulation, and employs relative position offset and... Sparse attention; the refined reweighting module RRM achieves deformable alignment through displacement fields and integrates attention and semantic dual-source masks. On the contrastive learning side, a class grouping memory, momentum encoder, angular interval prototype contrast, and queue decorrelation regularization are added, and temperature cosine annealing is used for stable training; simultaneously, scale and candidate computational constraints are set to achieve controllable accuracy and speed. These improvements significantly enhance the detection accuracy and cross-class rapid adaptation capability in small target / occluded scenes, supporting real-time and stable deployment on edge devices.
[0036] Combination Figures 1-5 The specific steps of this method are as follows:
[0037] S1. Construct a few-sample detection framework: Extract multi-scale features based on the CenterNet2 detector, calculate the gating coefficients to adaptively select the scale, and introduce FiLM conditional modulation in the cascade head to improve cross-class adaptability.
[0038] S2, Design Proposal Reweighting Module (PRM): Parallel execution of local branches, sparse attention branches (including relative position bias and...) (Filtering) and global context branches are merged to generate high-quality candidate regions;
[0039] S2-1: Two parallel 3×3 convolutional layers are used to encode the query features, generating differentiated query features. Where C is the number of channels, and H and W are the height and width of the feature map;
[0040] S2-2: Using two parallel 3×3 convolutional layers will support feature encoding as Global context features are obtained through global average pooling and 1×1 convolution. , where H' and W' are the resolutions of the supporting features;
[0041] S2-3: Perform sparse attention interactions in the spatial dimension: Let ,in and These are linear mapping functions for vectors Q and K, respectively, constructing a system with relative position bias. Affinity matrix Where d represents the feature dimensions of the query and key, and Q and K are the query matrix and key matrix, respectively; for each row, the top-k maximum responses are retained and renormalized to obtain... Generate query location-aware support features Where R(·) represents reshaping, This is matrix multiplication;
[0042] S2-4: Perform depth multiplication on the global dimension: ,in This is a globally reweighted query feature. This represents channel-by-channel multiplication;
[0043] S2-5: Will Interactive features are obtained by concatenating and reducing the dimensionality through 1×1 convolution, and then input into the candidate generation unit to generate candidate regions.
[0044] S3. Construct a refined reweighted module RRM: predict the displacement field to deformably align the prototype, fuse attention and semantic mask to form a dual-source mask, and weight and aggregate RoI and prototype for classification and regression.
[0045] S3-1: RoI features With category prototype Remodeling Where S represents the spatial resolution of the feature map. The spatial dimensions (width and height) are unfolded into a one-dimensional vector, where D represents the channel dimension of the feature, and the displacement field is predicted by a convolutional network. ;
[0046] S3-2: To Bilinear resampling is performed to obtain the aligned prototype. ;
[0047] S3-3: Parallel calculation of affinity matrix Parallel softmax is obtained , thereby aligning the category prototype ;
[0048] S3-4: Summing rows A and obtaining the attention mask using a sigmoid function. ; by decoder Predictive semantic mask With adaptive weights Fusion and weighted to obtain ,in For global average pooling, For learnable weight vectors, Use the Sigmoid activation function;
[0049] S3-5: Will and The aggregated features are obtained by depthwise concatenation and 1×1 convolution. The output is used for bounding box classification and regression.
[0050] S4. Introduce cross-batch contrast learning: Maintain a category grouping memory, adopt a momentum encoder and class balance update strategy, and combine cross-batch contrast loss, angle interval prototype contrast loss and queue decorrelation regularization, and temperature parameter cosine annealing scheduling.
[0051] S4-1: Will MLP mapping to normalized embeddings The category prototype is then pooled and compressed using MLP to obtain the normalized prototype. Maintain a collection of memory queues grouped by category { }, capacity is ;
[0052] S4-2: Employs a momentum encoder Generate key vectors, update parameters as follows ,in These are the parameters of the momentum encoder. Here are the parameters of the online encoder (master model), where m is the momentum coefficient. For parameter update operations; the memory queue is updated using a class-balanced reservoir sampling and a hard example priority (high uncertainty / low prototype similarity) strategy;
[0053] S4-3: Define the joint comparison objective:
[0054] 1) Loss compared across batches:
[0055] ;
[0056] in For the number of features, For temperature parameters, Let i, j, and k be the feature representation vectors of samples i, j, and k, respectively. This represents the set of comparison samples corresponding to sample i;
[0057] 2) Prototype contrast loss with angular spacing:
[0058]
[0059] in Scaling factor s > 0, offset , For sample i and its true label The angles between the corresponding category prototypes, This represents the angle between sample i and category c;
[0060] 3) Queueing related regular expressions Z is the set of embeddings sampled from various queues, where Let Z be the covariance matrix of the set of embedding vectors sampled from various queues. It is the identity matrix. The square of the F-norm;
[0061] 4) Cosine annealing is used to schedule the temperature parameters to stabilize the early training.
[0062] S5. Employ a meta-learning training strategy: Construct an N-way K-shot subtask, combine construction site scene enhancement (small target / occlusion perception) and FiLM modulation to obtain cross-domain meta-knowledge and rapid adaptation capabilities;
[0063] S5-1: Use a large-scale detection dataset for basic training, and construct multiple N-way K-shot subtasks, each of which contains a query set and a support set;
[0064] S5-2: The query set contains the query image and its annotation; the support set contains N categories, K support images for each category, and their bounding boxes / masks;
[0065] S5-3: The detector acquires localization and classification capabilities through sub-task training, establishing cross-domain meta-knowledge; functions are used in the cascaded detector head. Generate FiLM parameters And applied to intermediate features ,in and These are the original intermediate features and the modulated intermediate features, respectively;
[0066] S5-4: Enhancement strategies include flipping, translation, rotation, and small target / occlusion perception enhancement (such as random occlusion and scale jitter).
[0067] S5-5: Make minor adjustments using a small amount of labeled site data to achieve rapid adaptation to new site categories.
[0068] S6. Construct joint loss and computational constraints: Jointly optimize CenterNet loss, cascade head loss, contrastive learning loss and regularization term; set computational constraints to limit the number of participating scales and candidates to meet real-time requirements.
[0069] Construct the joint loss function as follows:
[0070] = center +
[0071] in center The loss function for the CenterNet header consists of three components: heatmap loss, size regression loss, and offset regression loss. The meaning is the same as in the above text. Consistent, both representing prototype contrast loss with angular intervals; and Let represent the regression loss and classification loss of the i-th cascade head, respectively; This is the balance coefficient.
[0072] This method effectively addresses the shortcomings of simple depth multiplication by developing a novel dual-weighting mechanism—the Proposal Reweighting Module (PRM) and the Refined Reweighting Module (RRM). PRM employs sparse attention branches combined with relative positional biases to establish accurate spatial correspondences, while RRM achieves more precise feature matching through deformable geometric alignment and affinity alignment. Simultaneously, a cross-batch learning strategy is introduced, leveraging momentum encoders and class-equalized memory to fully mine historical sample information, significantly improving the feature discrimination capability between visually similar construction objects and effectively handling severe occlusion problems and complex spatial relationships in construction environments.
[0073] A three-branch PRM with multi-scale gating, combining relative position bias and Top-k sparse attention, balances accuracy and efficiency for both small and large targets; deformable geometric alignment combined with dual-source mask fusion reduces occlusion and background interference, improving matching accuracy; a class-equalization memory and momentum encoder, along with prototype comparison with angular intervals and queue decorrelation regularization, enhance the ability to distinguish similar categories; prototype-driven FiLM modulation and temperature annealing improve cross-class rapid adaptation and training stability; and computational power-aware gating (for participating scale and participating candidates) meets the real-time deployment requirements of edge devices.
[0074] The present invention will be further described below with reference to the embodiments and accompanying drawings.
[0075] Example
[0076] This invention uses a diverse FSOD dataset containing approximately 1000 categories for basic training to obtain cross-class transferable prototype representations and meta-knowledge; subsequently, few-shot adaptation and evaluation are performed on the SODA dataset containing 15 common construction site categories. To be consistent with the table presentation, the few-shot setting is K∈{1,2,3,4,5,6}. Task: Select K labeled support images for each category as appearance references. The query set should cover all 15 categories, and all remaining samples should be used as independent test sets. Query images should be uniformly scaled to 1000×600 pixels, and cropped to a uniform scale of 288×288 pixels, while maintaining a fixed random seed and partitioning to ensure reproducibility.
[0077] This embodiment was implemented on a workstation with dual NVIDIA RTX 3090 GPUs (48GB total VRAM). PyTorch and CUDA were used for training and inference, with mixed precision enabled to improve throughput and memory utilization. The detection framework is based on the CenterNet2 and VoVNet backbone networks, retaining a two-stage cascade. The detection head incorporates multi-scale gating to adaptively select the scales involved in the interaction (up to two). A three-branch PRM (local branch, branch with relative position offset, and branch with relative position offset) is used during the proposal phase. The study employs a sparse attention branch and a global context branch. During the refinement stage, a deformable alignment and attention / semantic dual-source mask fusion RRM is used, and cross-class adaptation capability is enhanced through FiLM conditional modulation in the concatenated header. Cross-batch comparative learning maintains a memory queue grouped by class and generates key vectors using a momentum encoder (m=0.999). This is combined with angular interval prototype comparison and decorrelation regularization. The temperature parameter τ is scheduled using cosine annealing.
[0078] In the foundational phase, pre-training is performed on FSOD using episode-based meta-learning to obtain robust initialization and prototype space. In the adaptation phase, short-cycle fine-tuning and evaluation are performed on SODA for each K. The optimizer uses SGD (momentum 0.9, weight decay). The initial learning rate was 0.0025, and cosine annealing was used. Data augmentation also included flipping, translation, rotation, and small object / occlusion awareness strategies (random occlusion and scale jitter) to simulate occlusion and scale changes in construction site scenes.
[0079] Table 1 shows the AP (%) for different K values on the SODA dataset.
[0080] Table 1. Average accuracy (AP) of the proposed method on the SODA dataset.
[0081]
[0082] Overall, the "sum" line steadily increases with K, showing values of 18.3, 28.1, 36.1, 42.0, 51.8, and 58.6 respectively, indicating that adding visual references brings consistent detection benefits. Most categories show a monotonically increasing sum with K. Categories such as hooks, scaffolding, and personnel reach higher levels at K=6 (e.g., hooks 89.8, scaffolding 76.5, personnel 75.4), while rebar, fences, and knives remain relatively low at K=6 (31.2, 28.3, 33.9), reflecting that these categories rely more on sample diversity and structural priors. The improvement rates varied across categories, with significant increases for categories like planks, bricks, and handcarts from K=1 to K=6 (e.g., planks from 11.7 to 61.2, bricks from 6.9 to 57.0, and handcarts from 9.2 to 55.5), demonstrating a high sensitivity to the number of supporting samples. However, slight fluctuations were observed in the high K range for some categories (e.g., handcarts showed a decline between K=5 and K=6), suggesting instability in sample selection or scene distribution for these categories. Overall, the results demonstrate the positive impact of the proposed multi-scale gating, sparse attention interaction, and deformable alignment mechanisms on candidate quality and refined matching, further enhancing the model's inter-class separability with more adequate appearance references.
Claims
1. A construction site target detection method based on multi-scale gating reweighting and contrastive learning, characterized in that, include: S1. Construct a few-sample detection framework: Extract multi-scale features based on the CenterNet2 detector, calculate the gating coefficients to adaptively select the scale, and introduce FiLM conditional modulation in the cascade head to improve cross-class adaptability. S2, Design Proposal Reweighting Module (PRM): Parallel execution of local branches, sparse attention branches, and global context branches, merging them to generate high-quality candidate regions; S3. Construct a refined reweighted module RRM: predict the displacement field to deformably align the prototype, fuse attention and semantic mask to form a dual-source mask, and weight and aggregate RoI and prototype for classification and regression. S4. Introduce cross-batch contrast learning: Maintain a category grouping memory, adopt a momentum encoder and class balance update strategy, and combine cross-batch contrast loss, angle interval prototype contrast loss and queue decorrelation regularization, and temperature parameter cosine annealing scheduling. S5. Employ a meta-learning training strategy: Construct an N-way K-shot subtask, combine construction site scene enhancement and FiLM modulation to obtain cross-domain meta-knowledge and rapid adaptability; S6. Construct joint loss and computational constraints: Jointly optimize CenterNet loss, cascade head loss, contrastive learning loss and regularization term; set computational constraints to limit the number of participating scales and candidates to meet real-time requirements.
2. The construction site target detection method based on multi-scale gating reweighting and contrastive learning according to claim 1, characterized in that, Step S2 specifically includes: S2-1: Two parallel 3×3 convolutional layers are used to encode the query features, generating differentiated query features. Where C is the number of channels, and H and W are the height and width of the feature map; S2-2: Using two parallel 3×3 convolutional layers will support feature encoding as Global context features are obtained through global average pooling and 1×1 convolution. , where H' and W' are the resolutions of the supporting features; S2-3: Perform sparse attention interactions in the spatial dimension: Let ,in and These are linear mapping functions for vectors Q and K, respectively, constructing a system with relative position bias. Affinity matrix Where d represents the feature dimensions of the query and key, and Q and K are the query matrix and key matrix, respectively; for each row, the top-k maximum responses are retained and renormalized to obtain... Generate query location-aware support features Where R(·) represents reshaping, This is matrix multiplication; S2-4: Perform depth multiplication on the global dimension: ,in This is a globally reweighted query feature. This represents channel-by-channel multiplication; S2-5: Will Interactive features are obtained by concatenating and reducing the dimensionality through 1×1 convolution, and then input into the candidate generation unit to generate candidate regions.
3. The construction site target detection method based on multi-scale gating reweighting and contrastive learning according to claim 2, characterized in that, Step S3 specifically includes: S3-1: RoI features With category prototype Remodeling Where S represents the spatial resolution of the feature map. The spatial dimensions (width and height) are unfolded into a one-dimensional vector, where D represents the channel dimension of the feature, and the displacement field is predicted by a convolutional network. ; S3-2: To Bilinear resampling is performed to obtain the aligned prototype. ; S3-3: Parallel calculation of affinity matrix Parallel softmax is obtained , thereby aligning the category prototype ; S3-4: Summing rows A and obtaining the attention mask using a sigmoid function. ; by decoder Predictive semantic mask With adaptive weights Fusion and weighted to obtain ,in For global average pooling, For learnable weight vectors, Use the Sigmoid activation function; S3-5: Will and The aggregated features are obtained by depthwise concatenation and 1×1 convolution. The output is used for bounding box classification and regression.
4. The construction site target detection method based on multi-scale gating reweighting and contrastive learning according to claim 3, characterized in that, Step S4 specifically includes: S4-1: Will MLP mapping to normalized embeddings The category prototype is then pooled and compressed using MLP to obtain the normalized prototype. Maintain a collection of memory queues grouped by category { }, capacity is ; S4-2: Employs a momentum encoder Generate key vectors, update parameters as follows ,in These are the parameters of the momentum encoder. Here are the parameters of the online encoder, where m is the momentum coefficient. For parameter update operations; the memo queue is updated using a balanced reservoir sampling and a hard case priority strategy; S4-3: Define the joint comparison objective: 1) Loss compared across batches: ; in For the number of features, For temperature parameters, Let be the feature representation vectors of samples i, j, and k, respectively. This represents the set of comparison samples corresponding to sample i; 2) Prototype contrast loss with angular spacing: ; in Scaling factor s > 0, offset , For sample i and its true label The angles between the corresponding category prototypes, This represents the angle between sample i and category c; 3) Queueing related regular expressions Z is the set of embeddings sampled from various queues, where Let Z be the covariance matrix of the set of embedding vectors sampled from various queues. It is the identity matrix. The square of the F-norm; 4) Cosine annealing is used to schedule the temperature parameters to stabilize the early training.
5. The construction site target detection method based on multi-scale gating reweighting and contrastive learning according to claim 4, characterized in that, Step S5 specifically includes: S5-1: Use the detection dataset for basic training to build multiple N-way K-shot subtasks, each of which contains a query set and a support set; S5-2: The query set contains the query image and its annotation; the support set contains N categories, K support images for each category, and their bounding boxes / masks; S5-3: The detector acquires localization and classification capabilities through sub-task training, establishing cross-domain meta-knowledge; functions are used in the cascaded detector head. Generate FiLM parameters And applied to intermediate features ,in and These are the original intermediate features and the modulated intermediate features, respectively; S5-4: Enhanced strategies include flipping, translation, rotation, and enhanced perception of small targets / occlusions; S5-5: Fine-tune using labeled site data to achieve rapid adaptation to new site categories.
6. The construction site target detection method based on multi-scale gating reweighting and contrastive learning according to claim 5, characterized in that, Step S6 specifically includes: Construct the joint loss function as follows: = center + ; in center The loss function for the CenterNet header consists of three components: heatmap loss, size regression loss, and offset regression loss. This represents the prototype contrast loss with angular spacing; and Let represent the regression loss and classification loss of the i-th cascade head, respectively; This is the balance coefficient.
7. A construction site target detection system based on multi-scale gating reweighting and contrastive learning, used to implement the method described in any one of claims 1 to 6, characterized in that, The system includes: The feature extraction and gating module is used to extract multi-scale features and calculate gating coefficients to generate a set of scales that participate in the interaction; The proposal reweighting module is used to perform a three-branch interaction and generate candidate regions at the selected scale; The refined reweighting module is used to predict the displacement field, generate aligned prototypes, calculate the affinity matrix, and output aggregated features; The cross-batch contrastive learning module includes a class-grouped memory, a momentum encoder, and an update strategy for generating key vectors and calculating cross-batch contrastive loss, prototype contrastive loss with angular intervals, and queue decorrelation regularization. The meta-learning training module is used to construct N-way K-shot subtasks for basic training and fine-tuning, combined with enhancement strategies adapted to construction site scenarios and FiLM conditional modulation. The loss calculation and computational constraint module is used to jointly optimize each loss function and set computational constraints, limiting the number of scales involved in each image and the number of candidates involved in the reweighting of the refinement.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program performs the steps of the method described in any one of claims 1-6.