Vehicle re-identification method, device, electronic equipment and medium
By combining the hash coding layer and the deep learning network in the vehicle re-identification model, the local sensitive hash algorithm is used to provide metric learning label information, which solves the problem of low cross-domain test performance of the vehicle re-identification model and improves the recognition accuracy and efficiency. , and compresses the dimensionality of the embedding vector, which is suitable for vehicle retrieval tasks.
Patent Information
- Application Number
- CN202010881410.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-27
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-08-27
AI Technical Summary
The existing vehicle re-identification model has low performance in cross-domain tests, and the annotation information of the public data set is insufficient, resulting in limited effectiveness of the vehicle re-identification task, and the output embedding vector dimension is too high, which is not conducive to application.
Construct a re-identification model for vehicle retrieval, combine the hash coding layer and the deep learning network, provide metric learning label information for the model through the local sensitive hash algorithm, use hash coding for vehicle retrieval after training, and compress the embedding vector dimension to Improve recognition efficiency.
The accuracy and recognition efficiency of the vehicle re-identification model are improved, the dimensionality of the embedding vector is reduced, and the efficiency of vehicle retrieval is enhanced.
Smart Images

Figure CN111967426B
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent identification technology, and in particular to a vehicle re-identification method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Re-identification refers to the work done to distinguish a target from similar targets after target detection. Judging from the performance of some simple open source datasets, existing re-identification models are close to being usable. For example, the SOTA of the Market1501 and VeRi776 public datasets has reached 96%. SOTA (full name state of the art) is used to describe the model that achieves the current best effect on a task in machine learning. For example, in the image classification task, if a model achieves the current best performance on a commonly used dataset (such as ImageNet), it can be said that this model has reached SOTA.
[0003] However, the performance of existing re-identification models is only 60% through cross-domain testing. This cross-domain test mainly refers to using a public dataset to test the re-identification model trained in another dataset. In terms of the amount of information, most public datasets only provide ID (identification) and camera information as labels, ignoring the important information of the difference between different labels. From the perspective of the model development process, from the initial cross entropy loss to Center-Loss, to triplet-loss, and Multi-loss, the idea of making full use of label information runs through, and it has indeed achieved significant improvement. However, as far as vehicle re-identification tasks are concerned, the annotation information of public datasets is still relatively insufficient, which has become one of the important reasons restricting the effectiveness of vehicle re-identification tasks. In addition, the current vehicle re-identification model takes improving model accuracy as its primary goal, and the output embedding vector is as high as thousands of dimensions, which is not conducive to the final application, such as query. Summary of the invention
[0004] The purpose of this application is to provide a vehicle re-identification method and device, an electronic device and a computer-readable storage medium to improve the accuracy and recognition efficiency of vehicle re-identification.
[0005] The first aspect of the present application provides a vehicle re-identification method, comprising:
[0006] Constructing a re-identification model for vehicle retrieval, the re-identification model comprising a hash coding layer;
[0007] Training the re-identification model based on training samples;
[0008] Input the target image including the target vehicle into the trained re-identification model to obtain the hash code data of the target vehicle output by the hash code layer;
[0009] Inputting the image to be identified including the vehicle to be identified into the trained re-identification model to obtain hash code data of the vehicle to be identified output by the hash coding layer;
[0010] The hash code data of the vehicle to be identified is compared with the hash code data of the target vehicle, and an identification result of the vehicle to be identified is obtained according to the comparison result.
[0011] A second aspect of the present application provides a vehicle re-identification device, comprising:
[0012] A model building module, for building a re-identification model for vehicle retrieval, wherein the re-identification model includes a hash coding layer;
[0013] A model training module, used for training the re-identification model based on training samples;
[0014] A first recognition module is used to input a target image including a target vehicle into a trained re-recognition model to obtain hash code data of the target vehicle output by a hash code layer;
[0015] A second recognition module is used to input the image to be recognized including the vehicle to be recognized into the trained re-recognition model to obtain hash code data of the vehicle to be recognized output by the hash code layer;
[0016] The comparison module is used to compare the hash code data of the vehicle to be identified with the hash code data of the target vehicle, and obtain the identification result of the vehicle to be identified according to the comparison result.
[0017] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect of the present application.
[0018] A fourth aspect of the present application provides a computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method described in the first aspect of the present application.
[0019] Compared with the prior art, the vehicle re-identification method, device, electronic device and medium provided in the present application construct a re-identification model for vehicle retrieval, which includes a hash coding layer; the re-identification model is trained based on training samples; the target image including the target vehicle is input into the trained re-identification model to obtain the hash coding data of the target vehicle output by the hash coding layer; the image to be identified including the vehicle to be identified is input into the trained re-identification model to obtain the hash coding data of the vehicle to be identified output by the hash coding layer; the hash coding data of the vehicle to be identified is compared with the hash coding data of the target vehicle, and the identification result of the vehicle to be identified is obtained according to the comparison result. In this scheme, the hash coding method is combined with the deep learning network, and the hash coding method is used to provide the re-identification model with metric learning label information, thereby improving the recognition accuracy of the re-identification model. And after the training is completed, the hash coding is used for vehicle retrieval, which greatly compresses the dimension of the embedded vector and improves the recognition efficiency of the re-identification model. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0021] Figure 1 A flow chart of a vehicle re-identification method provided by some embodiments of the present application is shown;
[0022] Figure 2 A structural diagram of a re-identification model provided by some embodiments of the present application is shown;
[0023] Figure 3 A structural diagram of another re-identification model provided by some embodiments of the present application is shown;
[0024] Figure 4 A schematic diagram of a vehicle re-identification device provided in some embodiments of the present application is shown;
[0025] Figure 5 A schematic diagram of an electronic device provided by some embodiments of the present application is shown;
[0026] Figure 6 A schematic diagram of a computer-readable storage medium provided in some embodiments of the present application is shown. DETAILED DESCRIPTION
[0027] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0028] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.
[0029] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0030] At present, the annotation information of public datasets is still relatively insufficient for vehicle re-identification tasks, which has become one of the important reasons that restrict the effectiveness of vehicle re-identification tasks. In addition, the current vehicle re-identification model takes improving the model accuracy as the primary goal, and the output embedding vector is as high as thousands of dimensions, which is not conducive to the final vehicle retrieval.
[0031] In view of this, the embodiment of the present application will provide a vehicle re-identification method and device, and an electronic device and storage medium based on the method. In the scheme of the embodiment of the present application, a re-identification model for vehicle retrieval is first constructed, and the re-identification model includes a hash coding layer; the re-identification model is trained based on training samples; the target image including the target vehicle is input into the trained re-identification model to obtain the hash coding data of the target vehicle output by the hash coding layer; the image to be identified including the vehicle to be identified is input into the trained re-identification model to obtain the hash coding data of the vehicle to be identified output by the hash coding layer; the hash coding data of the vehicle to be identified is compared with the hash coding data of the target vehicle, and the identification result of the vehicle to be identified is obtained according to the comparison result. The scheme of the embodiment of the present application combines the hash coding method with the deep learning network, and provides the re-identification model with the metric learning label information by means of the hash coding method, thereby improving the accuracy of the re-identification model. And after the training is completed, the hash coding is used for vehicle retrieval, which greatly compresses the dimension of the embedded vector and improves the efficiency of the re-identification model.
[0032] To further illustrate the solution of the embodiment of the present application, the following description will be made in conjunction with the accompanying drawings. It is understandable that in the following embodiments, the same or corresponding contents can be referenced to each other, and for the sake of simplicity of description, no further description will be given later.
[0033] Embodiments of the present application provide a vehicle re-identification method and device, an electronic device, and a computer-readable storage medium, which are described below in conjunction with the accompanying drawings.
[0034] Please refer to Figure 1 , which shows a flow chart of a vehicle re-identification method provided by some embodiments of the present application, the method is applied to a vehicle identification device, and the vehicle identification device can be a smart phone, a computer or a related electronic device. As shown in the figure, the vehicle re-identification method can include the following steps:
[0035] Step S101: construct a re-identification model for vehicle retrieval, where the re-identification model includes a hash coding layer.
[0036] Step S102: training the re-identification model based on the training samples.
[0037] Step S103: input the target image including the target vehicle into the trained re-recognition model to obtain hash coding data of the target vehicle output by the hash coding layer.
[0038] Step S104: inputting the image to be identified including the vehicle to be identified into the trained re-identification model to obtain hash coding data of the vehicle to be identified output by the hash coding layer.
[0039] Step S105: Compare the hash code data of the vehicle to be identified with the hash code data of the target vehicle, and obtain an identification result of the vehicle to be identified according to the comparison result.
[0040] In step S101, a pre-trained baseline model is obtained, and after the baseline model, a fully connected layer for hash coding linear mapping and a hash coding layer used as an activation function are inserted.
[0041] Among them, the baseline model is a neural network model based on deep learning, which can be a linear regression, logistic regression, gradient boosting decision tree, simple brain convolution framework and other models.
[0042] Preferably, the hash coding layer adopts a locality sensitive hashing algorithm. The locality sensitive hashing (LSH) algorithm is an algorithm for measuring text similarity. The basic idea of locality sensitive hashing is similar to a spatial domain conversion idea. The LSH algorithm is based on an assumption that if two texts are similar in the original data space, then they will also have a high degree of similarity after being converted by the hash function; on the contrary, if they are not similar in themselves, then they should still have no similarity after the conversion. The biggest feature of locality sensitive hashing is to maintain the similarity of data. Locality sensitive hashing is an effective solution for high-dimensional data retrieval. In this embodiment, it is integrated with the baseline model to achieve an end-to-end complete solution and improve model efficiency.
[0043] Please refer to Figure 2 , the recognition process of the re-identification model is as follows:
[0044] Input the vehicle image into the baseline model for feature extraction to obtain the vehicle embedding vector;
[0045] The vehicle's embedding vector is input into the fully connected layer and the hash coding layer in sequence to obtain the vehicle's hash coding data output by the hash coding layer.
[0046] In step S102, the re-identification model constructed in step S101 is trained. After the baseline model training converges, it is frozen and the weights of the hash coding layer are optimized by minimizing the loss function L. The fully connected layer does not participate in the training, and random initialization is used for each inference.
[0047] Preferably, the weights of the fully connected layer can be initialized by Gaussian random variables. Before training the re-identification model, the weights of the fully connected layer must be initialized. If the weights are not initialized properly, the model may fall into a local optimal solution, resulting in unsatisfactory model prediction results, or even causing the loss function to oscillate and the model to not converge. Gaussian initialization is better. Gaussian initialization is to initialize the weights according to a Gaussian distribution, but the mean is usually selected as 0, and the variance needs to be manually selected based on experience.
[0048] Preferably, the loss function L of the re-identification model can be the distance matrix D h The cosine distance from D is:
[0049]
[0050] Among them, the distance matrix D h represents the distance matrix calculated using the hashed data of the training samples, and the distance matrix D represents the distance matrix calculated using the embedding vectors of the training samples.
[0051] The weights of the hash coding layer are trained based on the above loss function L, and the network parameters of the baseline model are optimized.
[0052] Specifically, the process of determining the loss function L is as follows:
[0053] Input the training samples into the baseline model.
[0054] Perform batch normalization on the embedding vector output by the baseline model to obtain the processed embedding vector; specifically, Figure 2 A BN layer is added between the baseline model and the fully connected layer to process the embedding vector, such as Figure 3 shown.
[0055] Among them, BN (Batch Normalization): As the depth of the network increases, the distribution of eigenvalues in each layer will gradually approach the upper and lower ends of the output interval of the activation function (the saturation interval of the activation function), and this will cause the gradient to vanish. BN uses a method to pull the eigenvalue distribution of this layer back to the standard normal distribution. The eigenvalue will fall in the interval where the activation function is more sensitive to the input. Small changes in the input can lead to larger changes in the loss function, making the gradient larger, avoiding gradient vanishing, and also speeding up convergence.
[0056] The processed embedding vector is input into the fully connected layer and the hash coding layer, and the hash coding data C of the training sample is output. h , C h is a binary sequence.
[0057] Using C h Calculate the distance matrix D between training samples h , and the distance matrix D h Element d ij Set to 0; where ID(i) = ID(j), represents different training samples from the same vehicle object, that is, different samples from the same vehicle object;
[0058] Use the embedding vectors of the training samples to calculate the distance matrix D between the training samples;
[0059] Calculate the distance matrix D h The cosine distance with D is used as the loss function L, as shown in the L formula above.
[0060] In this embodiment, the re-identification model is trained according to the newly designed loss function L to provide metric learning label information for the re-identification algorithm with the help of the local sensitive hashing algorithm, thereby improving the accuracy of the re-identification model.
[0061] In step S103, the target image including the target vehicle is input into the trained re-identification model to obtain the hash code data of the target vehicle output by the hash code layer. The hash code data of the target vehicle is stored in the search library. It is worth noting that the number of output channels of the fully connected layer of the local sensitive hashing part should be appropriately adjusted according to the capacity of the search library.
[0062] In step S104, the image to be identified including the vehicle to be identified is input into the trained re-identification model to obtain hash coding data of the vehicle to be identified output by the hash coding layer.
[0063] In step S105, the hash code data of the vehicle to be identified is compared with the hash code data of the target vehicle, and the identification result of the vehicle to be identified is obtained according to the comparison result. h As output and directly used for vehicle retrieval, the empty retrieval result occurs naturally without setting a threshold. In addition, compared with retrieval using embedded vectors, the retrieval efficiency is improved because the retrieval data dimension is greatly compressed.
[0064] Compared with the prior art, the vehicle re-identification method provided in the embodiment of the present application combines the local sensitive hashing algorithm with the deep learning network, and uses the local sensitive hashing algorithm to provide metric learning label information for the re-identification model, thereby improving the model accuracy. After the training is completed, the local sensitive hashing code is used for retrieval, which greatly compresses the dimension of the embedded vector and improves the recognition efficiency of the model.
[0065] In the above-mentioned embodiment, a vehicle re-identification method is provided. Correspondingly, the present application also provides a vehicle re-identification device. Figure 4 , which shows a schematic diagram of a vehicle re-identification device provided by some embodiments of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0066] like Figure 4 As shown, the vehicle re-identification device 10 may include:
[0067] A model building module 101 is used to build a re-identification model for vehicle retrieval, wherein the re-identification model includes a hash coding layer;
[0068] A model training module 102, used for training the re-identification model based on training samples;
[0069] The first recognition module 103 is used to input the target image including the target vehicle into the trained re-recognition model to obtain the hash code data of the target vehicle output by the hash code layer;
[0070] The second recognition module 104 is used to input the image to be recognized including the vehicle to be recognized into the trained re-recognition model to obtain the hash code data of the vehicle to be recognized output by the hash code layer;
[0071] The comparison module 105 is used to compare the hash code data of the vehicle to be identified with the hash code data of the target vehicle, and obtain the identification result of the vehicle to be identified according to the comparison result.
[0072] According to some implementations of the present application, the model building module 101 is specifically used for:
[0073] Get a pre-trained baseline model;
[0074] After the baseline model, a fully connected layer for hash coding linear mapping and a hash coding layer used as an activation function are inserted;
[0075] Among them, the baseline model is a neural network model based on deep learning.
[0076] According to some implementations of the present application, the recognition process of the re-recognition model is as follows:
[0077] Input the vehicle image into the baseline model for feature extraction to obtain the vehicle embedding vector;
[0078] The vehicle's embedding vector is input into the fully connected layer and the hash coding layer in sequence to obtain the vehicle's hash coding data output by the hash coding layer.
[0079] According to some embodiments of the present application, the loss function L of the re-identification model is the distance matrix D h The cosine distance from D is:
[0080]
[0081] Among them, the distance matrix D h represents the distance matrix calculated using the hashed data of the training samples, and the distance matrix D represents the distance matrix calculated using the embedding vectors of the training samples.
[0082] According to some implementations of the present application, the loss function L is determined as follows:
[0083] Input the training samples into the baseline model;
[0084] Perform batch normalization on the embedding vector output by the baseline model to obtain the processed embedding vector;
[0085] Input the processed embedding vector into the fully connected layer and the hash coding layer, and output the hash coding data of the training sample;
[0086] Use the hash code data of the training samples to calculate the distance matrix D between the training samples h , and the distance matrix D h Element d ij Set to 0; where ID(i) = ID(j), indicating different training samples from the same vehicle object;
[0087] Use the embedding vectors of the training samples to calculate the distance matrix D between the training samples;
[0088] Calculate the distance matrix D h The cosine distance between L and D is used as the loss function L.
[0089] According to some implementations of the present application, the hash coding layer adopts a locality sensitive hashing algorithm.
[0090] According to some implementations of the present application, the weights of the fully connected layer are initialized by Gaussian random variables, and the weights of the hash coding layer are trained based on the loss function L.
[0091] The vehicle re-identification device 10 provided in the embodiment of the present application is based on the same inventive concept as the vehicle re-identification method provided in the aforementioned embodiment of the present application and has the same beneficial effects.
[0092] The embodiments of the present application also provide an electronic device corresponding to the vehicle re-identification method provided in the aforementioned embodiments, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the aforementioned vehicle re-identification method.
[0093] Please refer to Figure 5 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 5 As shown, the electronic device 20 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, and the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, the vehicle re-identification method provided in any of the aforementioned embodiments of the present application is executed.
[0094] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0095] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving execution instructions. The vehicle re-identification method disclosed in any implementation of the above-mentioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.
[0096] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.
[0097] The electronic device provided in the embodiment of the present application and the vehicle re-identification method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0098] The present application also provides a computer-readable storage medium corresponding to the vehicle re-identification method provided in the above embodiment. Figure 6 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the vehicle re-identification method provided in any of the aforementioned embodiments is executed.
[0099] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0100] The computer-readable storage medium provided in the above-mentioned embodiment of the present application and the vehicle re-identification method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application.
Claims
1. A vehicle re-identification method, characterized in that: include: Constructing a re-identification model for vehicle retrieval, the re-identification model comprising a hash coding layer; Training the re-identification model based on training samples; Input the target image including the target vehicle into the trained re-identification model to obtain the hash code data of the target vehicle output by the hash code layer; Inputting the image to be identified including the vehicle to be identified into the trained re-identification model to obtain hash code data of the vehicle to be identified output by the hash coding layer; Comparing the hash code data of the vehicle to be identified with the hash code data of the target vehicle, and obtaining an identification result of the vehicle to be identified according to the comparison result; The constructing of a re-identification model for vehicle retrieval includes: Obtain a pre-trained baseline model; insert a fully connected layer for hash coding linear mapping and a hash coding layer used as an activation function after the baseline model; wherein the baseline model is a neural network model based on deep learning; The recognition process of the re-recognition model is as follows: Input the vehicle image into the baseline model for feature extraction to obtain the vehicle embedding vector; The vehicle embedding vector is sequentially input into the fully connected layer and the hash coding layer to obtain the hash coding data of the vehicle output by the hash coding layer; The loss function L of the re-identification model is the distance matrix D h The cosine distance from D is: Among them, the distance matrix D h represents the distance matrix calculated using the hashed data of the training samples, and the distance matrix D represents the distance matrix calculated using the embedding vectors of the training samples; The loss function L is determined as follows: Input the training samples into the baseline model; Perform batch normalization on the embedding vector output by the baseline model to obtain the processed embedding vector; Input the processed embedding vector into the fully connected layer and the hash coding layer, and output the hash coding data of the training sample; Use the hash code data of the training samples to calculate the distance matrix D between the training samples h , and the distance matrix D h Element d ij Set to 0; where ID(i) = ID(j), indicating different training samples from the same vehicle object; Use the embedding vectors of the training samples to calculate the distance matrix D between the training samples; Calculate the distance matrix D h The cosine distance between L and D is used as the loss function L.
2. The method according to claim 1, characterized in that The hash coding layer adopts a locality sensitive hashing algorithm.
3. The method according to claim 1, characterized in that The training of the re-identification model based on the training samples includes: The weights of the fully connected layer are initialized by Gaussian random variables, and the weights of the hash coding layer are trained based on the loss function L.
4. A vehicle re-identification device, characterized in that: include: A model building module, for building a re-identification model for vehicle retrieval, wherein the re-identification model includes a hash coding layer; A model training module, used for training the re-identification model based on training samples; A first recognition module is used to input a target image including a target vehicle into a trained re-recognition model to obtain hash code data of the target vehicle output by a hash code layer; A second recognition module is used to input the image to be recognized including the vehicle to be recognized into the trained re-recognition model to obtain hash code data of the vehicle to be recognized output by the hash code layer; The comparison module is used to compare the hash code data of the vehicle to be identified with the hash code data of the target vehicle, and obtain the identification result of the vehicle to be identified according to the comparison result. The model building module is specifically used for: Obtain a pre-trained baseline model; insert a fully connected layer for hash coding linear mapping and a hash coding layer used as an activation function after the baseline model; wherein the baseline model is a neural network model based on deep learning; The recognition process of the re-recognition model is as follows: Input the vehicle image into the baseline model for feature extraction to obtain the vehicle embedding vector; The vehicle embedding vector is sequentially input into the fully connected layer and the hash coding layer to obtain the hash coding data of the vehicle output by the hash coding layer; The loss function L of the re-identification model is the distance matrix D h The cosine distance from D is: Among them, the distance matrix D h represents the distance matrix calculated using the hashed data of the training samples, and the distance matrix D represents the distance matrix calculated using the embedding vectors of the training samples; The loss function L is determined as follows: Input the training samples into the baseline model; Perform batch normalization on the embedding vector output by the baseline model to obtain the processed embedding vector; Input the processed embedding vector into the fully connected layer and the hash coding layer, and output the hash coding data of the training sample; Use the hash code data of the training samples to calculate the distance matrix D between the training samples h , and the distance matrix D h Element d ij Set to 0; where ID(i) = ID(j), indicating different training samples from the same vehicle object; Use the embedding vectors of the training samples to calculate the distance matrix D between the training samples; Calculate the distance matrix D h The cosine distance between L and D is used as the loss function L.
5. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Depth neural network training method and device based on Hash coding layer
CN105279554A
Pedestrian re-identification method and device based on deep Hash and computer system
CN109871749A
Automatic driving-oriented vehicle-road cooperative pedestrian re-identification method and automatic driving-oriented vehicle-road cooperative pedestrian re-identification system
CN111460891A
Iris identification method and apparatus
WO2017004926A1
