AI image target recognition and feature matching method in anti-occlusion scene
By employing occlusion prediction, precise segmentation, and feature repair methods, the problems of low accuracy and poor robustness in image target recognition and feature matching under occlusion scenarios are solved, achieving efficient real-time recognition and matching, and applicable to complex occlusion scenarios.
Patent Information
- Application Number
- CN202610233678.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-27
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies suffer from low accuracy and poor robustness in image target recognition and feature matching under occlusion scenarios. They also fail to thoroughly process occlusion areas, lack real-time performance, and cannot effectively address complex occlusion or occlusion types.
We adopt an occlusion prediction-precise segmentation-feature repair strategy. We use multi-scale feature extraction, an improved U-Net segmentation network and a generative adversarial network (GAN) to accurately segment and repair occluded regions. We combine an improved cosine similarity algorithm for feature matching optimization and achieve real-time recognition through iterative training and lightweight processing.
It significantly improves the target recognition accuracy in scenarios with severe occlusion and overlapping occlusion, reduces false matches and missed matches, meets real-time requirements, and is suitable for scenarios such as surveillance and security and autonomous driving.
Smart Images

Figure CN122135011A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision technology, specifically an AI image target recognition and feature matching method in occlusion-resistant scenarios. Background Technology
[0002] With the rapid development of AI and computer vision technologies, image target recognition and feature matching technologies have been widely applied in various fields, becoming one of the core technologies of intelligent systems. However, in practical applications, target occlusion is a common problem. For example, pedestrians are obscured by obstacles in surveillance scenarios, vehicles are obscured by pedestrians or buildings in autonomous driving scenarios, and targets are obscured by clutter in robot vision scenarios. These occlusion situations lead to incomplete target feature extraction and interference with feature matching, thereby reducing the accuracy of target recognition and the robustness of matching.
[0003] In existing technologies, methods for anti-occlusion target recognition and feature matching are mainly divided into two categories: one is to generate training samples containing occlusions through data augmentation to improve the model's adaptability to occluded scenes. However, this type of method cannot solve the problem of recognizing unknown occlusion types in practical applications, and its processing effect is poor for severe occlusion and overlapping occlusion. The other type is to enhance the features of non-occluded areas through attention mechanisms to suppress interference from occluded areas. However, this type of method lacks accurate segmentation and feature repair of occluded areas. When the occlusion area is large, feature loss will still occur, leading to recognition and matching failure.
[0004] Furthermore, existing methods often employ single-dimensional feature matching without considering occlusion type, occlusion area, or other specific factors for targeted optimization. This leads to frequent false and missed matches. Additionally, existing models are often general-purpose and lack specific optimization for occlusion scenarios, resulting in poor real-time performance and robustness for practical applications. For instance, conventional data augmentation methods (random occlusion, random cropping) cannot effectively simulate complex occlusion in real-world scenarios, causing a significant drop in accuracy. Methods using a single attention mechanism cannot accurately segment occluded regions or effectively repair missing features, making them ill-suited for severe occlusion scenarios.
[0005] Therefore, in view of the technical defects of existing technologies such as low recognition accuracy in occluded scenarios, poor feature matching robustness, incomplete handling of occluded areas, and insufficient real-time performance, there is an urgent need for an AI image target recognition and feature matching method in occluded scenarios that can accurately handle various occlusions, achieve efficient feature extraction and matching, and has both real-time performance and robustness. Summary of the Invention
[0006] In view of the above situation and to overcome the shortcomings of the prior art, the present invention provides an AI image target recognition and feature matching method in anti-occlusion scenarios, which effectively solves the problems mentioned in the background technology.
[0007] To achieve the above objectives, the present invention provides the following technical solution: an AI image target recognition and feature matching method for occlusion-resistant scenarios, comprising the following steps: Step 1: Image preprocessing and occlusion prediction. Obtain the target image to be identified, perform standardization processing on the image, and analyze the grayscale distribution, edge density and pixel change characteristics of the image through the occlusion prediction module to determine whether the image has occlusion and the type and proportion of occlusion area. Step 2: Multi-scale anti-occlusion feature extraction. A multi-scale feature extraction network is constructed to extract features at different scales from the preprocessed image, obtaining shallow texture features, mid-level contour features, and deep semantic features respectively. The channel-space dual attention module is used to enhance the features of non-occluded areas and suppress interference from occluded areas. Step 3: Accurate segmentation and feature restoration of occluded regions. Based on the occlusion prediction results in Step 1, an improved U-Net segmentation network is used to accurately segment the occluded regions and obtain the location and shape information of the occluded regions. By combining the features of the non-occluded regions with the features of the generative adversarial network (GAN), the features of the occluded regions are accurately restored to obtain a complete target feature map. Step 4: Layered feature fusion. The multi-scale features extracted in Step 2 are fused with the complete feature map repaired in Step 3 in a layered manner. Shallow features are fused by element-wise addition, mid-level features are fused by attention-weighted fusion, and deep features are fused by concatenation to obtain the fused comprehensive target features. Step 5: Initial target identification and candidate box selection. The fused target comprehensive features are input into the preset target identification head to perform initial target category identification and generate multiple target candidate boxes. Candidate boxes with confidence scores higher than the preset threshold are retained as target candidate regions through Intersection over Union (IoU) threshold selection and confidence score ranking. Step 6: Feature matching and similarity calculation. Construct an anti-occlusion feature matching library, extract the comprehensive features of the target candidate regions after screening in Step 5, compare them with the standard target features in the feature matching library, and use an improved cosine similarity algorithm to calculate the similarity between the two to obtain preliminary matching results. Step 7: Matching result optimization. Based on the occlusion type and occlusion area ratio in Step 1, the preliminary matching results are weighted and optimized. For partially occluded targets, a non-occluded region feature weight enhancement strategy is adopted, and for severely occluded targets, a multi-feature dimension complementary verification strategy is adopted to eliminate false matching results and obtain the optimal matching result. Step 8: Model Iteration and Update. Collect the best matching results from Step 7 and the corresponding image data and feature data, construct an iterative training dataset, and iteratively optimize the parameters of the multi-scale feature extraction network, occlusion segmentation network, and feature repair network to improve the model's anti-occlusion recognition and matching performance. Step 9: Real-time recognition and matching deployment. The optimized model is lightweighted and deployed to the target recognition terminal. The image to be recognized is acquired, preprocessed, feature extracted, occlusion segmented and repaired, and feature matched in real time, and the real-time recognition and matching results are output. Step 10: Output and store the results. The optimal matching result from Step 7 or the real-time matching result from Step 9 is output in a formatted manner. At the same time, the image to be identified, target features, matching results and occlusion information are stored to form a complete recognition and matching log for subsequent query and traceability.
[0008] Preferably, the standardization process in step one specifically involves: uniformly adjusting the size of the target image to be identified to 640×640 pixels, normalizing the image to normalize the pixel values to the [0,1] range, and using a Gaussian filtering algorithm to remove image noise. The kernel size of the Gaussian filter is set to 3×3, and the standard deviation is set to 0.5. The occlusion prediction module includes a gray-level statistics unit, an edge detection unit, and an occlusion judgment unit. The gray-level statistics unit calculates the mean and variance of gray levels in each region of the image. The edge detection unit uses the Canny operator to extract image edges and calculates edge density. The occlusion judgment unit determines the occlusion type as partial occlusion, severe occlusion, or overlapping occlusion based on the gray-level variance mutation threshold and the edge density threshold. The occlusion area of partial occlusion is 10%-30%, the occlusion area of severe occlusion is 30%-70%, and the occlusion area of overlapping occlusion is ≥70%.
[0009] Preferably, the multi-scale feature extraction network in step two is based on an improved ResNet50 network. Multi-scale convolutional modules are added to layers 2, 3, and 4 of the network. The multi-scale convolutional modules contain three types of convolutional kernels: 1×1, 3×3, and 5×5, corresponding to small, medium, and large scales, respectively. The convolutional stride is set to 1, and the padding is set to half the size of the corresponding convolutional kernel. The channel-spatial dual attention module includes a channel attention submodule and a spatial attention submodule. The channel attention submodule obtains channel feature weights through global average pooling and global max pooling, while the spatial attention submodule obtains spatial feature weights through channel concatenation and convolution operations. The weights of the two submodules are multiplied together and then element-wise multiplied with the original feature map to achieve feature enhancement in non-occluded regions.
[0010] Preferably, the improved U-Net segmentation network in step three adds residual connections to the encoder part and uses a combination of transposed convolution and skip connections in the decoder part. Attention gating units are added to the skip connections to suppress interference information in occluded areas and improve segmentation accuracy. The generative adversarial network (GAN) includes a generator and a discriminator. The generator adopts a U-Net++ structure, with inputs of non-occluded area features and occluded area location information, and outputs the repaired occluded area features. The discriminator adopts a convolutional neural network structure to judge the similarity between the repaired features and the real non-occluded features. The generator and discriminator achieve accurate feature repair through adversarial training.
[0011] Preferably, the specific process of layered feature fusion in step four is as follows: shallow texture features are fused element-wise with an added coefficient of 0.5; mid-level contour features are fused with attention weights, with the weights determined by the spatial weights output by the channel-space dual attention module; deep semantic features are fused in series, connecting the deep features and the repaired feature map in series along the channel dimension to obtain a target comprehensive feature with a dimension of 2048; after fusion, a BatchNorm layer is used for normalization to avoid feature redundancy.
[0012] Preferably, the target recognition head in step five adopts a dual-branch structure, which is used for target category recognition and candidate box regression respectively. The category recognition branch uses a fully connected layer to output the target category probability, and the candidate box regression branch outputs the coordinate offset of the candidate box. The intersection-over-union (IoU) threshold is set to 0.5, the confidence threshold is set to 0.7, and candidate boxes with confidence ≥ 0.7 and IoU ≤ 0.5 are selected as target candidate regions. If the number of candidate boxes is less than 3, the confidence threshold is reduced to 0.6 and re-selected.
[0013] Preferably, the anti-occlusion feature matching library mentioned in step six contains standard feature templates for various targets. Each standard feature template contains three levels of features: shallow, medium, and deep. The feature matching library supports dynamic updates. The improved cosine similarity algorithm introduces non-occluded region feature weights based on traditional cosine similarity. The calculation formula is as follows: Where Fi is the unoccluded feature of the candidate region, Gi is the unoccluded feature of the standard target, Fj is the restored feature of the candidate region, Gj is the feature of the corresponding region of the standard target, α is the weight of the unoccluded feature with a value of 0.7, β is the weight of the restored feature with a value of 0.3, and ||F|| and ||G|| are the magnitudes of the candidate region feature and the standard target feature, respectively.
[0014] Preferably, the specific process of optimizing the matching results in step seven is as follows: For partially occluded targets, the feature weight α of the non-occluded region is increased to 0.8, the feature weight β of the repair is reduced to 0.2, and the similarity is recalculated; for severely occluded targets, two complementary dimensions, shape features and texture features, are added, and the average of the multi-dimensional similarity is calculated as the final similarity; for overlapping occluded targets, a candidate box splitting strategy is adopted, the overlapping regions are split and feature matching is performed separately, and then the matching results are merged; the criterion for judging false matching results is that the similarity is less than 0.5, and the shape similarity between the candidate box and the standard target is less than 0.6.
[0015] Preferably, the construction criteria for the iterative training dataset in step eight are as follows: the number of samples for each category is not less than 1000, the proportion of occluded samples is not less than 40%, and it covers three types: partial occlusion, severe occlusion, and overlapping occlusion; the iterative optimization adopts the stochastic gradient descent (SGD) optimizer, with the learning rate set to 0.001, momentum set to 0.9, weight decay set to 0.0001, the number of iterations set to 100 rounds, and validation is performed every 20 rounds. When the accuracy of the validation set improves by ≥2%, the current model parameters are saved.
[0016] Preferably, the model lightweighting process in step nine employs a combination of pruning and quantization. Pruning uses a structured pruning strategy, removing redundant convolutional and fully connected layers from the network, with a pruning rate of 30%. Quantization uses INT8 quantization, converting model parameters from 32-bit floating-point quantization to 8-bit integers, reducing model storage and computational load. The real-time recognition and matching frame rate is no less than 30 FPS, and the recognition latency is no more than 30 ms. The recognition and matching log in step ten includes image acquisition time, target category, occlusion type, occlusion area ratio, matching similarity, and matching result, stored in JSON format, and supports querying by time and target category.
[0017] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention innovatively proposes an integrated processing strategy of "occlusion prediction - accurate segmentation - feature repair". First, the occlusion prediction module accurately determines the occlusion type and occlusion area. Then, the improved U-Net segmentation network is used to achieve accurate segmentation of the occluded region. Finally, the GAN network is used to repair the features of the occluded region. This solves the problems of incomplete occlusion processing and feature loss in the existing technology, and significantly improves the target recognition accuracy in severe occlusion and overlapping occlusion scenarios. 2. A multi-scale feature extraction network combined with a channel-spatial dual attention module was designed, which can simultaneously extract shallow texture, mid-level contour and deep semantic features of the target, enhance the features of non-occluded areas and suppress interference from occluded areas. Compared with existing single-scale feature extraction methods, the feature extraction is more complete and more targeted. 3. An improved cosine similarity algorithm and a hierarchical feature fusion strategy are proposed. Targeted matching optimization is performed based on occlusion type, avoiding the limitations of single-dimensional feature matching, reducing false matching and missed matching, and improving the robustness and accuracy of feature matching. 4. By adopting a model iterative update mechanism, the model parameters are continuously optimized by constructing diverse occlusion training datasets, thereby improving the model's adaptability to different occlusion scenarios and solving the problem of poor generalization ability of existing models. 5. The model is lightweighted and combined with TensorRT to accelerate deployment, achieving real-time recognition and matching (frame rate ≥30FPS, latency ≤30ms), which meets the high real-time requirements of scenarios such as surveillance and security, and autonomous driving. 6. The entire method is clear and easy to operate, covering the entire process from image acquisition to result storage. It is applicable to a variety of anti-occlusion scenarios and has broad practicality and promotional value. Attached Figure Description
[0018] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0019] In the attached diagram: Figure 1 This is an overall flowchart of the AI image target recognition and feature matching method in anti-occlusion scenarios according to the present invention; Detailed Implementation
[0020] 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. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0021] Depend on Figure 1 This invention relates to an AI image target recognition and feature matching method in occlusion-resistant scenarios, comprising the following steps: Step 1: Image preprocessing and occlusion prediction 1.1. Acquire the image of the target to be identified. The image source includes surveillance cameras, industrial cameras, mobile terminal cameras, etc. The image format is JPG, PNG or BMP, and the resolution is not less than 320×320 pixels. 1.2. Standardize the acquired target image to be identified. The specific operations are as follows: Adjust the image size to 640×640 pixels and use bilinear interpolation algorithm to scale the size to ensure that the image is not distorted; normalize the scaled image by dividing the pixel value of each pixel by 255 and normalizing it to the [0,1] interval to eliminate the influence of pixel value differences on subsequent feature extraction; use a 3×3 Gaussian filter algorithm to remove image noise, set the standard deviation of the Gaussian filter to 0.5, and smooth the image through convolution operation to retain target features while removing irrelevant noise. 1.3 An occlusion prediction module is constructed, consisting of a grayscale statistics unit, an edge detection unit, and an occlusion judgment unit. The specific working process is as follows: The grayscale statistics unit calculates the mean and variance of the grayscale values of each 8×8 pixel block in the image, counts the number of pixel blocks with a grayscale variance greater than a preset threshold (threshold set to 20), and determines whether there are grayscale abrupt change regions in the image. The edge detection unit uses the Canny operator to extract image edges. The high threshold of the Canny operator is set to 150, and the low threshold is set to 50. It calculates the edge density of the image (the ratio of the number of edge pixels to the total number of pixels in the image). The occlusion judgment unit combines the number of grayscale abrupt change regions and the edge density to determine whether the image is occluded. Simultaneously, based on the area ratio of the occluded area, it determines the occlusion type: when the occlusion area ratio is 10%-30%, it is determined to be partial occlusion; when the occlusion area ratio is 30%-70%, it is determined to be severe occlusion; when the occlusion area ratio is ≥70%, it is determined to be overlapping occlusion; when the occlusion area ratio is <10%, it is determined to be no occlusion, and proceeds directly to step two. 1.4 Output occlusion prediction results, including whether occlusion exists, occlusion type, preliminary location of the occluded area (represented by pixel coordinates), and occlusion area percentage, for use in subsequent steps.
[0022] Step 2: Multi-scale anti-occlusion feature extraction 2.1 Construct a multi-scale feature extraction network. Based on the improved ResNet50, optimize the network structure of ResNet50 by adding multi-scale convolutional modules to the 2nd, 3rd, and 4th layers (conv2_x, conv3_x, conv4_x) to solve the problem that single-scale feature extraction cannot take into account both target details and global features. 2.2 The structure of the multi-scale convolution module is as follows: It contains three different sizes of convolution kernels: 1×1, 3×3, and 5×5. The number of kernels in each type is 64. The stride of each kernel is set to 1, and the padding is set to half the size of the corresponding kernel (1×1 convolution padding=0, 3×3 convolution padding=1, 5×5 convolution padding=2). The input feature map is subjected to parallel convolution operations through the three types of kernels to extract small-scale (detail texture), medium-scale (target contour), and large-scale (global semantic) features respectively. Then, the features of the three scales are fused by channel concatenation to obtain a multi-scale feature map. 2.3. Add a channel-spatial dual attention module to the output of the multi-scale convolution module to enhance the features of non-occluded regions and suppress interference from occluded regions. The specific operation is as follows: The channel attention submodule performs global average pooling and global max pooling on the multi-scale feature map to obtain two 1×1×C feature vectors (C is the number of feature channels). The two feature vectors are input into an MLP network containing two fully connected layers, and the output channel weight vector is normalized by the Sigmoid activation function. The spatial attention submodule concatenates the channel attention-weighted feature map and inputs it into a 3×3 convolutional layer to output a 1×1×H×W spatial weight map (H and W are the height and width of the feature map). The weights are normalized by the Sigmoid activation function. The channel weight vector is element-wise multiplied with the spatial weight map, and then element-wise multiplied with the original multi-scale feature map to obtain the enhanced multi-scale features. 2.4 Extract shallow texture features (feature map output by conv2_x, with 256 channels), mid-level contour features (feature map output by conv3_x, with 512 channels), and deep semantic features (feature map output by conv4_x, with 1024 channels) respectively, and output feature maps of three scales for use in subsequent steps.
[0023] Step 3: Precise segmentation and feature repair of occluded areas 3.1 Based on the occlusion prediction results output in Step 1, an improved U-Net segmentation network is built to accurately segment the occluded region. The structure of the improved U-Net segmentation network is as follows: The encoder part uses the first 4 layers of ResNet50 as the basis, and adds residual connections to avoid gradient vanishing caused by the increase in network depth; the decoder part uses transposed convolution (2×2 kernel size, stride of 2) to upsample the feature map, and adds skip connections to concatenate the feature maps output by each layer of the encoder with the feature maps of the corresponding layers of the decoder to supplement detailed information; attention gating units are added in the skip connections to suppress interference information in the occluded region through weight allocation and improve segmentation accuracy. 3.2 Input the image after preprocessing in step one into the improved U-Net segmentation network, and output the occlusion region segmentation mask. The mask is a binary image, where the region with a pixel value of 1 is the occluded region and the region with a pixel value of 0 is the unoccluded region. The precise location (pixel coordinate range) and shape information of the occluded region are obtained through the segmentation mask. 3.3. Construct a Generative Adversarial Network (GAN) for accurate feature restoration of occluded regions. The GAN consists of a generator and a discriminator: The generator adopts a U-Net++ structure, with inputs being the non-occluded region features extracted in step two (obtained through segmentation masking) and the location information of the occluded region, and outputs the restored occluded region feature map. The generator's loss function combines L1 loss and adversarial loss. L1 loss ensures the similarity between the restored features and the real features, while adversarial loss enhances the authenticity of the restored features. The discriminator adopts a 3-layer convolutional neural network structure, with inputs being the restored feature map and the real non-occluded region feature map, and outputs the probability of judging the authenticity of the features. The discriminator's loss function uses cross-entropy loss. 3.4. Perform adversarial training on the generator and discriminator. Set the number of training iterations to 50 rounds, the learning rate to 0.0002, and the momentum to 0.5. After training, input the features of the non-occluded region and the location information of the occluded region into the generator to obtain the repaired occluded region feature map. 3.5. The feature map of the non-occluded area is stitched together with the feature map of the repaired occluded area to obtain a complete target feature map with 1024 channels, which is used for subsequent feature fusion.
[0024] Step 4: Layered Feature Fusion 4.1 For the shallow texture features, mid-level contour features, and deep semantic features extracted in step two, as well as the complete target feature map obtained in step three, a layered fusion strategy is adopted to achieve feature complementarity and enhancement. The specific fusion process is as follows: 4.1.1 Shallow texture feature fusion: The shallow texture features (256 channels) extracted in step two are fused with the corresponding shallow features in the complete target feature map element by element, with the fusion coefficient set to 0.5, to obtain the fused shallow features, which retain the detailed texture information of the target. 4.1.2 Mid-layer contour feature fusion: The mid-layer contour features (512 channels) extracted in step 2 are fused with the corresponding mid-layer features in the complete target feature map by attention weighting. The weights are determined by the spatial weights output by the channel-space dual attention module in step 2. The weights of non-occluded areas are higher than those of occluded areas, resulting in fused mid-layer features that enhance the contour information of the target. 4.1.3 Deep semantic feature fusion: The deep semantic features (1024 channels) extracted in step two are concatenated and fused with the complete target feature map according to the channel dimension to obtain a deep fused feature with 2048 channels, thus preserving the global semantic information of the target; 4.2 The shallow, middle and deep features after fusion are concatenated to obtain the fused target comprehensive features, with a channel count of 2048+512+256=2816; 4.3 Input the target comprehensive features into the BatchNorm layer for normalization processing to eliminate feature redundancy, accelerate subsequent calculations, and output the normalized target comprehensive features.
[0025] Step 5: Initial Target Identification and Candidate Box Selection 5.1 Construct a target recognition head with a dual-branch structure, used for target category recognition and candidate box regression respectively: The category recognition branch consists of two fully connected layers and a Softmax activation function, with the input being the comprehensive target features and the output being the probability of each target category; The candidate box regression branch consists of two fully connected layers, with the input being the comprehensive target features and the output being the coordinate offset of the candidate box (offset in the x and y directions and offset in width and height). 5.2 Input the comprehensive target features output in step four into the target recognition head to perform preliminary target category recognition and generate multiple target candidate boxes. Each candidate box contains coordinate information (x1, y1, x2, y2), category probability, and confidence level. 5.3 Filter the generated candidate boxes. The specific operation is as follows: First, calculate the confidence of each candidate box and filter out the candidate boxes with a confidence of ≥0.7; then calculate the intersection-over-union ratio (IoU) between the filtered candidate boxes. If the IoU of two candidate boxes is >0.5, then retain the candidate box with higher confidence and remove the candidate box with lower confidence. 5.4 If the number of candidate boxes after filtering is less than 3, the confidence threshold is lowered to 0.6 and the filtering is repeated to ensure that there are enough candidate boxes for subsequent feature matching. 5.5 Output the filtered target candidate regions. Each candidate region includes the candidate box coordinates, class probability, and confidence score.
[0026] Step Six: Feature Matching and Similarity Calculation 6.1 Construct an anti-occlusion feature matching library. The feature matching library contains standard feature templates for various targets. Each standard feature template is extracted according to the methods in steps one to four of this invention. It contains three levels of features: shallow, medium and deep. The feature dimensions are consistent with the comprehensive features of the target (2816 dimensions). The feature matching library supports dynamic updates. New standard feature templates for targets can be added, and outdated feature templates can be deleted. 6.2 Extract the comprehensive features of each target candidate region after screening in step five. The extraction method is the same as in step four to ensure that the dimensions and format of the candidate region features are consistent with the standard feature template. 6.3. An improved cosine similarity algorithm is used to compare the comprehensive features of the candidate region with each standard target feature template in the feature matching library, and the similarity between the two is calculated. The calculation formula of the improved cosine similarity algorithm is as follows: Where: Fi is the unoccluded feature of the candidate region, Gi is the unoccluded feature of the standard target, Fj is the restored feature of the candidate region, Gj is the feature of the corresponding region of the standard target, α is the weight of the unoccluded feature with a value of 0.7, β is the weight of the restored feature with a value of 0.3, ||F|| is the magnitude of the candidate region feature, and ||G|| is the magnitude of the standard target feature; 6.4 For each candidate region, select the top 3 standard target feature templates with the highest similarity as the preliminary matching results, and output the preliminary matching results and the corresponding similarity values.
[0027] Step 7: Optimize Matching Results 7.1 Based on the occlusion type and occlusion area ratio output in step one, the preliminary matching results are optimized with targeted weighting. The specific optimization strategy is as follows: 7.1.1 Partial Occlusion (Occlusion area accounts for 10%-30%): Since the features of the non-occluded area are complete, the weight α of the non-occluded feature is increased to 0.8, the weight β of the repair feature is reduced to 0.2, the similarity between the candidate region and the standard target is recalculated, and the matching result with the highest similarity is retained. 7.1.2 Severe Occlusion (Occlusion area accounts for 30%-70%): The features of the non-occluded area are incomplete. Two complementary dimensions, shape features and texture features, are added. The shape feature uses the shape similarity between the candidate box and the standard target box (the absolute value of the difference in aspect ratio ≤ 0.2). The texture feature uses the cosine similarity of the shallow texture features. The average of the multi-dimensional similarity is calculated (improved cosine similarity accounts for 0.6, shape similarity accounts for 0.2, and texture similarity accounts for 0.2) as the final similarity. The matching result with the highest similarity is retained. 7.1.3 Overlapping Occlusion (Occlusion area ≥ 70%): A candidate box splitting strategy is adopted to split the overlapping area into multiple sub-candidate boxes according to the occlusion boundary. Each sub-candidate box corresponds to the non-occluded area. The features of the sub-candidate boxes are extracted and matched with the standard target features. The similarity of each sub-candidate box is calculated, and the average similarity is taken as the final similarity. The matching result with the highest similarity is retained. 7.2. Remove false matching results. The criteria for judging false matching results are: the final similarity is less than 0.5 and the shape similarity between the candidate box and the standard target is less than 0.6. If there is a false matching result, the result is removed and the second highest similarity matching result is selected from the preliminary matching results. 7.3 Output the best matching result, including the target category, the standard feature template number of the match, the final similarity, the candidate box coordinates and occlusion information.
[0028] Step 8: Iterative Model Update 8.1 Collect the optimal matching results output in step seven, along with the corresponding images to be identified, target comprehensive features, occlusion prediction results, occlusion segmentation masks, repair features, and other data, to construct an iterative training dataset; 8.2 The construction standard for the iterative training dataset is as follows: the number of samples for each category is no less than 1,000, the proportion of occluded samples is no less than 40%, and it covers three types: partial occlusion, severe occlusion, and overlapping occlusion, to ensure the diversity and representativeness of the dataset; 8.3. The parameters of the multi-scale feature extraction network, occlusion segmentation network, and feature repair network were iteratively optimized using an iterative training dataset. The optimization process is as follows: A stochastic gradient descent (SGD) optimizer was used, with a learning rate of 0.001, momentum of 0.9, weight decay of 0.0001, and 100 iterations. Validation was performed every 20 iterations. The validation set used an independent occlusion scene dataset, and the validation metrics included recognition accuracy, matching accuracy, and feature repair similarity. The validation set consisted of 500 images, covering partial occlusion (200 images, 40%), severe occlusion (200 images, 40%), and overlapping occlusion (100 images, 20%). All images were brand new samples that had not participated in the initial training of the model, ensuring the objectivity of the validation results. 8.4 When the recognition accuracy and matching accuracy of the validation set are both improved by ≥2%, and the feature repair similarity is improved by ≥5%, save the current model parameters as the optimized model; if the improvement standard is not met, adjust the learning rate (decay by 10% per round) and continue iterative training until the improvement standard is met. 8.5 Output the optimized model parameters for subsequent real-time identification and matching deployment.
[0029] Step Nine: Real-time Identification and Matching Deployment 9.1 The optimized model from step eight is lightweighted by combining pruning and quantization to reduce model storage and computation, and improve real-time performance: pruning adopts a structured pruning strategy, removing redundant convolutional and fully connected layers from the network, with a pruning rate of 30% to ensure that model performance does not degrade; quantization uses INT8 quantization, converting model parameters from 32-bit floating-point quantization to 8-bit integers, further reducing model storage and computation latency. 9.2 Deploy the lightweight model to the target recognition terminal, which includes embedded devices, servers, mobile terminals, etc. The deployment method uses TensorRT acceleration to improve the inference speed of the model. 9.3 The target recognition terminal acquires the image to be recognized in real time and completes the image preprocessing, occlusion prediction, multi-scale feature extraction, occlusion segmentation and feature repair, hierarchical feature fusion, initial target recognition and candidate box screening, feature matching and similarity calculation, and matching result optimization in sequence according to the process of steps one to seven, so as to realize real-time recognition and matching. 9.4 Ensure real-time recognition and matching performance indicators: frame rate not less than 30FPS, recognition latency not more than 30ms, to meet the real-time requirements of actual application scenarios; 9.5 Output real-time identification and matching results for subsequent terminal processing (such as alarm, display, storage, etc.).
[0030] Step 10: Output and Storage of Results 10.1. Format the optimal matching result from step seven or the real-time matching result from step nine. The output format includes: image acquisition time (accurate to milliseconds), target category, occlusion type, occlusion area ratio, matching similarity, candidate box coordinates (x1, y1, x2, y2), and matching status (success / failure). 10.2 Store relevant data, including the image to be identified, target comprehensive features, occlusion segmentation mask, repair features, matching results and occlusion-related information. Store log files in JSON format, and name the log files according to the collection time for easy subsequent query and traceability. 10.3. Build a query interface to support querying and matching logs by collection time, target category, occlusion type, etc., so that users can view and analyze historical data. 10.4 If the matching result fails (similarity below 0.5), an alarm will be triggered to remind the user to manually review the result and ensure the reliability of the identification and matching.
[0031] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0032] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. An AI image target recognition and feature matching method for occlusion-resistant scenarios, characterized in that, Includes the following steps: Step 1: Image preprocessing and occlusion prediction. Obtain the target image to be identified, perform standardization processing on the image, and analyze the grayscale distribution, edge density and pixel change characteristics of the image through the occlusion prediction module to determine whether the image has occlusion and the type and proportion of occlusion area. Step 2: Multi-scale anti-occlusion feature extraction. A multi-scale feature extraction network is constructed to extract features at different scales from the preprocessed image, obtaining shallow texture features, mid-level contour features, and deep semantic features respectively. The channel-space dual attention module is used to enhance the features of non-occluded areas and suppress interference from occluded areas. Step 3: Accurate segmentation and feature restoration of occluded regions. Based on the occlusion prediction results in Step 1, an improved U-Net segmentation network is used to accurately segment the occluded regions and obtain the location and shape information of the occluded regions. By combining the features of the non-occluded regions with the generative adversarial network, the features of the occluded regions are accurately restored to obtain a complete target feature map. Step 4: Layered feature fusion. The multi-scale features extracted in Step 2 are fused with the complete feature map repaired in Step 3 in a layered manner. Shallow features are fused by element-wise addition, mid-level features are fused by attention-weighted fusion, and deep features are fused by concatenation to obtain the fused comprehensive target features. Step 5: Initial target identification and candidate box selection. The fused target comprehensive features are input into the preset target identification head to perform initial target category identification and generate multiple target candidate boxes. Candidate boxes with confidence scores higher than the preset threshold are retained as target candidate regions through cross-union ratio threshold selection and confidence score ranking. Step 6: Feature matching and similarity calculation. Construct an anti-occlusion feature matching library, extract the comprehensive features of the target candidate regions after screening in Step 5, compare them with the standard target features in the feature matching library, and use an improved cosine similarity algorithm to calculate the similarity between the two to obtain preliminary matching results. Step 7: Matching result optimization. Based on the occlusion type and occlusion area ratio in Step 1, the preliminary matching results are weighted and optimized. For partially occluded targets, a non-occluded region feature weight enhancement strategy is adopted, and for severely occluded targets, a multi-feature dimension complementary verification strategy is adopted to eliminate false matching results and obtain the optimal matching result. Step 8: Model Iteration and Update. Collect the best matching results from Step 7 and the corresponding image data and feature data, construct an iterative training dataset, and iteratively optimize the parameters of the multi-scale feature extraction network, occlusion segmentation network, and feature repair network to improve the model's anti-occlusion recognition and matching performance. Step 9: Real-time recognition and matching deployment. The optimized model is lightweighted and deployed to the target recognition terminal. The image to be recognized is acquired, preprocessed, feature extracted, occlusion segmented and repaired, and feature matched in real time, and the real-time recognition and matching results are output. Step 10: Output and store the results. The optimal matching result from Step 7 or the real-time matching result from Step 9 is output in a formatted manner. At the same time, the image to be identified, target features, matching results and occlusion information are stored to form a complete recognition and matching log for subsequent query and traceability.
2. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The standardization process described in step one is as follows: the size of the target image to be identified is uniformly adjusted to 640×640 pixels, the image is normalized to the [0,1] interval, and Gaussian filtering algorithm is used to remove image noise. The kernel size of the Gaussian filter is set to 3×3 and the standard deviation is set to 0.
5. The occlusion prediction module includes a gray-level statistics unit, an edge detection unit, and an occlusion judgment unit. The gray-level statistics unit calculates the mean and variance of gray levels in each region of the image. The edge detection unit uses the Canny operator to extract the image edges and calculates the edge density. The occlusion judgment unit determines the occlusion type as partial occlusion, severe occlusion, or overlapping occlusion based on the gray-level variance mutation threshold and the edge density threshold. The occlusion area of partial occlusion is 10%-30%, the occlusion area of severe occlusion is 30%-70%, and the occlusion area of overlapping occlusion is ≥70%.
3. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The multi-scale feature extraction network described in step two is based on an improved ResNet50 network. Multi-scale convolutional modules are added to layers 2, 3, and 4 of the network. The multi-scale convolutional modules contain three types of convolutional kernels: 1×1, 3×3, and 5×5, corresponding to small, medium, and large scales, respectively. The convolutional stride is set to 1, and the padding is set to half the size of the corresponding convolutional kernel. The channel-spatial dual attention module includes a channel attention submodule and a spatial attention submodule. The channel attention submodule obtains channel feature weights through global average pooling and global max pooling, while the spatial attention submodule obtains spatial feature weights through channel concatenation and convolution operations. The weights of the two submodules are multiplied together and then element-wise multiplied with the original feature map to enhance the features of the non-occluded region.
4. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The improved U-Net segmentation network described in step three adds residual connections to the encoder and uses a combination of transposed convolution and skip connections in the decoder. Attention gating units are added to the skip connections to suppress interference information in occluded areas and improve segmentation accuracy. The generative adversarial network includes a generator and a discriminator. The generator adopts a U-Net++ structure, with inputs of non-occluded area features and occluded area location information, and outputs the repaired occluded area features. The discriminator adopts a convolutional neural network structure to judge the similarity between the repaired features and the real non-occluded features. The generator and discriminator achieve accurate feature repair through adversarial training.
5. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The specific process of layered feature fusion in step four is as follows: shallow texture features are fused element-wise with an added coefficient of 0.5; mid-level contour features are fused with attention weights, with the weights determined by the spatial weights output by the channel-space dual attention module; deep semantic features are fused in series, connecting the deep features with the repaired feature map along the channel dimension to obtain a target comprehensive feature with a dimension of 2048. After fusion, a BatchNorm layer is used for normalization to avoid feature redundancy.
6. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: In step five, the target recognition head adopts a dual-branch structure, which is used for target category recognition and candidate box regression respectively. The category recognition branch uses a fully connected layer to output the target category probability, and the candidate box regression branch outputs the coordinate offset of the candidate box. The intersection-union ratio threshold is set to 0.5, the confidence threshold is set to 0.7, and candidate boxes with confidence ≥ 0.7 and IoU ≤ 0.5 are selected as target candidate regions. If the number of candidate boxes is less than 3, the confidence threshold is reduced to 0.6 and re-selected.
7. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The anti-occlusion feature matching library mentioned in step six contains standard feature templates for various targets. Each standard feature template contains three levels of features: shallow, medium, and deep. The feature matching library supports dynamic updates. The improved cosine similarity algorithm introduces non-occluded region feature weights based on traditional cosine similarity. The calculation formula is as follows: Where Fi is the unoccluded feature of the candidate region, Gi is the unoccluded feature of the standard target, Fj is the restored feature of the candidate region, Gj is the feature of the corresponding region of the standard target, α is the weight of the unoccluded feature with a value of 0.7, β is the weight of the restored feature with a value of 0.3, and ||F|| and ||G|| are the magnitudes of the candidate region feature and the standard target feature, respectively.
8. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The specific process of optimizing the matching results in step seven is as follows: For partially occluded targets, the feature weight α of the non-occluded region is increased to 0.8, the feature weight β of the repair is reduced to 0.2, and the similarity is recalculated; for severely occluded targets, two complementary dimensions, shape features and texture features, are added, and the average of the multi-dimensional similarity is calculated as the final similarity. For overlapping occluded targets, a candidate box splitting strategy is adopted, which splits the overlapping regions and performs feature matching separately, and then merges the matching results; the criteria for judging false matching results are that the similarity is less than 0.5 and the shape similarity between the candidate box and the standard target is less than 0.
6.
9. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The construction criteria for the iterative training dataset mentioned in step eight are as follows: the number of samples for each category is no less than 1000, the proportion of occluded samples is no less than 40%, and it covers three types: partial occlusion, severe occlusion, and overlapping occlusion; the iterative optimization adopts the stochastic gradient descent optimizer, with the learning rate set to 0.001, momentum set to 0.9, weight decay set to 0.0001, the number of iterations set to 100 rounds, and validation is performed every 20 rounds. When the accuracy of the validation set improves by ≥2%, the current model parameters are saved.
10. The AI image target recognition and feature matching method in anti-occlusion scenarios according to claim 1, characterized in that: The lightweight model processing described in step nine employs a combination of pruning and quantization. Pruning utilizes a structured pruning strategy, removing redundant convolutional and fully connected layers from the network, with a pruning rate set to 30%. Quantization uses INT8 quantization, converting model parameters from 32-bit floating-point quantization to 8-bit integers, reducing model storage and computational load. The real-time recognition and matching frame rate is no less than 30 FPS, and the recognition latency is no more than 30 ms. The recognition and matching log described in step ten includes image acquisition time, target category, occlusion type, occlusion area percentage, matching similarity, and matching results, stored in JSON format, and supports querying by time and target category.