An image re-identification method based on improved ResNet-50
Patent Information
- Application Number
- CN202610897471.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-06-22
AI Technical Summary
[0008]本发明旨在解决现有目标重识别方法在复杂环境下适应性差、细粒度识别能力不足、泛化性有限等问题,提供一种基于改进ResNet-50的复杂环境目标重识别方法
[0016] (1) Comprehensive improvement in adaptability to complex environments: The multi-level feature enhancement module adopts a diagnostic-driven cascaded dense design, which can adaptively match compensation strategies for the degradation characteristics of complex environments such as fog, rain, snow, and low light. Compared with existing single enhancement methods, it is more targeted in dealing with multiple degradation scenarios and effectively solves the problem of feature extraction distortion in complex environments.
Smart Images

Figure CN122416382B_ABST
Abstract
Description
Technical Field
[0001] This invention pertains to image recognition technology, specifically to an image re-recognition method based on an improved ResNet-50. Background Technology
[0002] With the rapid development of intelligent surveillance and urban management, target re-identification technology has been widely applied in public safety, traffic management, smart cities, and security monitoring. This technology aims to accurately match the identity of the same target captured in different scenarios across time, perspectives, and environments, overcoming the limitations of traditional identification systems such as the target having its recognition device turned off or lacking visual feature details. Furthermore, target re-identification technology is combined with low-altitude communication and sensing networks based on devices such as drones and unmanned vehicles. Using drones and unmanned vehicles equipped with surveillance cameras, it enables automatic target re-identification within a certain area, such as re-identifying different targets in different scenarios including pedestrians on roads, ground traffic, ships in ports, and flying objects.
[0003] Deep learning-based visual re-identification methods have become the mainstream solution, but this technology still faces multiple challenges under complex environmental conditions. On the one hand, severe weather causes multiple degradation effects such as image contrast attenuation, detail blurring, color distortion, and noise interference. These degradations overlap, severely damaging the effective features of the target and leading to distorted feature extraction by existing models. On the other hand, similar targets, such as ships and vehicles, often have highly similar appearances, while the same target exhibits significant morphological differences under different states. Existing models struggle to accurately model both global structure and local details. Furthermore, during training, models tend to bind environmental cues to target identity features, resulting in a significant drop in recognition accuracy in unfamiliar environments and limited generalization ability. Deep networks carry shallow details and deep semantic information at different levels, respectively. Existing methods use fixed-weight fusion, which cannot dynamically adjust the contribution of each level of features based on the target scale and environmental conditions of the input image, easily leading to information redundancy or loss of key features.
[0004] Currently, deep learning-based target re-identification methods are mainly divided into two categories:
[0005] (1) General scene optimization methods. These methods improve recognition accuracy by fusing global and local features and enhancing attention mechanisms, but they do not design a special compensation mechanism for image degradation caused by severe weather or complex environments, and their robustness in complex environments is insufficient.
[0006] (2) Single environment adaptation method. This type of method only designs a joint model for defogging and re-identification for specific environments (such as foggy days), and cannot adapt to various complex environments such as rainy days, low light, and nighttime. In addition, it lacks the decoupling design of features and environment, and has limited generalization ability.
[0007] Therefore, improving the model's adaptability to complex environments and fine-grained recognition capabilities by designing cascaded feature enhancement, multi-granularity feature learning, and environment decoupling mechanisms has become the core development direction of current target re-identification technology. Summary of the Invention
[0008] This invention aims to address the problems of poor adaptability, insufficient fine-grained recognition ability, and limited generalization of existing target re-identification methods in complex environments, and provides a target re-identification method for complex environments based on an improved ResNet-50. Specific objectives include: (1) achieving adaptive compensation for multiple image degradations caused by various complex environments such as fog, rain, snow, and low light; (2) improving the model's ability to capture fine-grained features of targets, solving the recognition problem of small inter-class differences and large intra-class differences; (3) achieving effective decoupling of target identity features and environmental information, improving the model's generalization ability in unseen environmental scenarios; and (4) comprehensively improving the accuracy and robustness of target re-identification in complex environments while ensuring the model's lightweight and real-time performance.
[0009] To address the aforementioned issues, this invention proposes a target re-identification method for complex environments based on an improved ResNet-50. Through a comprehensive optimization process involving cascaded feature enhancement, multi-granularity feature learning, and adversarial learning, high-precision target re-identification in complex environments is achieved. The specific process is as follows:
[0010] S1: Obtain the target re-identification dataset and perform basic preprocessing on all weather scene image samples;
[0011] S2: During the data loading stage, image weather features are extracted from the target re-identification dataset to form a 4-dimensional weather feature vector based on ambiguity, contrast, brightness, and noise variance; pseudo-weather labels are automatically generated through clustering algorithms to construct a target re-identification training set with unified weather labels;
[0012] S3: Construct an improved ResNet-50 target re-identification model. Based on the ResNet-50 architecture, embed multi-level feature enhancement modules and multi-granularity feature learning modules into key nodes of the backbone network, and add an environment adversarial learning branch. The multi-level feature enhancement module includes a degradation analyzer and four cascaded contrast units, detail units, color units, and denoising units, used to repair the structural information of low-level visual attributes and enhance high-level semantic features for mid-level semantic features. The multi-granularity feature learning module includes a cross-layer adaptive fusion mechanism, an EMA attention mechanism, and a weather adversarial learning branch, used to receive channel feature maps and then process them to output refined features.
[0013] S4: Input the training set with environmental labels into the model, and perform end-to-end training using a joint loss function that combines identity classification loss, triplet loss and weather adversarial loss to optimize the model parameters and obtain the target re-identification model.
[0014] S5: Obtain the target image to be re-identified, input it into the trained model after basic preprocessing, extract L2 normalized features and calculate the cosine similarity with the features of the image library, and obtain the target re-identification result according to the similarity ranking.
[0015] Compared with existing technologies, the beneficial effects achieved by this invention are as follows:
[0016] (1) Comprehensive improvement in adaptability to complex environments: The multi-level feature enhancement module adopts a diagnostic-driven cascaded dense design, which can adaptively match compensation strategies for the degradation characteristics of complex environments such as fog, rain, snow, and low light. Compared with existing single enhancement methods, it is more targeted in dealing with multiple degradation scenarios and effectively solves the problem of feature extraction distortion in complex environments.
[0017] (2) The fine-grained recognition accuracy is significantly improved: the multi-granularity feature learning module integrates cross-layer adaptive fusion and EMA attention mechanism, dynamically aggregates shallow details and deep semantic features, accurately captures the local fine-grained features of the target, and greatly improves the ability to distinguish similar targets;
[0018] (3) The generalization ability of the model is greatly enhanced: the environment adversarial learning mechanism achieves deep decoupling between identity features and environmental information through the gradient inversion layer, avoids the model learning environment-dependent features, and enables the model to maintain high recognition accuracy in complex environmental scenarios that have not been seen before, thus significantly improving scene adaptability.
[0019] (4) Lightweight and real-time balance optimization: The improved ResNet-50 is used as the backbone network, and a dedicated optimization module is embedded only at key nodes. The adversarial branch of the environment is removed during the inference stage. While ensuring the recognition accuracy, the number of model parameters and computational complexity are effectively controlled, which can meet the real-time deployment needs of intelligent security, traffic monitoring, maritime supervision and other scenarios.
[0020] (5) Wide range of application scenarios and strong practicality: It can be directly applied to actual business such as public safety, smart city, traffic management, maritime supervision, port intelligent management, pedestrian tracking, and vehicle retrieval. It is compatible with various scenarios such as cities, ports, roads, and parks, providing reliable technical support for intelligent visual management in all weather and all scenarios. Attached Figure Description
[0021] Figure 1 This is a flowchart of the ResNet-50-based image re-identification method in a specific embodiment of the present invention.
[0022] Figure 2 This is an overall framework diagram of the improved ResNet-50 model in a specific embodiment of the present invention.
[0023] Figure 3 This is a schematic diagram of the structure of the multi-level feature enhancement module in a specific embodiment of the present invention.
[0024] Figure 4 This is a schematic diagram of the structure of the multi-granularity feature learning module in a specific embodiment of the present invention. Detailed Implementation
[0025] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings.
[0026] This invention provides an image re-identification method based on an improved ResNet-50 to achieve better adaptability to adverse weather conditions and fine-grained recognition performance, enabling it to perform well in complex scenarios such as fog, rain, and low light.
[0027] Example 1: Ship Re-identification.
[0028] To enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings. An embodiment using ships as identification targets in complex and adverse weather conditions is given, and the specific steps of its image re-identification method are as follows.
[0029] S1: Dataset acquisition and preprocessing.
[0030] S11: The publicly available ship re-identification dataset is used, covering various severe weather scenarios such as fog, rain, and low light, as well as samples with different perspectives and scales. All images are free of manually labeled weather tags.
[0031] S12: Perform basic preprocessing on all images: normalize the image size to 256×256 pixels and standardize the pixel values to the [0,1] range. During the training phase, data augmentation strategies are used to improve the robustness of the model, including random flipping (horizontal flip probability 0.5), random cropping (cropped size 224×224), and color dithering (brightness ±0.2, contrast ±0.2). During the inference phase (and step S5), only size normalization and pixel value standardization are performed.
[0032] S2: Generating pseudo-weather labels.
[0033] S21: During the data loading phase, weather features are extracted from all images in the dataset to form a 4-dimensional weather feature vector.
[0034] Blur: The gradient value of the image edge is calculated based on the Laplacian operator. The smaller the gradient value, the more blurred the image.
[0035] Contrast: Calculate the variance of the image's grayscale histogram. The larger the variance, the higher the image contrast.
[0036] Brightness: Calculates the average gray level of the image, reflecting the overall brightness of the image.
[0037] Noise variance: Apply a 5×5 Gaussian filter to the image and calculate the variance of the difference between the pixel values before and after the filter. The larger the variance, the more severe the noise interference.
[0038] Simultaneously, standard feature templates for four weather scenarios are predefined offline for subsequent cluster-weather mapping in S23. Specifically, 100 standard reference images for each of the four typical weather scenarios—foggy, rainy, low light, and sunny—are pre-collected. Each image possesses typical and singular weather features to avoid mixed and degraded scenarios. A 4-dimensional weather feature vector is extracted from each reference image using the method described above. The mean of all sample feature vectors for each weather scenario is calculated to obtain the standard feature template vectors for the four weather scenarios.
[0039] Foggy day template:
[0040]
[0041] Rainy day template:
[0042]
[0043] Low-light template:
[0044]
[0045] Sunny Day Template:
[0046]
[0047] in, Indicates the mean, in the subscript , , , These represent four weather scenarios: foggy, rainy, low light, and sunny. , , , These represent the four weather feature dimensions defined in S21: ambiguity, contrast, brightness, and noise variance, respectively. This represents the mean blur level in a foggy scene.
[0048] Once the standard feature template is predefined, a unified template will be used for cluster-weather mapping on all target datasets to ensure consistency in label generation.
[0049] S22: K-means clustering algorithm is used to cluster the weather feature vectors of all images, with a cluster number K=4 (corresponding to four weather scenarios: foggy, rainy, low light, and sunny). The optimal cluster number K is determined using the elbow rule: K-means clustering is performed within the range of K=2 to 8, and the sum of squared distances (SSE) from the sample to the cluster center is calculated for each K value. The K value corresponding to the "elbow" position where the SSE decreases significantly is selected as the optimal cluster number, and K=4 is determined. The clustering process is set to iterate 100 times, and the distance threshold is 1e-4.
[0050] S23: Assign pseudo-weather labels to each image based on the clustering results. Since the cluster numbers (C0~C3) output by K-means clustering do not have semantic information, it is necessary to establish a mapping relationship between clusters and four weather categories (foggy, rainy, low light, and sunny): calculate the cluster center of each cluster (the mean of the weather feature vectors of the samples within the cluster), perform cosine similarity matching with the predefined standard feature templates of the four weather categories, and supplement this with manual sampling and verification to assign a corresponding weather label to each cluster. Based on the mapping relationship, convert the cluster numbers into weather category labels, and finally construct a ship re-identification training set with unified weather labels.
[0051] S3: Improved ResNet-50 model construction.
[0052] S31: Backbone Network Construction: Based on the ResNet-50 model pre-trained on ImageNet, retaining its basic network structure of Conv1_x, Conv2_x, Conv3_x, Conv4_x, and Conv5_x. Conv1_x includes 7×7 convolutional layers (stride 2), batch normalization layers, ReLU activation functions, and max pooling layers (stride 2). Conv2_x to Conv5_x correspond to the four residual stages of ResNet-50 (each stage contains multiple Bottleneck modules). Initially, the convolutional parameters of Conv1_x and Conv2_x are frozen, and only the parameters of Conv3_x, Conv4_x, Conv5x, and the newly added modules are trained. During the middle of training (after 20 rounds), all parameters are unfrozen for joint fine-tuning.
[0053] S32: Design and Deployment of Multi-Level Feature Enhancement Modules
[0054] Deployment location: After embedding ResNet-50's Conv3_x and Conv4_x respectively, the multi-level feature enhancement module deployed after Conv3_x repairs the low-level visual attributes (such as edges and textures) for mid-level semantic features, and the multi-level feature enhancement module deployed after Conv4_x strengthens the structural information of high-level semantic features (such as hull outline and component layout).
[0055] Module structure: such as Figure 3 As shown, the core consists of a routing mechanism and four cascaded enhancement units:
[0056] Routing mechanism: The input feature map is sequentially processed by global average pooling (AdapAvg Pool) to aggregate spatial information, flattened into a one-dimensional vector, dimensionality reduction by a first fully connected layer (Linear, output dimension 256), nonlinearity introduced by ReLU activation, mapped to four-dimensional space by a second fully connected layer (Linear, output dimension 4), and Sigmoid activation constrains the output to the (0,1) interval, generating a four-dimensional adaptive weight vector. These correspond to the degradation intensities of contrast reduction, detail blurring, color distortion, and noise interference, respectively.
[0057] Each multi-level feature enhancement module's routing mechanism includes the aforementioned two fully connected layers, with the hidden layer dimension of both fully connected layers uniformly set to 256. The input dimension of the first fully connected layer depends on the module's deployment location: when deployed after Conv3_x, the input dimension is 512 (corresponding to the number of output feature channels of Conv3_x); when deployed after Conv4_x, the input dimension is 1024 (corresponding to the number of output feature channels of Conv4_x).
[0058] Control unit: Employs a 1×1 convolution (number of channels matching the input features) and a sigmoid activation function. The input is the original features, and the values are adjusted according to weights. Dynamically adjust feature contrast gain to enhance the distinction between ships and the background.
[0059] The detail unit employs a 3×3 dilated convolution (dilation = 2) and a ReLU activation function. The input is the sum of the original features and the output features of the control unit, weighted according to... Adjusting details to enhance strength, with a focus on repairing fine-grained details such as ship edges and hull numbers.
[0060] Color unit: Employs a 1×1 convolution and Tanh activation function. The input is the sum of the original features and the output features of the two preceding enhancement units, weighted according to... Corrects color shifts caused by severe weather.
[0061] Denoising unit: Employs a 3×3 depthwise separable convolution and BN layer. The input is the sum of the original features and the output features of the preceding three enhancement units. The noise reduction is determined according to the weights. Suppress image noise.
[0062] Fusion method: The four enhancement units output contrast enhancement features, detail enhancement features, color correction features and noise suppression features respectively. These four output features are concatenated in the channel dimension (the number of channels becomes 4 times the number of input channels), compressed back to the original number of channels through 1×1 convolution, and then residually connected with the original input features to balance the original semantic information and the repair incremental features, avoiding information distortion caused by over-enhancement.
[0063] S33: Design and Deployment of Multi-Granularity Feature Learning Module:
[0064] Module structure: such as Figure 4 As shown, it consists of a cross-layer adaptive fusion mechanism, an EMA attention mechanism, and a weather adversarial learning branch. It receives the 2048-channel feature map output by ResNet-50 Conv4_x and outputs 256-channel refined features.
[0065] Cross-layer adaptive fusion mechanism:
[0066] like Figure 4 As shown, the specific process of the cross-layer adaptive fusion mechanism is as follows: Extract the output features of the four stages of ResNet-50, namely the output features of Conv2_x, the first multi-level feature enhancement module, the second multi-level feature enhancement module, and Conv5_x; Compress the feature maps of each stage into global average pooling (GAP) to global descriptors, and then uniformly map them to 256 dimensions through the adjustment unit. The structure of the adjustment unit is as follows: The first segment uses a 1×1 ordinary convolution (stride of 1) to uniformly map the number of input feature channels to 256, followed by a batch normalization layer and a ReLU activation function; The second segment uses a 3×3 grouped convolution (stride of 1), with the number of groups set to the number of input channels divided by 32, and the number of output channels remaining unchanged at 256, and also followed by a batch normalization layer and a ReLU activation function. All adjustment units in all stages adopt a uniform structure, with 256 output channels each. After the above processing, four 256-dimensional global descriptors are obtained from the four stages. These are concatenated into a 1024-dimensional vector, which is then flattened by a Flatten layer, activated by ReLU in the first fully connected layer, dropped out in a Dropout layer (with a dropout probability of 0.5), and activated by Sigmoid in the second fully connected layer to generate a four-dimensional weight vector. ; Combine the feature maps of the original four stages with their corresponding weights Element-wise multiplication yields weighted feature maps (denoted as P1, P2, P3, and P4, respectively). Then, bilinear interpolation is used to align all weighted feature maps to the spatial resolution of P2 (64×64). Finally, pixel-wise addition yields a fused feature map, which is then output to the subsequent EMA attention mechanism.
[0067] EMA attention mechanism: The 256-channel feature map after cross-layer fusion is divided into 8 groups (32 channels per group) on average according to the channel dimension. Each group of features is processed through three parallel paths:
[0068] Horizontal pooling path: The feature map is subjected to horizontal adaptive average pooling to obtain 1×W×32 features, which are then converted into H×W×1 attention weights by an MLP network (input dimension W, output dimension H×W).
[0069] Vertical pooling path: The feature map is subjected to vertical adaptive average pooling to obtain H×1×32 features, which are then converted into H×W×1 attention weights by an MLP network (input dimension H, output dimension H×W).
[0070] Local convolution path: 3×3 convolution is used to extract local detail features, which are then activated by Sigmoid to generate H×W×1 attention weights.
[0071] The attention weights of the three paths are normalized by Softmax and then weighted and fused. They are then multiplied element-wise with the original grouped features. Finally, the eight groups of features are concatenated to obtain 256 channels of enhanced features, achieving collaborative modeling of global structure and local details.
[0072] The weather adversarial learning branch connects the fused output features through a gradient inversion layer (GRL, gradient inversion coefficient α=0.1). The gradient inversion layer preserves the features during forward propagation and inverts the gradients during backpropagation before feeding them back to the backbone network. The weather classifier consists of two fully connected layers (256 hidden dimensions) and a Softmax activation function. It receives the gradient-inverted features (compressed into a 256-dimensional vector by global average pooling) and outputs the predicted probabilities of four weather types, used to calculate the weather adversarial loss.
[0073] S34: As Figure 2 As shown, head re-identification follows the EMA attention mechanism. The specific process is as follows: the feature map output by the EMA attention mechanism is sequentially compressed into a feature vector by global average pooling (GAP), normalized by a batch normalization layer (BN) (freezing bias parameters), and output as an identity classification result by a fully connected layer (FC). The output features are used to calculate both the triplet loss and the identity classification loss (ID loss), where the output dimension of the fully connected layer corresponds to the number of target categories in the dataset. After L2 normalization, the output features are used for identity classification and similarity calculation, respectively.
[0074] S4: Model training.
[0075] S41: Training parameter settings: batch size is 32, number of training epochs is 100, initial learning rate is 0.001, and cosine annealing learning rate scheduling strategy is used. The optimizer is AdamW, the weight decay coefficient is 0.0001, and the gradient clipping threshold is 1.0 to avoid gradient explosion.
[0076] S42: Joint Loss Function: The total loss during model training The weighted sum of identity classification loss, triplet loss, and weather countermeasure loss is calculated using the following formula:
[0077]
[0078] Identity classification loss ( The cross-entropy loss function is used to constrain the model to learn the discriminative features of ship identity. The calculation formula is as follows:
[0079]
[0080] in For the real identity label of the sample, The probability of identity predicted by the model.
[0081] Triple loss ( The triplet loss employs a hard sample mining strategy, with a preset threshold margin=0.3, and is calculated using the following formula:
[0082]
[0083] in The characteristic distance between samples of the same ship. To improve the discriminative power of features by constraining the intra-class distance to be less than the inter-class distance, we can define the feature distance between different ship samples.
[0084] Weather-related losses ( The cross-entropy loss function is used to measure the prediction error of the weather classifier. The calculation formula is as follows:
[0085]
[0086] in Let cross-entropy be the loss function. For weather classifiers, It is a gradient inversion layer. Global features extracted by the model The sample is a pseudo-weather label, and this loss is used to drive the backbone network to learn weather-independent identity features.
[0087] S43: Training Process: An end-to-end training approach was adopted. For the first 20 epochs, the Conv2_x and Conv3_x parameters of ResNet-50 were frozen, and only the multi-level feature enhancement module, multi-granularity feature learning module, and head re-identification module were trained. After the 20th epoch, all parameters were unfrozen, and training continued until the 100th epoch. An early stopping strategy was employed during training: if the Top-1 accuracy on the validation set did not improve for 10 consecutive epochs, training was stopped, and the optimal model parameters were saved.
[0088] S5: Re-identification reasoning.
[0089] S51: Image Library Construction: A batch of images of known ship identities is acquired using the surveillance cameras of low-altitude drones. This image library is independent of the training set and does not participate in model training. Each image in the library is processed sequentially as follows:
[0090] First, basic preprocessing is performed according to the method in S12, including size normalization (256×256 pixels) and pixel value standardization (normalized to the [0,1] interval). Second, the preprocessed image is input into the trained model. During the inference phase, the weather adversarial learning branch is removed. After processing by the ResNet-50 backbone network, a two-level multi-level feature enhancement module, a multi-granularity feature learning module, and a re-identification head, a 256-dimensional L2 normalized feature vector is output (the specific feature extraction process is the same as in S53). Finally, the feature vector of each image in the image library is stored together with the corresponding ship identity label to form the image library. The image library remains unchanged during the inference phase and is used for similarity matching with the image to be identified.
[0091] S52: Image processing to be identified: The ship images to be re-identified are preprocessed by size normalization (256×256 pixels) and pixel value standardization (normalized to [0,1]), and the processing method is the same as that of the training set.
[0092] S53: Feature Extraction: The preprocessed image is input into the trained model. During the inference phase, the weather adversarial learning branch is removed. After processing by the ResNet-50 backbone network, a two-level multi-level feature enhancement module, a multi-granularity feature learning module, and the re-identification head, a 256-dimensional L2 normalized feature vector is output, denoted as the image feature to be identified. .
[0093] S54: Similarity Calculation: Calculate the feature vector of the image to be identified. The cosine similarity between the image and the feature vectors of all ships in the image library is calculated using the following formula:
[0094]
[0095] in, The feature vector extracted from the image to be identified in step S53, The ship image feature vectors stored in the image library according to step S51 Represents the vector dot product. The L2 norm of a vector is represented.
[0096] S55: Output Results: Based on the similarity calculation results, sort from high to low, and output the ship re-identification results in Rank-1 (the result with the highest similarity) and Rank-5 (the top 5 results with the highest similarity). Rank-1 is used to evaluate the accuracy of a single match, and Rank-5 is used to evaluate the recall rate (whether the real identity appears in the top 5 results), thus completing cross-scenario ship identity matching.
[0097] To verify the effectiveness of the re-identification method proposed in this embodiment, a comparative experiment was conducted on the publicly available ship re-identification dataset Warships-ReID. The method is compared with the following existing methods:
[0098] ResNet-50 60.91 85.71 48.22 Method of the present invention 81.65 94.28 78.53
[0099] Results analysis: The method of the present invention significantly improves Rank-1 accuracy and mAP compared with the baseline in adverse weather conditions such as fog, rain, and low light, verifying the superiority of the present invention under adverse weather conditions.
[0100] Example 2: Vehicle re-identification on ground roads.
[0101] Similar to ship re-identification, this method can be applied to vehicle re-identification on roads under adverse weather conditions. The process is basically the same, the only difference being that vehicle image data is used instead of ship image data for data preprocessing and model training. The overall process is as follows:
[0102] S1: Obtain vehicle target re-identification datasets through devices equipped with surveillance cameras, such as drones or unmanned vehicles, or use publicly available vehicle re-identification datasets, which include vehicle images under various adverse weather conditions. Perform basic preprocessing on all weather scene image samples, including normalization, pixel value standardization, and random image flipping, cropping, and color modification.
[0103] S2: During the data loading stage, image weather features are extracted from the vehicle target re-identification dataset to form a 4-dimensional weather feature vector based on ambiguity, contrast, brightness, and noise variance; pseudo-weather labels are automatically generated through clustering algorithms to construct a vehicle target re-identification training set with unified weather labels.
[0104] S3: Construct an improved ResNet-50 target re-identification model. Based on the ResNet-50 architecture, embed multi-level feature enhancement modules and multi-granularity feature learning modules into key nodes of the backbone network, and add an environment adversarial learning branch. The multi-level feature enhancement module includes a degradation analyzer and four cascaded contrast units, detail units, color units, and denoising units, which are used to repair the structural information of low-level visual attributes and enhance high-level semantic features for mid-level semantic features. The multi-granularity feature learning module includes a cross-layer adaptive fusion mechanism, an EMA attention mechanism, and a weather adversarial learning branch, which are used to receive channel feature maps and then process them to output refined features.
[0105] S4: Input the training set with environmental labels into the model, and perform end-to-end training using a joint loss function that combines identity classification loss, triplet loss and weather adversarial loss to optimize the model parameters and obtain the vehicle target re-identification model.
[0106] S5: Obtain the vehicle target image to be re-identified, input it into the trained vehicle target re-identification model after basic preprocessing, extract L2 normalized features and calculate the cosine similarity with the features of the image library, and obtain the vehicle target re-identification result according to the similarity ranking.
[0107] Using the above method, the re-identification results of vehicle targets can be obtained, and further analysis and processing of information such as vehicle speed and driving conditions can be performed. Furthermore, since the proposed target re-identification model supports simultaneous processing of multiple input targets, target re-identification of multiple vehicles can be performed. This also enables analysis of traffic conditions within a certain range, determining whether there is congestion, traffic violations, vehicle speed, lane usage, and other traffic conditions based on the vehicle re-identification results.
[0108] To further verify the effectiveness of the re-identification method proposed in this embodiment, a comparative experiment was conducted on the publicly available vehicle re-identification dataset VeRi-776. The method is compared with the following existing methods:
[0109] ResNet-50 65.8 86.2 56.1 Method of the present invention 85.6 96.3 80.8
[0110] Results Analysis: Experimental results on the VeRi-776 general dataset demonstrate that the proposed method maintains stable recognition performance under different imaging conditions, with significant improvements in Rank-1 accuracy and mAP compared to the baseline. This result verifies that the proposed method also possesses good generalization ability and transferability in general vehicle re-identification tasks.
[0111] The above description is only a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. Any equivalent modifications or changes made by those skilled in the art based on the content disclosed in the present invention should be included within the scope of protection set forth in the claims.
Claims
1. An image re-identification method based on an improved ResNet-50, characterized in that: The method includes the following steps: S1: Obtain the target re-identification dataset and perform basic preprocessing on all weather scene image samples; S2: During the data loading stage, image weather features are extracted from the target re-identification dataset to form a 4-dimensional weather feature vector based on ambiguity, contrast, brightness, and noise variance; pseudo-weather labels are automatically generated through clustering algorithms to construct a target re-identification training set with unified weather labels; S3: Construct an improved ResNet-50 target re-identification model. Based on the ResNet-50 architecture, embed multi-level feature enhancement modules and multi-granularity feature learning modules into key nodes of the backbone network, and add an environment adversarial learning branch. The multi-level feature enhancement module includes a degradation analyzer and four cascaded contrast units, detail units, color units, and denoising units, which are used to repair the underlying visual attributes and enhance the structural information of high-level semantic features for mid-level semantic features; the multi-granularity feature learning module includes a cross-layer adaptive fusion mechanism, an EMA attention mechanism, and a weather adversarial learning branch, which are used to receive channel feature maps and then process them to output refined features. The multi-granularity feature learning module integrates a cross-layer adaptive fusion mechanism, an efficient multi-scale attention mechanism of EMA, and an environment adversarial learning branch; the cross-layer adaptive fusion mechanism dynamically integrates the multi-scale features of the four stages of ResNet and allocates the feature contribution of each layer according to the characteristics of the input image. The EMA attention mechanism captures both the global structure and fine-grained local features of a target through parallel grouping. The environmental adversarial learning branch decouples identity features from weather information through a gradient inversion layer (GRL). The weather adversarial learning branch connects the fused output features through a gradient inversion layer. The gradient inversion layer keeps the features unchanged during forward propagation and inverts the gradients during backpropagation before feeding them back to the backbone network. The weather classifier consists of two fully connected layers and a Softmax activation function. It receives the gradient-inverted features and outputs the predicted probabilities of four weather types, which are used to calculate the weather adversarial loss. S4: Input the training set with environmental labels into the model, and perform end-to-end training using a joint loss function that combines identity classification loss, triplet loss and weather adversarial loss to optimize the model parameters and obtain the target re-identification model. S5: Obtain the target image to be re-identified, input it into the trained model after basic preprocessing, extract L2 normalized features and calculate the cosine similarity with the features of the image library, and obtain the target re-identification result according to the similarity ranking.
2. The image re-identification method based on improved ResNet-50 according to claim 1, characterized in that: Step S1 includes the following sub-steps: S11: It adopts a public re-identification dataset, covering a variety of severe weather scenarios and samples with different perspectives and scales. All images have no manually labeled weather tags. S12: Normalize the size and pixel values of all images; employ data augmentation strategies, including random flipping, random cropping, and color dithering.
3. The image re-identification method based on improved ResNet-50 according to claim 1, characterized in that: Step S2 includes the following sub-steps: S21: Extract weather features from all images in the dataset to form a 4-dimensional weather feature vector, including blur, contrast, brightness, and noise variance; S22: The K-means clustering algorithm is used to cluster the weather feature vectors of all images. The number of clusters K=4, corresponding to four weather scenarios: foggy, rainy, low light, and sunny. The optimal clustering parameters are determined by the elbow rule. S23: Assign a corresponding pseudo-weather label to each image based on the clustering results, and finally construct a ship re-identification training set with unified weather labels.
4. The image re-identification method based on improved ResNet-50 according to claim 1, characterized in that: Step S3 includes the following sub-steps: S31: Backbone network optimization: Based on the ResNet-50 network, retain its basic structure of Conv2_x-Conv5_x, embed multi-level feature enhancement modules after Conv3_x and Conv4_x respectively, and embed multi-granularity feature learning modules after Conv5_x; S32: Multi-level Feature Enhancement Module Design and Deployment: Adopting a diagnostic-driven cascaded dense architecture, the core consists of a degradation analyzer, a control unit, a detail unit, a color unit, and a denoising unit. The degradation analyzer generates a four-dimensional adaptive weight vector through global average pooling and a two-layer MLP network, accurately quantifying the degradation intensity of contrast attenuation, detail blurring, color distortion, and noise interference. The four enhancement units adopt a strategy combining cascaded and dense connections. Each unit receives the original input and the output features of all preceding units, dynamically adjusts the enhancement gain according to the corresponding degradation weight, and finally outputs the enhanced features after residual fusion, realizing progressive compensation for multiple degradations. S33: Design and Deployment of Multi-Granularity Feature Learning Module: Integrating cross-layer adaptive fusion mechanism, EMA efficient multi-scale attention mechanism and environment adversarial learning branch; the cross-layer adaptive fusion mechanism dynamically integrates multi-scale features of the four stages of ResNet and allocates the feature contribution of each layer according to the characteristics of the input image; The EMA attention mechanism captures both the global structure and fine-grained local features of a target through parallel grouping. The environmental adversarial learning branch decouples identity features from weather information through a gradient inversion layer (GRL). S34: Re-identification Header Design: Includes batch normalization layer and fully connected classifier. Batch normalization layer freezes bias parameters to improve feature stability. Fully connected classifier adapts to the number of target categories and outputs classification results. The output features are processed by L2 normalization and then used for similarity calculation. During the inference stage, the environment adversarial learning branch is removed, and only the core inference link of the backbone network, multi-level feature enhancement module and multi-granularity feature learning module is retained.
5. The image re-identification method based on an improved ResNet-50 according to claim 1, characterized in that: Step S4 includes the following sub-steps: S41: Training parameter settings: batch size is 32, number of training epochs is 100, initial learning rate is 0.001, and cosine annealing learning rate scheduling strategy is adopted. S42: Joint Loss Function: The total loss during model training The weighted sum of identity classification loss, triplet loss, and weather countermeasure loss is calculated using the following formula: Identity Classification Loss The cross-entropy loss function is used to constrain the model to learn discriminative features of ship identity. The calculation formula is as follows: in For the real identity label of the sample, The probability of identity predicted by the model; Triple loss The triplet loss using a hard sample mining strategy is calculated using the following formula: in The characteristic distance between the same ship samples. The feature distance between different ship samples is defined by a preset threshold margin. By constraining the intra-class distance to be less than the inter-class distance, the discriminative power of the features is improved. Weather-related losses The cross-entropy loss function is used to measure the prediction error of the weather classifier. The calculation formula is as follows: in Let cross-entropy be the loss function. For weather classifiers, It is a gradient inversion layer. Global features extracted by the model The pseudo-weather labels for the samples are used to drive the backbone network to learn weather-independent identity features. S43: Training process: An end-to-end training method is adopted. The Conv2_x and Conv3_x parameters of ResNet-50 are frozen for the first 20 rounds, and only the multi-level feature enhancement module, multi-granularity feature learning module and re-identification head are trained; after the 20th round, all parameters are unfrozen and training continues to the 100th round. An early stopping strategy is adopted during training. If the Rank-1 accuracy of the validation set does not improve for 10 consecutive rounds, training is stopped and the optimal model parameters are saved.
6. The image re-identification method based on improved ResNet-50 according to claim 1, characterized in that: Step S5 includes the following sub-steps: S51: Image processing to be identified: Preprocessing the ship image to be re-identified by size normalization and pixel value standardization; S52: Feature extraction: Input the preprocessed image into the trained model. Remove the weather adversarial learning branch during the inference stage. After the image is processed by the ResNet-50 backbone network, two-level multi-level feature enhancement module, multi-granularity feature learning module and re-identification head, the output is an L2 normalized feature vector. S53: Similarity Calculation: Calculate the cosine similarity between the feature vector of the image to be identified and the feature vectors of all ship images in the image library. The similarity calculation formula is: in, The feature vector of the image to be identified. The feature vector of the ship images in the image library. Represents the vector dot product. The L2 norm of a vector; S54: Output Results: Based on the similarity calculation results, sort from high to low and output the Top-1 and Top-5 ship re-identification results to complete cross-scenario ship identity matching.
Citation Information
Patent Citations
Big data processing method for intelligent operation and maintenance
CN112307284A
Unsupervised pedestrian re-identification method based on local enhancement converter and multi-granularity contrast learning
CN121982649A