An occluded object detection method based on two-stage dynamic attention
By adopting a two-stage dynamic attention-based occluded object detection method, the problem of balancing detection accuracy and efficiency in occluded scenarios is solved, achieving efficient and accurate detection of occluded objects, which is suitable for edge devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2026-02-26
- Publication Date
- 2026-06-02
Smart Images

Figure CN122135097A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, and more specifically to an occluded object detection method based on two-stage dynamic attention. Background Technology
[0002] Object detection is a core task in the field of computer vision. The goal is to accurately identify the category and location of target objects in an image. In real-world applications, target objects are often occluded by objects such as trees, billboards, passing vehicles, and surrounding buildings, becoming partially visible or incomplete in outline. Examples include pedestrians blocked by trucks in autonomous driving, vehicles obscured by greenery in smart surveillance, and traffic signs blocked by buildings in urban security. This occlusion scenario limits the improvement of object detection accuracy, and traditional detection methods cannot meet the practical requirements of low latency and high accuracy.
[0003] Current object detection technologies mainly fall into two categories: single-stage and traditional two-stage approaches. Neither of these can simultaneously meet the requirements of detection accuracy and inference efficiency. Single-stage detection methods, such as YOLO and SSD, can obtain detection results directly in a single forward propagation, but they rely solely on overall target feature recognition and are insufficient in extracting features from occluded objects, leading to frequent missed detections. Traditional two-stage detection methods, such as Faster R-CNN and Mask R-CNN, first generate candidate regions and then perform fine classification. However, regardless of whether the region is a high-confidence unoccluded region or a low-confidence occluded region, a complete and detailed identification process is required, which significantly reduces inference speed and results in a lot of computational redundancy. This makes them unsuitable for low-computing edge devices such as vehicle terminals and surveillance cameras. Neither of these two methods has the ability to adaptively recognize occluded scenes. They either sacrifice occlusion detection accuracy for speed or increase deployment costs for accuracy.
[0004] Some solutions rely on feature completion networks to repair features in occluded areas, but fail to consider the relationship between object parts and the complete target. For example, seeing parts like wheels or windows doesn't automatically lead to the inference of a car, resulting in significant discrepancies between the completed features and the actual target. Other solutions introduce part-level features, but use static calls, relying entirely on the part feature extraction module, failing to balance accuracy and speed. A few solutions mention a two-stage architecture, but lack intelligent filtering and on-demand activation mechanisms, resulting in much unnecessary computation. Some improved solutions use complex deep learning models, such as multi-layer Transformers, which are large, computationally expensive, and require high-performance cloud support, making them unsuitable for edge deployment.
[0005] Current occlusion detection technology suffers from two core problems: first, the lack of an adaptive mechanism for assessing occlusion and dynamically allocating computing resources, failing to flexibly adjust resources based on the severity of occlusion, resulting in a trade-off between accuracy and speed; second, insufficiently targeted feature extraction in occluded scenarios, failing to fully utilize the correlation between component-level features and the complete target, leading to low accuracy in identifying occluded targets. In scenarios with high safety and real-time requirements, such as autonomous driving and intelligent monitoring, existing technologies can easily introduce safety risks, such as missing occluded pedestrians, or increase maintenance costs, such as relying on high-performance cloud computing. Therefore, there is an urgent need for an occlusion detection technology that can intelligently identify occlusion scenarios, dynamically allocate computing resources, and balance detection accuracy and inference efficiency, addressing the core problems of static computation, the imbalance between accuracy and speed, and the neglect of component-level correlation in existing technologies. Summary of the Invention
[0006] To overcome the shortcomings and deficiencies of existing technologies, this invention provides an occluded object detection method based on two-stage dynamic attention. Based on a two-stage architecture of coarse localization and fine discrimination, as well as a mechanism of dynamic activation and component-level feature association, it achieves accurate and efficient detection of occluded objects, adapts to the actual deployment requirements of edge devices, and solves the problems of existing object detection technologies in occluded scenarios where it is difficult to balance accuracy and speed, inaccurate identification of occluded targets, and difficulty in edge deployment.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] This invention provides an occluded object detection method based on two-stage dynamic attention, comprising the following steps:
[0009] Acquire the image to be detected and perform image preprocessing;
[0010] Extract global features, generate candidate regions for the target object, and calculate the preliminary confidence of the candidate regions;
[0011] An initial confidence threshold is set, and high-confidence candidate regions and low-confidence candidate regions are obtained based on the initial confidence threshold. The high-confidence candidate regions are used as the detection results of unobstructed targets.
[0012] Occlusion features are extracted from low-confidence candidate regions, and occlusion confidence is calculated based on the occlusion features;
[0013] Set an occlusion confidence threshold, and filter out low-confidence occlusion candidate regions based on the occlusion confidence threshold;
[0014] An adaptive activation threshold is calculated based on the occlusion confidence level, and conditional judgments are made based on the adaptive activation threshold to filter candidate regions to be finely identified.
[0015] To refine the candidate region, extract the component-level features and infer the occlusion target result based on the correlation between the occlusion pattern and the component.
[0016] The detection results of unobstructed targets are merged with the inferred results of occluded targets, and duplicates are removed to obtain the final detection result.
[0017] As a preferred technical solution, image preprocessing specifically includes:
[0018] The image to be detected is scaled to a uniform image size using bilinear interpolation.
[0019] Perform pixel value normalization;
[0020] The normalized image is smoothed using Gaussian filtering.
[0021] As a preferred technical solution, global features are extracted to generate candidate regions for the target object, and the preliminary confidence of the candidate regions is calculated, specifically including:
[0022] A coarse detection module is constructed based on the YOLOv8 model. The backbone network of the coarse detection module extracts features from the preprocessed image and inputs the extracted features into the feature pyramid network, which outputs multi-scale global features. Based on the global features, candidate regions of the target object are generated. Each candidate region obtains a bounding box coordinate and a preliminary category result. Based on the convolution operation of the classification head, the probability distribution of each category corresponding to the candidate region is output as the preliminary confidence level.
[0023] As a preferred technical solution, occlusion features are extracted from low-confidence candidate regions. The occlusion features include candidate region overlap rate, bounding box integrity, and local feature missingness.
[0024] Calculate the intersection-union ratio (IU) between the current low-confidence candidate region and the other candidate regions, and select the maximum IU among all IU as the candidate region overlap rate of that region.
[0025] The integrity of the bounding box is specifically represented as follows:
[0026] ;
[0027] in, Indicates the integrity of the bounding box. The actual aspect ratio of the candidate region. The standard aspect ratio for the corresponding category of targets;
[0028] After cropping low-confidence candidate regions, they are uniformly scaled to a fixed size and passed through a convolutional layer to obtain local texture feature maps. The local texture feature maps are flattened into one-dimensional vectors, and the frequency of each feature value in the vector is counted and the entropy value is calculated. The entropy value is normalized to the [0,1] interval to obtain the local feature missing degree.
[0029] As a preferred technical solution, the occlusion confidence score is calculated based on occlusion features and expressed as follows:
[0030] ;
[0031] in, , , Indicates the weighting coefficient. Indicates the overlap rate of candidate regions. Indicates the integrity of the bounding box. This indicates the degree of local feature loss.
[0032] As a preferred technical solution, conditional judgment is performed based on an adaptive activation threshold to screen candidate regions for fine identification, specifically including:
[0033] Obtain the occlusion confidence of the candidate region and adaptive activation threshold If determined The corresponding candidate region is the candidate region to be finely identified.
[0034] If the judgment , This represents the occlusion confidence threshold, which supplements the final result with the category and location information of the corresponding candidate region.
[0035] As a preferred technical solution, features at the component level are extracted from the candidate region to be finely identified, and the occlusion target result is inferred based on the correlation between the occlusion mode and the component. Specifically, this includes:
[0036] Based on prior knowledge of different target categories, the components and feature attributes of each target are predefined, and the feature region range and weight of each component are set.
[0037] Construct and train a component-level fine discrimination subnetwork to learn the relationship between occlusion patterns and components, and infer the occlusion target result based on the trained component-level fine discrimination subnetwork.
[0038] As a preferred technical solution, the feature region range and weight of each component are defined, specifically including:
[0039] The pixel region range of each component is defined based on the standard contour of the target category, and weights are assigned according to the component's recognition of the target category.
[0040] As a preferred technical solution, a component-level fine-grained discrimination subnetwork is constructed, specifically including:
[0041] The input layer crops out occlusion candidate region images from the original image;
[0042] The feature extraction layer is configured with two depthwise separable convolutions, and a ReLU activation function is applied after each convolution to output local feature maps of the components.
[0043] The feature aggregation layer first compresses the spatial feature map into a one-dimensional feature vector through a global average pooling layer, and then outputs the aggregated feature vector through an MLP network.
[0044] The feature mapping layer maps the aggregated feature vectors into a feature vector that combines classification and confidence.
[0045] The output layer outputs the final category and final confidence level of the target.
[0046] As a preferred technical solution, the detection results of unobstructed targets are merged with the inferred results of occluded targets, and duplicates are removed to obtain the final detection result. Specifically, this includes:
[0047] The detection results of unobstructed targets are merged with the inferred results of occluded targets to obtain a preliminary merged result set;
[0048] The initial merged result set is deduplicated based on the nonmaximum suppression algorithm;
[0049] The results after deduplication are output in a unified format, including the identified target category, bounding box coordinates, and the final confidence score for each target.
[0050] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0051] This invention utilizes a dynamic resource allocation mechanism based on occlusion discrimination and adaptive activation. It only calls the fine discrimination module for occluded candidate regions, improving inference speed compared to traditional two-stage methods. Compared to single-stage methods, it also significantly improves the recall rate of occluded targets, achieving an optimal balance between detection accuracy and inference efficiency. It extracts component-level features based on the core components of the target and the association between the complete target, effectively compensating for the pain point of missing features in occluded regions. This results in higher accuracy in occluded target detection. Furthermore, it employs a lightweight architecture to construct the fine discrimination sub-network, resulting in a small model size and low inference latency on edge terminals. It does not rely on high computing power support from the cloud and can be directly adapted to low-computing-power devices such as vehicle terminals and surveillance cameras. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating the occlusion object detection method based on two-stage dynamic attention of the present invention. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0054] Example
[0055] like Figure 1 As shown, this embodiment provides an occluded object detection method based on two-stage dynamic attention, including the following steps:
[0056] S1: Image Input and Standardized Preprocessing: The image to be detected is preprocessed in multiple dimensions to remove noise and unify the format, providing high-quality input data so that feature extraction is both accurate and consistent;
[0057] In this embodiment, the image normalization preprocessing specifically includes:
[0058] S11: Unify image size. Use bilinear interpolation to scale the input image to a pre-set fixed size of 640×640 pixels to ensure the integrity of the target object features and prevent size differences from affecting the detection results.
[0059] S12: During pixel value normalization, the pixel values of the scaled image are mapped to the range [0,1]. This is done to eliminate the influence of pixel values of different magnitudes on the training and inference processes of the model. The formula is:
[0060] ;
[0061] in, Represents the original pixel value. This represents the minimum number of pixels in the image. Indicates the maximum pixel value of the image;
[0062] S13: Noise suppression, using a 3×3 core size, standard deviation A Gaussian filter with a setting of 0.5 is used to smooth the normalized image, suppress Gaussian noise, and prevent noise from interfering with the extraction of target features.
[0063] S2: First stage coarse detection, generating candidate regions and preliminary confidence assessment. The detection model is used as a coarse detection module to quickly extract global image features, generate target candidate regions, calculate preliminary confidence, and quickly filter out unobstructed targets for direct output;
[0064] In this embodiment, the first stage of coarse detection specifically includes:
[0065] S21: Extract global features and build a coarse detection module using the YOLOv8 model. The YOLOv8 model can simultaneously balance detection speed and basic recognition accuracy, meeting the core requirement of rapid target screening in coarse detection. This module extracts features from the image preprocessed in step S1 through a backbone network. The backbone network is responsible for compressing the image size layer by layer and enhancing the target features. The extracted features are then fed into the Feature Pyramid Network (FPN) for further processing, fusing feature maps from different levels. This retains the semantic information of high-level features for identifying target categories and the positional information of low-level features for locating target boundaries. This can enhance the feature representation of small targets and occluded targets, preventing these targets from being missed due to weak features.
[0066] S22: Generating Candidate Regions. Leveraging the multi-scale global features output by the FPN, the model generates candidate regions for target objects using the prediction head. Each candidate region corresponds to a bounding box coordinate and a preliminary category result. The bounding box coordinates are represented in the form (x1, y1, x2, y2), where (x1, y1) is the pixel coordinate of the top-left corner of the candidate region, and (x2, y2) is the pixel coordinate of the bottom-right corner. With the bounding box coordinates, the location range of potential targets in the image can be accurately defined. The preliminary category of the candidate region is derived by the model through target feature inference (based on pre-trained category feature library matching logic), covering common detection targets such as cars, pedestrians, and traffic signs. This ensures that no potentially existing target object in the image is missed and provides complete input data for subsequent confidence judgment and occlusion filtering stages.
[0067] S23: Calculate the preliminary confidence score. When calculating the preliminary confidence score, the classification head of the coarse detection module is used to perform a confidence assessment for each candidate region, thereby outputting the preliminary detection confidence score. The initial confidence level ranges from 0 to 1. The classification head is actually the convolutional network layer in YOLOv8 responsible for class determination. It directly outputs the probability distribution of each category corresponding to the candidate region through convolution operations. This probability is used as the initial confidence level. The higher the confidence level, the greater the probability that the region is an unobstructed target.
[0068] S24. Filter high-confidence results and set the initial confidence threshold. It is 0.7. The threshold can be adaptively adjusted according to the actual scenario. For example, in intelligent monitoring scenarios where the tolerance for false detections is low, the threshold can be increased to 0.8. In autonomous driving scenarios where there is a risk of missed detections, the threshold can be decreased to 0.6.
[0069] You can directly put Candidate regions are included in the final result set as the detection results of unoccluded targets. These targets do not require further fine identification and are directly output in the final result set. If a candidate region is identified as a low-confidence region, it must proceed to the next stage to determine whether it is occluding the target, thus avoiding missed detections due to incomplete features.
[0070] S3: Perform occlusion detection and extract occlusion-related features, while filtering candidate regions suspected of being occluded.
[0071] In this embodiment, a lightweight occlusion discriminator is built to perform occlusion feature analysis on low-confidence candidate regions whose confidence level does not reach the initial confidence threshold during the initial detection in step S2, accurately screening out target regions that may be occluded, and providing targeted input for the fine identification in step S5.
[0072] In this embodiment, extracting occlusion features and filtering suspected occlusion candidate regions specifically includes:
[0073] S31: Extract occlusion features. Extract three types of key features from low-confidence candidate regions and use these features to quantify the actual occlusion of targets within the region.
[0074] Candidate region overlap rate ( : Calculate the intersection-union ratio (IoU) of the current candidate region with other candidate regions in the image. The maximum value is used to intuitively reflect the actual degree to which the target is occluded by other objects. In practice, first determine the bounding box coordinates (x1A, y1A, x2A, y2A) of the current candidate region A to be analyzed. Then, traverse all other candidate regions Bi in the image and calculate the coordinates of A and Bi for each region. The value, the calculation formula is Here , Let the areas of intersection and union of the two regions be represented respectively. All calculated areas are then considered. The maximum value among the values is used as the candidate region overlap rate for that region. Its value ranges from 0 to 1. The closer this value is to 1, the more severe the degree to which the target is overlapped and occluded by other objects.
[0075] Bounding box integrity ( Based on the prior contour of the target category, such as the standard aspect ratio of a car being approximately 1.8, the matching degree between the bounding box of the candidate region and the standard contour of the corresponding category is calculated. The lower the matching degree, the more severe the boundary occlusion of the target. In practice, the actual aspect ratio of the candidate region is first calculated. For example, the aspect ratio of a car target is calculated as the width to the height, and then substituted into the formula. Calculate bounding box integrity ,in, The actual aspect ratio of the candidate region. The standard aspect ratio for this category of targets ranges from 0 to 1. The closer it is to 1, the higher the match between the candidate region's outline and the standard outline, and the less severe the boundary occlusion of the target.
[0076] Local feature missing degree ( ): Use a lightweight 3×3 convolutional layer to extract local texture features of the candidate region, and then calculate its feature entropy value. A high entropy value means that the local features of the candidate region are more severely missing due to occlusion.
[0077] The specific calculation steps are as follows: First, the candidate region is cropped out, then uniformly scaled to a fixed size of 64×64 pixels, and input into a 3×3 convolutional layer with a stride of 1, padding of 1, and 16 output channels, thus obtaining a 64×64×16 local texture feature map. Next, the feature map is flattened into a one-dimensional vector, and the frequency of each feature value in the vector is counted. Then substitute it into the entropy formula Calculate the entropy value (where n is the number of feature types, if...). When this item is counted as 0), after calculating the original entropy value, the entropy value is normalized to the [0,1] interval to obtain the local feature missing value. The closer this value is to 1, the more severe the loss of local texture features due to occlusion.
[0078] S32. Calculate the occlusion confidence score. When calculating the occlusion confidence score, a weighted summation is performed on the three types of features mentioned in S31, resulting in a comprehensive occlusion confidence score. The formula is:
[0079] ;
[0080] Set weighting coefficients , , The values are 0.3, 0.4, and 0.3 respectively, and can be fine-tuned according to the actual scenario. This ensures that the contribution of each feature to occlusion detection is balanced.
[0081] S33. Filter suspected occlusion areas and set an occlusion determination threshold. (Can be fine-tuned according to the actual scenario) If the occlusion confidence of a certain area exceeds this threshold. If it is identified as a low-confidence occlusion candidate region, it will be sent to the next stage for fine-tuning. Otherwise, it will be discarded as a non-target region.
[0082] S4: Construct dynamic routes and adaptively activate component-level fine-grained discrimination subnetworks.
[0083] In this embodiment, a dynamic routing method based on occlusion confidence is constructed, which can flexibly adjust the activation threshold according to the severity of occlusion, thereby enabling the fine discrimination sub-network to be called only for high-priority occlusion candidate areas, realizing on-demand allocation of computing resources and reducing redundant computation.
[0084] In this embodiment, constructing dynamic routing and adaptively activating the component-level fine-grained discrimination subnetwork specifically includes:
[0085] S41: Calculate the adaptive activation threshold based on the occlusion confidence calculated in step S3. Dynamically adjust the activation threshold of the fine discrimination subnetwork. The core principle is that the more severe the target occlusion, the lower the corresponding activation threshold should be set. This makes it easier for candidate regions with high occlusion to trigger the fine-grained identification process, fundamentally ensuring that occluded targets are not missed. The calculation formula is as follows:
[0086] ;
[0087] in, It is the occlusion confidence score calculated in step S32. This represents the adaptive activation threshold, with a value range limited to 0.3 to 0.5. This range ensures the flexibility of the activation strategy, adapting to actual detection scenarios with different degrees of occlusion. Furthermore, the hard constraints of the upper and lower limits of the threshold can prevent over-activation or under-activation of sub-networks, making the entire adaptive activation strategy more targeted.
[0088] S42: When performing routing decisions, the low-confidence occlusion candidate regions selected in step S33 are further filtered. This requires first obtaining the occlusion confidence of the candidate regions. and the adaptive activation threshold calculated in step S41 Then perform a conditional judgment; if the judgment result meets the condition... In this situation, it indicates that the candidate region is highly occluded, and coarse detection alone is insufficient for accurate identification. In this case, the component-level fine-grained discrimination subnetwork is triggered and invoked to extract deep features and infer the target from this region. If the judgment result matches... (in As defined in step S33, the candidate region is determined to be a lightly occluded target. Its feature loss is relatively low, and the coarse detection result is of reference value. The category and location information of the candidate region can be directly added to the final result set without calling the fine discrimination sub-network for additional calculation, which can effectively reduce the consumption of redundant computing power.
[0089] S5: Perform fine identification, extract features at the component level, and make inferences about targets under occlusion.
[0090] In this embodiment, a component-level fine discrimination subnetwork with lightweight characteristics is constructed. Pre-defined core component features are extracted for the occlusion candidate region, and the occlusion mode is combined with the correlation between components to infer the target.
[0091] In this embodiment, the detailed identification, component-level feature extraction, and occlusion target inference specifically include:
[0092] S51: Anchoring component-level features. Based on prior knowledge of different target categories, the core components and feature attributes of each target are predefined, and the feature region range and key weights of each component are clarified. This ensures that the focus is on the component features most critical to target recognition. The first aspect is defining core components and assigning weights. For cars, the core components include wheels (35%), windows (30%), headlights (20%), and the logo (15%). For pedestrians, the core components include the head (40%), limbs (35%), and torso (25%). Weights are assigned according to the component's recognition of the target category, and the total weight must be 1. This method ensures that key component features are prioritized during subsequent extraction. The second aspect is dividing feature regions. The pixel region range of each core component is delineated based on the standard contour of the target category. For example, the car wheels correspond to the lower 1 / 3 of the bounding box, and the pedestrian head corresponds to the upper 1 / 4 of the bounding box.
[0093] S52: Subnetwork Structure Design. When designing the subnetwork structure, a lightweight architecture was chosen to design the component-level fine-grained discrimination subnetwork, controlling the model size and computational load. This ensures that the subnetwork can be efficiently deployed on edge devices such as in-vehicle terminals and surveillance cameras. The specific structure and parameter design details are described below:
[0094] The input layer receives a 224×224 pixel occlusion candidate region image cropped from the original image. This size can effectively reduce the computational load of subsequent steps while ensuring feature integrity.
[0095] The feature extraction layer consists of two depthwise separable convolutional layers with a uniform kernel size of 3×3, a stride of 1, and padding of 1. The number of groups is the same as the number of input channels (channel-wise convolution maximizes the lightweight effect). The number of output channels is configured as 32 and 64 respectively. Each convolutional layer is followed by a ReLU activation function, which introduces non-linear feature representation, avoids the gradient vanishing problem during model training, and efficiently extracts key local features such as texture and edges of each core component. The final output is a 224×224×64 dimension component local feature map.
[0096] The feature aggregation layer operates in two steps. First, a global average pooling layer compresses the 224×224×64 spatial feature map into a 64-dimensional one-dimensional feature vector, achieving dimensionality reduction and initial aggregation of global component information. Then, a small MLP network is connected, taking the 64-dimensional feature vector as input, with 32 hidden layer neurons and ReLU activation function, ultimately outputting a 64-dimensional aggregated feature vector. This process strengthens the feature correlation between different components and enhances the global expressive power of the features.
[0097] The feature mapping layer is connected to a lightweight fully connected layer with no activation function. It performs only linear mapping, mapping the 64-dimensional aggregated feature vector into a feature vector that combines classification and confidence. The vector dimension is fixed at "number of detection categories + 1" (e.g., when detecting two types of targets, cars and pedestrians, the dimension is 3). This maintains the lightweight characteristics while accurately adapting to the input requirements of the dual branches of the output layer.
[0098] The output layer adopts a fully connected, dual-branch parallel design. Based on the joint feature vector, it achieves independent output for category determination and confidence correction. The activation functions and output logic of each branch match the task requirements. One branch is the category branch, which decomposes the joint feature vector into a feature vector representing the number of detection categories. This feature vector is then converted into a probability distribution for each category using the Softmax activation function, outputting the final category of the target, covering common detection targets such as cars and pedestrians. The other branch is the confidence branch, which decomposes the joint feature vector into a 1-dimensional feature vector. This 1-dimensional feature vector is then mapped to the [0,1] interval using the Sigmoid activation function, outputting the corrected final confidence score. (The value ranges from 0 to 1). This confidence level can be comprehensively corrected by combining the component feature matching degree and the actual occlusion degree of the target, and the result will be more in line with the actual recognition accuracy.
[0099] S53. Adapting to Occlusion Patterns: In this specific step, the sub-network learns a mapping relationship through model training. This mapping relationship is from the features of visible parts and typical occlusion patterns to the complete target category. For example, if the features of wheels and windows are detected, even if the car body is occluded, it can still be inferred that this is a car. The specific training strategy is as follows:
[0100] Construction of the training dataset: Target samples containing different occlusion patterns were collected, including partial occlusion, overlapping occlusion, and edge occlusion. Then, fine-grained annotations were performed based on the precise pixel range of visible parts, occlusion patterns, and the true category of the target, ensuring the training data is consistent with the real-world scene and providing reliable support for learning the mapping relationship. The mapping relationship learning uses cross-entropy loss (for classification tasks) and MSE (mean squared error of confidence) as the joint loss function. Backpropagation is used to optimize the full parameters of the sub-network, combined with a mini-batch stochastic gradient descent (SGD) optimizer and a learning rate decay strategy. This allows the sub-network to grasp the reasoning logic of "partial part combination + occlusion pattern → target category." For example, if features like "wheel + window" are detected and identified as a central occlusion pattern, it can accurately infer that it is a car. Similarly, if features like "head + one arm" are detected and identified as a side occlusion pattern, it can infer that it is a pedestrian. To improve generalization ability, data augmentation operations such as random occlusion, scaling, and rotation will be added to ensure that the subnetwork can adapt to occlusion patterns that occur in different scenarios.
[0101] S54. Filtering Refined Results: A final confidence threshold of 0.5 was set for the refined identification process. This value can be flexibly adjusted to adapt to different detection scenarios based on actual needs, and will be determined according to the final confidence level after correction. This process filters out valid results from the identification process to avoid false positives. The specific filtering rule is: the final confidence level of the candidate region after correction reaches a certain threshold. If the target recognition result of this candidate region is deemed valid, the category information of this candidate region and the corrected bounding box coordinates based on the optimized position according to the component features are retained. If the final confidence of the candidate region does not reach this threshold... If the identification result of a candidate region is deemed unreliable, such as when the part features and standard features have a low matching degree or the target is too severely occluded to accurately infer the specific category and location, then the candidate region will be discarded and not included in the final detection result set. This screening method can effectively reduce the false detection rate of the entire detection process.
[0102] S6: Result merging and output. The detection results from steps S2 and S5 are merged together and deduplicated to obtain the final detection result. Specifically, this includes:
[0103] S61: Preliminary result fusion: The high-confidence unobstructed detection results obtained in step S2 are integrated with the occluded region fine detection results obtained in step S5 as a preliminary merged result set;
[0104] S62. Non-maximum suppression (NMS): When the same target is repeatedly labeled by multiple bounding boxes in the initial merge result set, the non-maximum suppression algorithm is used to remove duplicates. The intersection-over-union (IoU) threshold of the algorithm is set to 0.45 to ensure that only the bounding box with the highest confidence and the most accurate position is retained for each target. First, all bounding boxes in the initial merge result set are sorted from highest to lowest confidence. Then, the bounding box with the highest confidence after sorting is selected as the reference box, and the IoU value between this reference box and all the remaining bounding boxes is calculated one by one. If the IoU between a bounding box and the reference box is ≥0.45, this box is determined to be a duplicate box and is directly removed. The process of "selecting the reference box, calculating IoU, and removing duplicates" is repeated for the remaining unprocessed bounding boxes until the verification of all bounding boxes is completed.
[0105] S63. Output Results: Output the final detection results after deduplication using the NMS algorithm in a unified JSON format. The output should include the specific category of the identified target, the precise bounding box coordinates (x1, y1, x2, y2), and the final confidence score for each target. This data can help downstream systems make informed decisions.
[0106] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. An occluded object detection method based on two-stage dynamic attention, characterized in that, Includes the following steps: Acquire the image to be detected and perform image preprocessing; Extract global features, generate candidate regions for the target object, and calculate the preliminary confidence of the candidate regions; An initial confidence threshold is set, and high-confidence candidate regions and low-confidence candidate regions are obtained based on the initial confidence threshold. The high-confidence candidate regions are used as the detection results of unobstructed targets. Occlusion features are extracted from low-confidence candidate regions, and occlusion confidence is calculated based on the occlusion features; Set an occlusion confidence threshold, and filter out low-confidence occlusion candidate regions based on the occlusion confidence threshold; An adaptive activation threshold is calculated based on the occlusion confidence level, and conditional judgments are made based on the adaptive activation threshold to filter candidate regions to be finely identified. To refine the candidate region, extract the component-level features and infer the occlusion target result based on the correlation between the occlusion pattern and the component. The detection results of unobstructed targets are merged with the inferred results of occluded targets, and duplicates are removed to obtain the final detection result.
2. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, Image preprocessing specifically includes: The image to be detected is scaled to a uniform image size using bilinear interpolation. Perform pixel value normalization; The normalized image is smoothed using Gaussian filtering.
3. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, Extract global features, generate candidate regions for the target object, and calculate the preliminary confidence of the candidate regions, specifically including: A coarse detection module is constructed based on the YOLOv8 model. The backbone network of the coarse detection module extracts features from the preprocessed image and inputs the extracted features into the feature pyramid network, which outputs multi-scale global features. Based on the global features, candidate regions of the target object are generated. Each candidate region obtains a bounding box coordinate and a preliminary category result. Based on the convolution operation of the classification head, the probability distribution of each category corresponding to the candidate region is output as the preliminary confidence level.
4. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, Occlusion features are extracted from low-confidence candidate regions. These occlusion features include candidate region overlap rate, bounding box integrity, and local feature missingness. Calculate the intersection-union ratio (IU) between the current low-confidence candidate region and the other candidate regions, and select the maximum IU among all IU as the candidate region overlap rate of that region. The integrity of the bounding box is specifically represented as follows: ; in, Indicates the integrity of the bounding box. The actual aspect ratio of the candidate region. The standard aspect ratio for the corresponding category of targets; After cropping low-confidence candidate regions, they are uniformly scaled to a fixed size and passed through a convolutional layer to obtain local texture feature maps. The local texture feature maps are flattened into one-dimensional vectors, and the frequency of each feature value in the vector is counted and the entropy value is calculated. The entropy value is normalized to the [0,1] interval to obtain the local feature missing degree.
5. The occluded object detection method based on two-stage dynamic attention according to claim 4, characterized in that, Occlusion confidence is calculated based on occlusion features and expressed as follows: ; in, , , Indicates the weighting coefficient. Indicates the overlap rate of candidate regions. Indicates the integrity of the bounding box. This indicates the degree of local feature loss.
6. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, Based on an adaptive activation threshold, conditional judgments are made to filter candidate regions for further detailed identification, specifically including: Obtain the occlusion confidence of the candidate region and adaptive activation threshold If determined The corresponding candidate region is the candidate region to be finely identified. If the judgment , This represents the occlusion confidence threshold, which supplements the final result with the category and location information of the corresponding candidate region.
7. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, For fine-grained identification of candidate regions, feature extraction at the component level is performed. The occlusion target result is inferred based on the correlation between occlusion patterns and components. Specifically, this includes: Based on prior knowledge of different target categories, the components and feature attributes of each target are predefined, and the feature region range and weight of each component are set. Construct and train a component-level fine discrimination subnetwork to learn the relationship between occlusion patterns and components, and infer the occlusion target result based on the trained component-level fine discrimination subnetwork.
8. The occluded object detection method based on two-stage dynamic attention according to claim 7, characterized in that, Define the feature region range and weight of each component, specifically including: The pixel region range of each component is defined based on the standard contour of the target category, and weights are assigned according to the component's recognition of the target category.
9. The occluded object detection method based on two-stage dynamic attention according to claim 7, characterized in that, Constructing a component-level fine-grained discrimination subnetwork, specifically including: The input layer crops out occlusion candidate region images from the original image; The feature extraction layer is configured with two depthwise separable convolutions, and a ReLU activation function is applied after each convolution to output local feature maps of the components. The feature aggregation layer first compresses the spatial feature map into a one-dimensional feature vector through a global average pooling layer, and then outputs the aggregated feature vector through an MLP network. The feature mapping layer maps the aggregated feature vectors into a feature vector that combines classification and confidence. The output layer outputs the final category and final confidence level of the target.
10. The occluded object detection method based on two-stage dynamic attention according to claim 1, characterized in that, The detection results of unobstructed targets are merged with the inferred results of occluded targets, and duplicates are removed to obtain the final detection result, which includes: The detection results of unobstructed targets are merged with the inferred results of occluded targets to obtain a preliminary merged result set; The initial merged result set is deduplicated based on the nonmaximum suppression algorithm; The results after deduplication are output in a unified format, including the identified target category, bounding box coordinates, and the final confidence score for each target.