Vehicle re-identification method and system based on multi-view and convolutional attention module

By introducing multi-view and convolutional attention modules into vehicle re-identification, and combining global and local feature representations, the identification problems caused by similar appearance and changes in viewing angles are solved, and accurate identification of vehicles with similar appearance and different viewing angles is achieved.

CN113591928BActive Publication Date: 2024-10-15WUHAN INST OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202110756083.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-05
Publication Date
2024-10-15
Estimated Expiration
2041-07-05

AI Technical Summary

Technical Problem

Existing vehicle re-identification technology is difficult to effectively distinguish vehicles with similar appearances and process vehicle images from different viewing angles, resulting in increased identification difficulty.

Method used

A vehicle re-identification method based on multi-view and convolutional attention modules is used to generate a mask through a deep learning segmentation network. Combined with the ResNet50 backbone network and convolutional attention module, a global and local feature representation module is constructed, using a variety of pooling and splicing fusion, calculate local distances under different viewing angles, and optimize the model by combining global and local loss functions.

Benefits of technology

It improves the vehicle discrimination ability, enhances the viewing angle anti-interference ability, and achieves accurate re-identification of the same vehicle with similar appearance and different viewing angles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113591928B_ABST
    Figure CN113591928B_ABST
Patent Text Reader

Abstract

The present invention provides a vehicle re-identification method and system based on multi-view and convolutional attention modules. By adding the convolutional attention module, the model can focus on the effective features of the vehicle and ignore the invalid features, thereby improving the model's recognition ability. The common surface calculation in the local module enables the model to have a stronger view interference resistance, solving the problem that the same vehicle under different view angles is difficult to distinguish. The function of re-identifying vehicles with similar appearances and the same vehicle under different view angles is realized. The present invention combines the global feature representation and the local feature representation modules, so that the model can learn better feature information, enhance the network's feature expression ability, and more effectively perform vehicle re-identification tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of vehicle image retrieval, and in particular relates to a vehicle re-identification method and system based on multi-view and convolutional attention modules. Background Art

[0002] Vehicle re-identification is a cross-camera vehicle image retrieval problem in a specific surveillance scenario. In recent years, with the increase in surveillance cameras and the development of intelligent transportation, vehicle re-identification has attracted more and more attention. Thanks to the development of deep learning technology, vehicle re-identification technology has made great progress. The emergence of many excellent backbone networks, such as ResNet, has laid the foundation for feature extraction. At the same time, the release of vehicle re-identification datasets such as VeRI776 and VERI-Wild has also promoted the development of vehicle re-identification.

[0003] However, vehicle re-identification remains a challenging task in computer vision. First, it is still difficult to distinguish vehicles with similar appearances. Second, changes in vehicle perspectives will greatly increase the difficulty of vehicle re-identification.

[0004] In order to solve the problem of re-identification of similar vehicles, researchers have done a lot of work to improve the discriminative ability of features. Liu et al. proposed a progressive retrieval method from coarse to fine. Liu et al. proposed a region-aware model to learn features from global appearance and local details. Color and some detail clues are also used for training to distinguish vehicles with similar appearance. He et al. focused on details such as windows, lights and car logos. Wang et al. used 20 key points to mark the direction information of the vehicle and proposed a direction-based feature extraction method. In order to better optimize the model, effective loss functions such as triplet loss, center loss, and ID Softmaxloss were proposed.

[0005] The change of vehicle perspective is another challenge in re-identification. Zhou et al. proposed an attention reasoning model. Based on the idea of ​​generative adversarial network, they designed a multi-perspective generative network to generate vehicle perspective feature vectors. In order to cope with the influence of perspective, Zhu et al. proposed a method of learning four-directional features using four-directional average pooling layers to improve the robustness of perspective changes. Lin et al. divided the retrieval task into matching vehicles under the same perspective and matching vehicles under different perspectives. At the same time, two corresponding loss functions were designed to solve the difficulty of re-identification caused by changes in camera perspective.

[0006] Although the above methods have achieved certain results in improving the performance model, they have not effectively combined feature representation with coping with perspective changes. Therefore, while focusing on effective feature extraction and representation, the solution to the perspective problem should also be integrated. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a vehicle re-identification method and system based on multi-view and convolutional attention module, which is used to re-identify vehicles with similar appearance and the same vehicle under different view angles.

[0008] The technical solution adopted by the present invention to solve the above technical problems is: a vehicle re-identification method based on multi-view and convolutional attention module, comprising the following steps:

[0009] S1: Extract some vehicle images from the vehicle image dataset for semantic annotation; train the annotated vehicle images through a deep learning segmentation network to obtain a semantic segmentation model; input all vehicle images in the vehicle image dataset into the trained semantic segmentation model for inference, so that each image generates a mask;

[0010] S2: Construct a vehicle re-identification network based on multi-view and convolutional attention modules, including the global feature representation module and the local feature representation module of the shared backbone network ResNet50. The bottleneck layer of the backbone network ResNet50 includes the convolutional attention module CBAM; the backbone network ResNet50 flows the extracted features and masks into the global feature representation module and the local feature representation module; the global feature representation module performs multiple pooling, splicing, fusion and classification on the incoming features; the local feature representation module aligns the incoming features and masks to generate local features of different viewpoints, and calculates the local distances of different vehicles under different viewpoints through the common surface calculation method;

[0011] S3: The global loss function is used to calculate the global loss of the features classified by the global feature representation module; the local loss function is used to calculate the local loss of the local distance calculated by the local feature representation module; the total loss function obtained by weighted addition of the global loss function and the local loss function is used to optimize the vehicle re-identification network based on multi-view and convolutional attention modules;

[0012] S4: The vehicle image and the corresponding mask are input into the vehicle re-identification network based on multi-view and convolutional attention module for training. After iteration, the vehicle re-identification model is generated and saved.

[0013] S5: Input the vehicle image to be retrieved into the trained vehicle re-identification model for inference, and return the vehicle retrieval result.

[0014] According to the above scheme, in step S1, the specific steps are: the vehicle data set includes a training set and a test set, and the test set includes a query set and a gallery set; when annotating images, different colors are used to annotate different perspectives of the vehicle including the front, rear, side, and top; and a deep learning segmentation network U-Net is used to train the annotated images.

[0015] Furthermore, in step S2, the specific steps are:

[0016] S21: The backbone network ResNet50 extracts features and flows the features and masks into the global feature representation module and the local feature representation module;

[0017] S22: The convolutional attention module CBAM includes the channel attention module and the spatial attention module, which are sequentially added to the bottleneck layer of the backbone network ResNet50, serving as a shared backbone network for the global feature representation module and the local feature representation module to enhance the model's ability to distinguish.

[0018] S23: The global feature representation module performs global maximum pooling and global average pooling on the incoming features, and then concatenates and fuses the two pooled features according to the dimension direction and classifies them;

[0019] S24: The local feature representation module aligns the features extracted by the backbone network ResNet50 and the mask Mask; let the features extracted by the backbone network ResNet50 be F(m, n), and the mask Mask be {S i |i∈{1, 2, 3, 4}}, different values ​​of i represent different perspectives of the vehicle including the front, rear, side, and top, respectively, then the local features F of the vehicle including the front, rear, side, and top are generated respectively i for:

[0020]

[0021] S25: The local feature representation module calculates the scores of the vehicle from different perspectives including the front, rear, side, and top through the mask Mask. i :

[0022]

[0023] Calculate the common face score of vehicle image x and vehicle image y by viewing angle score

[0024]

[0025] Let the Euclidean distance be D, and score the common face and the local feature F obtained in step S24i Calculate the local distance between two vehicles

[0026]

[0027] Furthermore, in step S3, the specific steps are:

[0028] Cross entropy loss and center loss are used in the global feature representation module; triple loss is used in the local feature representation module; the local distance between the anchor and the positive sample is set to The local distance between the anchor and the negative sample is The marginal coefficient is α, and the function max(0,·) is expressed as [·] + , then the total loss function is:

[0029]

[0030] Furthermore, in step S4, the specific steps are:

[0031] S41: Input the vehicle images and corresponding masks of the training set into the vehicle re-identification network based on multi-view and convolutional attention modules, specify the number of training iterations, and perform training in batches;

[0032] S42: In the training, the Adam algorithm is selected as the optimizer, and the batch training method is used. The batch size of the samples in a single training is 64, and the number of training epochs is 140;

[0033] S43: adopt a multi-step learning rate adjustment strategy, and set the learning rates of [0, 20], [20, 50], [50, 90], and [90, 140] epochs to 3.5e-5, 3.5e-4, 3.5e-5, and 3.5e-6 respectively;

[0034] S44: All input vehicle images are randomly cropped to 256×256, and random brightness and random erasing methods are used to enhance the data;

[0035] S45: Generate a vehicle re-identification model and save the optimal model result.

[0036] Furthermore, in step S5, the specific steps are:

[0037] S51: Calculate the global distance D between the global features of the vehicle image to be retrieved and the global features of the vehicle image in the training set according to the Euclidean distance global ;

[0038] S52: According to step S25 Calculate the local distance Dlocal ;

[0039] S53: Assume that the weight coefficients are λ1 and λ2; then the total distance between the features of the vehicle image to be retrieved and the features of the vehicle image in the training set is:

[0040] D total =λ1D global +λ2D local .

[0041] The vehicle re-identification system based on multi-view and convolutional attention modules includes a data preprocessing module, a training module, and an inference module connected in sequence; the data preprocessing module is used to select part of the data to train the semantic segmentation network and generate a mask Mask corresponding to the image; the training module is used to build a network model, input the training image and the mask Mask training model, and obtain the optimal model after a given number of trainings; the inference module is used to input the vehicle image to be retrieved and output the retrieval result image.

[0042] Furthermore, the training module includes a backbone network ResNet50, a global feature representation module and a local feature representation module respectively connected to the back stage of the backbone network ResNet50, and a total loss function connected to the back stage of the global feature representation module and the back stage of the local feature representation module; the bottleneck layer bottleneck of the backbone network ResNet50 includes a convolutional attention module CBAM, and the convolutional attention module CBAM includes a channel attention module and a spatial attention module; the global feature representation module includes a global pooling layer, a splicing fusion module, a classifier, and a global loss function connected in sequence; the global pooling layer includes a global maximum pooling layer and a global average pooling layer; the local feature representation module includes a local feature alignment module, a local pooling layer, a local distance module, and a local loss function connected in sequence.

[0043] A computer storage medium stores a computer program executable by a computer processor, wherein the computer program executes a vehicle re-identification method based on multi-view and convolutional attention modules.

[0044] The beneficial effects of the present invention are:

[0045] 1. The vehicle re-identification method and system based on multi-view and convolutional attention module of the present invention, by adding a convolutional attention module, enables the model to focus on the effective features of the vehicle and ignore invalid features, thereby improving the model's recognition ability; through the calculation of common surfaces in the local module, the model has a stronger perspective anti-interference ability, solving the problem that the same vehicle is difficult to distinguish from different perspectives; and realizes the function of re-identifying vehicles with similar appearance and the same vehicle from different perspectives.

[0046] 2. The present invention combines global feature representation and local feature representation modules, so that the model can learn better feature information, enhance the feature expression ability of the network, and perform vehicle re-identification tasks more effectively. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is a flow chart of an embodiment of the present invention.

[0048] Figure 2 It is a network structure diagram of an embodiment of the present invention.

[0049] Figure 3 It is a system flow chart of an embodiment of the present invention.

[0050] Figure 4 It is a result diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0051] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0052] See also Figure 1 The vehicle re-identification method based on multi-view and convolutional attention module of the embodiment of the present invention comprises the following steps:

[0053] S1: Extract a portion of images from the vehicle re-identification dataset, annotate them using labelme, and train a semantic segmentation network. Input all images in the dataset into the trained semantic segmentation network so that each image generates a mask;

[0054] The present invention adopts the VeRi776 vehicle dataset, which includes a training set and a test set (which is further divided into a query set and a gallery set). 1665 images are extracted from the training set and 400 images are extracted from the test set for semantic annotation. When annotating, the labelme software is used to mark the front, rear, side, and top of the vehicle with different colors. Then, the U-Net is used to train the annotated images to obtain a semantic segmentation model. Finally, all images in the training set and the test set are input into the trained segmentation model for inference, and a corresponding Mask is generated for each image in the VeRi dataset.

[0055] S2: Design a vehicle re-identification network structure based on multi-view and convolutional attention, including a global feature representation module and a local feature representation module;

[0056] S21: The network structure is divided into two branches, namely the global feature representation module and the local feature representation module. The two share a backbone network.

[0057] S22: Add the convolutional attention module (CBAM) to the ResNet50 backbone network to enhance the model's discrimination ability.

[0058] The convolutional attention module contains two modules, channel attention and spatial attention, which are added to the bottleneck of the ResNet50 network in sequence as a shared backbone network for the global feature representation module and the local feature representation module. After the global features are extracted using ResNet50, one branch flows into the global module and the other branch flows into the local module.

[0059] S23: In the global feature representation module, the features extracted by the ResNet50 network are subjected to global maximum pooling and global average pooling respectively, and then the two pooled features are concatenated together in the dimension direction to enhance the robustness of the features. They are then sent to the subsequent classifier for classification and the global loss is calculated.

[0060] S24: In the local feature representation module, the features extracted by Mask and ResNet50 are aligned to generate local features F of the front, rear, side and top of the vehicle. i . Local feature F i It is expressed as:

[0061]

[0062] Among them, the Mask of the vehicle image is represented as {S i |i∈{1, 2, 3, 4}}, respectively represents the front, back, side and top parts, and F(m, n) is the feature extracted by ResNet50.

[0063] S25: In the local feature representation module, the image mask is used to calculate the view scores a of the four parts. i :

[0064]

[0065] Then, the common face score of the two vehicle images x and y is calculated by the perspective score.

[0066]

[0067] Finally, the local distance between the two vehicles is calculated based on the previous local features and perspective scores.

[0068]

[0069] S3: Design the loss function. Different loss functions are used for the global module and local module in the network structure. The loss function obtained by adding them together is used to optimize the model.

[0070] The loss function consists of two parts: the global loss function and the local loss function. The two are added together to obtain the total loss function to optimize the model. In the global module, cross-entropy loss and center loss are used. In the local module, triplet loss is used. The loss function is expressed as:

[0071]

[0072] in Represents the local distance between the anchor and the positive sample, represents the local distance between the anchor and the negative sample, α represents the edge coefficient, [·] + Represents the function max(0,·).

[0073] S4: input the training image and the generated Mask into the network for training, generate a vehicle re-identification model and save it;

[0074] Input the training set into the above network structure, specify the number of training iterations, perform training in batches, and save the optimal model results.

[0075] During training, Adam was selected as the optimizer, and the batch training method was used. The batch size was 64 and the number of training rounds was 140 epochs. At the same time, a multi-step learning rate adjustment strategy was adopted. The learning rates of [0, 20], [20, 50], [50, 90], and [90, 140] epochs were 3.5e-5, 3.5e-4, 3.5e-5, and 3.5e-6, respectively. For all input images, they were first randomly cropped to 256×256. At the same time, random brightness and random erasing data enhancement methods were also used.

[0076] S5: Input the vehicle image to be retrieved, use the trained vehicle re-identification model for inference, and return the vehicle retrieval result.

[0077] In the inference stage, the global distance D between the query vehicle global features and the global features of the gallery set is first calculated using the Euclidean distance global Then according to the above Calculate the local distance D local The total distance between the query set and the gallery set is calculated as follows: In the present invention, λ1=0.7 and λ2=0.3 are set.

[0078] The distance between the features of two images is expressed as:

[0079] D total =λ1D global +λ2Dlocal ,

[0080] Where D global is the Euclidean distance between features, D local For the above λ1, λ2 are weight coefficients.

[0081] The present invention also provides a vehicle re-identification system based on multi-view and convolutional attention module, such as Figure 3 As shown, including:

[0082] The data preprocessing module 101 selects part of the data to train the semantic segmentation network and generates a mask corresponding to the image;

[0083] The training module 102 inputs the training image and the Mask training model, and obtains the optimal model after a given number of trainings;

[0084] The reasoning module 103 inputs the vehicle image to be retrieved and outputs the retrieval result image;

[0085] Test Example:

[0086] Our method is tested on the VeRi776 dataset using three metrics: mAP, CMC Rank@1, and CMC Rank@5. First, our method is compared with several methods that focus on feature representation, including PROVID, RAM, PNVR, and OIFE. It is also compared with methods that solve the viewpoint problem, such as VAMI, QD-DLF, MVL, and VANET.

[0087] Table 1 Comparison results between the present invention and eight excellent methods

[0088]

[0089]

[0090] It can be seen from Table 1 that the method of the present invention achieves higher scores in all three metrics compared with the other eight methods, proving that the method of the present invention is superior to the compared methods.

[0091] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.

Claims

1. A vehicle re-identification method based on multi-view and convolutional attention module, characterized by: The following steps are involved: S1: Extract some vehicle images from the vehicle image dataset for semantic annotation; train the annotated vehicle images through a deep learning segmentation network to obtain a semantic segmentation model; input all vehicle images in the vehicle image dataset into the trained semantic segmentation model for inference, so that each image generates a mask; S2: Construct a vehicle re-identification network based on multi-view and convolutional attention modules, including the global feature representation module and local feature representation module of the shared backbone network ResNet50. The bottleneck layer of the backbone network ResNet50 includes the convolutional attention module CBAM. The backbone network ResNet50 flows the extracted features and masks into the global feature representation module and the local feature representation module; the global feature representation module performs multiple pooling, splicing, fusion, and classification on the incoming features; the local feature representation module aligns the incoming features and masks to generate local features of different perspectives, and calculates the local distances of different vehicles under different perspectives through the common surface calculation method; the specific steps are: S21: The backbone network ResNet50 extracts features and flows the features and masks into the global feature representation module and the local feature representation module; S22: The convolutional attention module CBAM includes the channel attention module and the spatial attention module, which are sequentially added to the bottleneck layer of the backbone network ResNet50, serving as a shared backbone network for the global feature representation module and the local feature representation module to enhance the model's ability to distinguish. S23: The global feature representation module performs global maximum pooling and global average pooling on the incoming features, and then concatenates and fuses the two pooled features according to the dimension direction and classifies them; S24: The local feature representation module aligns the features extracted by the backbone network ResNet50 and the mask Mask; let the features extracted by the backbone network ResNet50 be F(m, n), and the mask Mask be {S i |i∈{1, 2, 3, 4}}, different values ​​of i represent different perspectives of the vehicle including the front, rear, side, and top, respectively, then the local features F of the vehicle including the front, rear, side, and top are generated respectively i for: S25: The local feature representation module calculates the scores of different perspectives of the vehicle, including the front, rear, side, and top, through the mask Mask. i : Calculate the common face score of vehicle image x and vehicle image y by viewing angle score Let the Euclidean distance be D, and score the common face and the local feature F obtained in step S24 i Calculate the local distance between two vehicles S3: The global loss function is used to calculate the global loss of the features classified by the global feature representation module; the local loss function is used to calculate the local loss of the local distance calculated by the local feature representation module; the total loss function obtained by weighted addition of the global loss function and the local loss function is used to optimize the vehicle re-identification network based on multi-view and convolutional attention modules; the specific steps are: Cross entropy loss and center loss are used in the global feature representation module; triple loss is used in the local feature representation module; the local distance between the anchor and the positive sample is set to The local distance between the anchor and the negative sample is The marginal coefficient is α, and the function max(0,·) is expressed as [·] + , then the total loss function is: S4: The vehicle image and the corresponding mask are input into the vehicle re-identification network based on multi-view and convolutional attention module for training. After iteration, the vehicle re-identification model is generated and saved. S5: Input the vehicle image to be retrieved into the trained vehicle re-identification model for inference, and return the vehicle retrieval result.

2. The vehicle re-identification method based on multi-view and convolutional attention module according to claim 1, characterized in that: In the step S1, the specific steps are: the vehicle data set includes a training set and a test set, the test set includes a query set and a gallery set; when annotating images, different colors are used to annotate different perspectives of the vehicle including the front, rear, side, and top; and a deep learning segmentation network U-Net is used to train the annotated images.

3. The vehicle re-identification method based on multi-view and convolutional attention module according to claim 1, characterized in that: In the step S4, the specific steps are: S41: Input the vehicle images and corresponding masks of the training set into the vehicle re-identification network based on multi-view and convolutional attention modules, specify the number of training iterations, and perform training in batches; S42: In the training, the Adam algorithm is selected as the optimizer, and the batch training method is used. The number of samples in a single training is 64, and the number of training epochs is 140; S43: adopt a multi-step learning rate adjustment strategy, and set the learning rates of [0, 20], [20, 50], [50, 90], and [90, 140] epochs to 3.5e-5, 3.5e-4, 3.5e-5, and 3.5e-6 respectively; S44: All input vehicle images are randomly cropped to 256×256, and random brightness and random erasing methods are used to enhance the data; S45: Generate a vehicle re-identification model and save the optimal model result.

4. The vehicle re-identification method based on multi-view and convolutional attention module according to claim 3, characterized in that: In the step S5, the specific steps are: S51: Calculate the global distance D between the global features of the vehicle image to be retrieved and the global features of the vehicle image in the training set according to the Euclidean distance global ; S52: According to step S25 Calculate the local distance D local ; S53: Assume that the weight coefficients are λ1 and λ2; then the total distance between the features of the vehicle image to be retrieved and the features of the vehicle image in the training set is: D total =λ1D global +λ2D local 。 5. A vehicle re-identification system for the vehicle re-identification method based on multi-view and convolutional attention module according to any one of claims 1 to 4, characterized in that: It includes a data preprocessing module, a training module, and an inference module connected in sequence; The data preprocessing module is used to select part of the data to train the semantic segmentation network and generate the mask corresponding to the image; The training module is used to build the network model, input the training image and mask training model, and obtain the optimal model after a given number of trainings; The reasoning module is used to input the vehicle image to be retrieved and output the retrieval result image.

6. The vehicle re-identification system according to claim 5, characterized in that: The training module includes a backbone network ResNet50, a global feature representation module and a local feature representation module respectively connected to the back stage of the backbone network ResNet50, and a total loss function connected to the back stage of the global feature representation module and the back stage of the local feature representation module; The bottleneck layer of the backbone network ResNet50 includes a convolutional attention module CBAM, which includes a channel attention module and a spatial attention module; The global feature representation module includes a global pooling layer, a splicing fusion module, a classifier, and a global loss function connected in sequence; the global pooling layer includes a global maximum pooling layer and a global average pooling layer; The local feature representation module includes a local feature alignment module, a local pooling layer, a local distance module, and a local loss function which are connected in sequence.

7. A computer storage medium, characterized in that: A computer program executable by a computer processor is stored therein, and the computer program executes the vehicle re-identification method based on multi-view and convolutional attention module as described in any one of claims 1 to 4.

Citation Information

Cited By

  • Vehicle re-identification system and method fusing multiple attributes and local features

    CN114677557A