Model training method, pedestrian re-identification method and device, equipment, medium

By clustering the labelless feature vectors and building a dictionary, labeled feature vectors are used for comparison learning training, which solves the problem that outliers generated by the clustering algorithm cannot be assigned pseudo-labels, and improves the training efficiency and recognition accuracy of the pedestrian re-identification model.

CN114821657BActive Publication Date: 2025-04-29PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210508053.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-04-29
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

In the pedestrian recognition, the prior art cannot assign pseudo-labels due to the outliers generated by the clustering algorithm, resulting in a reduction in training samples and affecting the model training efficiency.

Method used

By clustering the labelless feature vectors, the category vector and outlier vector are obtained, and a category dictionary and outlier dictionary are constructed. The labeled feature vectors are input to the preset original training model for comparison learning and training, and the training data is added.

Benefits of technology

The training efficiency of the model is improved, the outlier samples generated by clustering are retained, and the training data in comparison learning is increased, thereby improving the model's representation ability and recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114821657B_ABST
    Figure CN114821657B_ABST
Patent Text Reader

Abstract

The present embodiment provides a model training method, a pedestrian re-identification method and apparatus, a device, and a medium, which belong to the field of artificial intelligence technology. It includes: obtaining unlabeled images and labeled images; performing feature extraction on unlabeled images to obtain unlabeled feature vectors, and performing feature extraction on labeled images to obtain labeled feature vectors; clustering unlabeled feature vectors to obtain category vectors and outlier vectors; constructing a category dictionary based on the category vector, and constructing an outlier dictionary based on the outlier vector; inputting the labeled feature vectors into the original training model for comparative learning training to obtain a pedestrian re-identification model; the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image. The embodiment disclosed in the present application increases the training data by storing the outlier feature vector in the outlier dictionary and adding it and the category dictionary to the comparative learning training, thereby improving the training efficiency of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model training method, a pedestrian re-identification method and device, equipment, and medium. Background Art

[0002] With the development of artificial intelligence technology, unsupervised person re-identification technology has received more and more attention in the industry. At present, the sample-level labeled feature vectors and outliers are mainly generated through pseudo-labeling methods based on clustering. Since the outliers generated by the clustering algorithm cannot be assigned pseudo-labels, the usual practice is to directly delete these outliers and directly train the model with labeled feature vectors, but this will lead to a large reduction in training samples, thereby affecting the training efficiency of the model. Summary of the invention

[0003] The main purpose of the embodiments disclosed in this application is to propose a model training method, a pedestrian re-identification method and device, equipment, and medium, which can improve the training efficiency of the model.

[0004] To achieve the above-mentioned purpose, the first aspect of the disclosed embodiment of the present application proposes a model training method, which is used to train a pedestrian re-identification model, and includes:

[0005] Acquire original training data; wherein the original training data includes unlabeled images and labeled images;

[0006] Performing feature extraction on the unlabeled image to obtain an unlabeled feature vector, and performing feature extraction on the labeled image to obtain a labeled feature vector;

[0007] Performing clustering processing on the unlabeled feature vector to obtain a category vector and an outlier vector; wherein the category vector is a cluster centroid;

[0008] constructing a category dictionary according to the category vector, and constructing an outlier dictionary according to the outlier vector;

[0009] The labeled feature vector is input into a preset original training model for comparative learning training to obtain the pedestrian re-identification model; wherein the original training model includes the outlier dictionary and the category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image.

[0010] In some embodiments, extracting features from the unlabeled image to obtain an unlabeled feature vector includes:

[0011] Obtain a preset feature extraction model; wherein the feature extraction model includes a convolution layer, a global average pooling layer, a batch standardization layer and a normalization layer;

[0012] Performing convolution processing on the unlabeled image through the convolution layer to obtain a convolution vector;

[0013] Performing average pooling processing on the convolution vector through the global average pooling layer to obtain a pooling vector;

[0014] Performing batch normalization on the pooled vector through the batch normalization layer to obtain a batch normalized vector;

[0015] The batch standard vector is normalized by the normalization layer to obtain the unlabeled feature vector.

[0016] In some embodiments, clustering the unlabeled feature vector to obtain a category vector includes:

[0017] Clustering the unlabeled feature vector according to a preset clustering algorithm to obtain at least one clustering vector;

[0018] The average value of the cluster vectors is calculated to obtain the category vector.

[0019] In some embodiments, the step of inputting the labeled feature vector into a preset original training model for comparative learning training to obtain the person re-identification model includes:

[0020] According to the labeled feature vector, the category vector of the corresponding category is obtained from the category dictionary as a first preliminary feature vector, and the remaining category vectors in the category dictionary are used as second preliminary feature vectors;

[0021] Constructing a positive sample pair according to the labeled feature vector and the first preliminary feature vector;

[0022] Constructing negative sample data according to the outlier vector in the outlier dictionary and the second preliminary feature vector;

[0023] Calculate the contrast loss function of the original training model according to the positive sample pair and the negative sample data to obtain a loss value;

[0024] The model parameters of the original training model are adjusted according to the loss value to train the original training model to obtain the pedestrian re-identification model.

[0025] In some embodiments, after calculating the loss function of the original training model according to the positive sample pair and the negative sample data to obtain the loss value, the method further includes:

[0026] Get the preset momentum update factor;

[0027] According to the labeled feature vector and the momentum update factor, momentum update is performed on the category dictionary or cluster update is performed on the category dictionary to obtain the updated category dictionary.

[0028] A second aspect of the disclosed embodiment of the present application provides a pedestrian re-identification method for generating a target pedestrian image, comprising:

[0029] Obtaining an original pedestrian image to be identified;

[0030] Performing feature extraction on the original pedestrian image to obtain a feature extraction vector;

[0031] Inputting the feature extraction vector into a pedestrian re-identification model; wherein the pedestrian re-identification model includes a category dictionary, and the pedestrian re-identification model is trained according to the training method described in any one of the embodiments of the first aspect of the present application;

[0032] Filtering a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model;

[0033] Generate the corresponding target pedestrian image according to the label feature vector.

[0034] A third aspect of the disclosed embodiments of the present application provides a model training device for training a pedestrian re-identification model, comprising:

[0035] Data acquisition module: used to acquire original training data; wherein the original training data includes unlabeled images and labeled images;

[0036] The first feature extraction module is used to extract features from the unlabeled image to obtain an unlabeled feature vector, and to extract features from the labeled image to obtain a labeled feature vector;

[0037] Clustering module: used for clustering the unlabeled feature vector to obtain a category vector and an outlier vector; wherein the category vector is a cluster centroid;

[0038] A dictionary construction module: used to construct a category dictionary according to the category vector, and to construct an outlier dictionary according to the outlier vector;

[0039] Model training module: used to input the labeled feature vector into a preset original training model for comparative learning training to obtain the pedestrian re-identification model; wherein the original training model includes the outlier dictionary and the category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image.

[0040] A fourth aspect of the disclosed embodiments of the present application provides a pedestrian re-identification device for generating a target pedestrian image, comprising:

[0041] Image acquisition module: used to obtain the original pedestrian image to be identified;

[0042] A second feature extraction module: used to extract features from the original pedestrian image to obtain a feature extraction vector;

[0043] A vector input module: used to input the feature extraction vector into a pedestrian re-identification model; wherein the pedestrian re-identification model includes a category dictionary, and the pedestrian re-identification model is trained according to the training method described in any one of the embodiments of the first aspect of the present application;

[0044] A vector screening module: used for screening out a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model;

[0045] Image generation module: used to generate the corresponding target pedestrian image according to the label feature vector.

[0046] The fifth aspect of the embodiments disclosed in the present application proposes a computer device, which includes a memory and a processor, wherein the memory stores a program, and when the program is executed by the processor, the processor is used to execute the method described in any one of the embodiments of the first aspect of the present application or the method described in any one of the embodiments of the second aspect of the present application.

[0047] The sixth aspect of the embodiments disclosed in the present application proposes a storage medium, which is a computer-readable storage medium, and the storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a method as described in any one of the embodiments of the first aspect of the present application or a method as described in any one of the embodiments of the second aspect of the present application.

[0048] The present application discloses a training method for a model, a pedestrian re-identification method and apparatus, a device, and a medium proposed in an embodiment, by obtaining original training data; wherein the original training data includes unlabeled images and labeled images; extracting features from unlabeled images to obtain unlabeled feature vectors, and extracting features from labeled images to obtain labeled feature vectors, and using the labeled feature vectors for storage to reduce memory space; clustering the unlabeled feature vectors to obtain category vectors and outlier vectors; wherein the category vectors are cluster centroids; constructing a category dictionary based on the category vectors, and constructing an outlier dictionary based on the outlier vectors, which can retain outlier samples generated by clustering and increase training data in contrastive learning; inputting the labeled feature vectors into a preset original training model for contrastive learning training to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian images. The present application discloses an embodiment that stores the outlier feature vectors in the outlier dictionary and adds it and the category dictionary to the contrastive learning training, which can increase training data and thus improve the training efficiency of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a first flow chart of the training method of the model provided in the disclosed embodiment of the present application;

[0050] Figure 2 yes Figure 1 Flow chart of step S120 in FIG.

[0051] Figure 3 yes Figure 1 Flow chart of step S130 in FIG.

[0052] Figure 4 yes Figure 1 Flow chart of step S150 in FIG.

[0053] Figure 5 is a second flow chart of the model training method provided in the disclosed embodiment of the present application;

[0054] Figure 6 is a schematic diagram of a category-instance memory dictionary provided by an embodiment of the present disclosure;

[0055] Figure 7 A flowchart of a pedestrian re-identification method provided in an embodiment disclosed in the present application;

[0056] Figure 8 A module structure diagram of a training device for a model provided in an embodiment disclosed in the present application;

[0057] Fig. 9 A block diagram of the module structure of a pedestrian re-identification device provided in an embodiment disclosed in the present application;

[0058] Fig.10 It is a schematic diagram of the hardware structure of the computer device provided in the embodiment disclosed in this application. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0060] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0062] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0063] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0064] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0065] First, some nouns involved in this application are analyzed:

[0066] Artificial Intelligence (AI): is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science. AI attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0067] Person re-identification (Re-ID): Also known as pedestrian re-identification, it is a technology that uses computer vision technology to determine whether a specific pedestrian exists in an image or video sequence. It is widely considered to be a sub-problem of image retrieval. Given a monitored pedestrian image, retrieve the pedestrian image across devices.

[0068] Unsupervised learning: refers to a machine learning algorithm used to make inferences from a data set consisting of input data without labeled responses. The most common unsupervised learning method is cluster analysis.

[0069] Supervised learning: is a machine learning task that infers a function from a labeled training dataset, which consists of a set of training examples. In supervised learning, each example is a pair consisting of an input object (usually a vector) and a desired output value (also called a supervisory signal).

[0070] Contrastive Learning: It is a type of self-supervised learning that does not rely on manually annotated category label information, but directly uses the data itself as supervision information. Contrastive learning is a method for deep learning models to describe similar and different things. Using contrastive learning methods, machine learning models can be trained to distinguish between similar and different images.

[0071] Pseudo-labeling: Pseudo-labeling technology is a process in which a model trained on labeled data is used to make predictions on unlabeled data, samples are screened based on the prediction results, and then the samples are input into the model again for training.

[0072] Clustering: The process of dividing a collection of physical or abstract objects into multiple classes consisting of similar objects is called clustering. The clusters generated by clustering are a set of data objects that are similar to the objects in the same cluster and different from the objects in other clusters.

[0073] Positive sample pair: includes two samples belonging to the same category.

[0074] Negative sample pair: includes two samples belonging to different categories.

[0075] Hard negative samples: Negative samples that are easily misclassified as positive samples, corresponding to the negative samples with the highest loss during training.

[0076] Outlier: Also known as an outlier, it refers to one or more values ​​in the data that are significantly different from other values.

[0077] Cluster centroid: the center point of a cluster, used to represent the category of the cluster.

[0078] Residual Network (ResNet): This series of networks is widely used in fields such as target classification and as part of the backbone classic neural network for computer vision tasks. Typical networks include ResNet50.

[0079] ImageNet: is a large visualization database used for research in visual object recognition software.

[0080] Global Average Pooling (GAP): Calculate the mean of all pixels in each feature map and output a data value.

[0081] Batch Normalization (BN): The basic idea of ​​batch normalization is to pull the data to near 0 so that the data satisfies the normal distribution with a mean of 0 and a variance of 1.

[0082] Normalization: It is a commonly used data preprocessing method in mathematical statistics. In machine learning, normalization usually maps the data of each dimension of the data vector to the interval between (0,1) or (-1,1) or maps a norm of the data vector to 1.

[0083] L2 norm normalization: A vector X is normalized by L2 norm to obtain vector X2, and another vector Y is normalized by L2 norm to obtain vector Y2. At this time, the Euclidean distance and cosine similarity of X2 and Y2 are equivalent.

[0084] DBSCAN clustering algorithm: The set of samples connected by the maximum density derived from the density-reachable relationship is a category of the final clustering, or a cluster, which can have one or more core objects.

[0085] Momentum update: also known as momentum-based gradient descent, is a method that accelerates the change of the gradient vector in the relevant direction and ultimately achieves accelerated convergence.

[0086] Loss function: A function that maps the value of a random event or its related random variables into a non-negative real number to represent the "risk" or "loss" of the random event.

[0087] With the development of artificial intelligence technology, unsupervised person re-identification technology has received more and more attention in the industry. At present, the sample-level labeled feature vectors and outliers are mainly generated through pseudo-labeling methods based on clustering. Since the outliers generated by the clustering algorithm cannot be assigned pseudo-labels, the usual practice is to directly delete these outliers and directly train the model with labeled feature vectors, but this will lead to a large reduction in training samples, thereby affecting the training efficiency of the model.

[0088] Specifically, in the related art, similar to the dynamic dictionary of contrastive learning in self-supervision, unsupervised person re-identification promotes contrastive unsupervised learning by constructing a memory dictionary. The sample feature vectors stored in the memory dictionary are updated by the query sample features of the same category. The sample-level memory dictionary uses sample features as storage units and stores the feature vectors of all samples of all categories. Outlier samples without labels are deleted. Since the memory is stored in sample-level feature vectors, a larger memory is required for storage. During the training process, the query sample is compared with the sample vector in the memory dictionary, the contrast loss function value is calculated, and the corresponding category of the memory dictionary is updated according to the contrast loss function value. However, since each category contains a different number of samples, this will lead to inconsistent update progress for each category. In addition, the pseudo-label method based on clustering often does not utilize all the training data. Since the outliers generated by the clustering algorithm cannot be assigned pseudo-labels, these outliers are usually deleted directly. However, in the early stage of training, due to the insufficient representation ability of the model, these outliers are often many. Directly discarding them will lead to a large reduction in training samples, which seriously affects the efficiency and effect of model training.

[0089] Based on this, the disclosed embodiment of the present application proposes a model training method, a pedestrian re-identification method and device, equipment, and medium, by obtaining original training data; wherein the original training data includes unlabeled images and labeled images; feature extraction is performed on the unlabeled images to obtain unlabeled feature vectors, and feature extraction is performed on the labeled images to obtain labeled feature vectors, and the method of storing the labeled feature vectors can reduce the memory space; clustering is performed on the unlabeled feature vectors to obtain category vectors and outlier vectors; wherein the category vectors are cluster centroids; a category dictionary is constructed according to the category vectors, and an outlier dictionary is constructed according to the outlier vectors, which can retain the outlier samples generated by clustering and increase the training data in contrastive learning; the labeled feature vectors are input into the preset original training model for contrastive learning training to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian images. The disclosed embodiment of the present application increases the training data by storing the outlier feature vectors in the outlier dictionary and adding it and the category dictionary to the contrastive learning training, thereby improving the training efficiency of the model.

[0090] The embodiments disclosed in the present application provide a model training method, a pedestrian re-identification method and apparatus, a computer device, and a storage medium, which are specifically illustrated by the following embodiments. First, the model training method in the embodiments disclosed in the present application is described.

[0091] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0092] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0093] The present application discloses a model training method and a pedestrian re-identification method provided in an embodiment, which relates to the field of artificial intelligence and also to the field of virtual reality. The model training method and the pedestrian re-identification method provided in an embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, or a smart watch, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the model training method, etc., but is not limited to the above forms.

[0094] The disclosed embodiments of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0095] Reference Figure 1 According to the model training method of the first aspect of the embodiment disclosed in this application, it includes but is not limited to steps S110 to S150.

[0096] Step S110, obtaining original training data;

[0097] Step S120, performing feature extraction on the unlabeled image to obtain an unlabeled feature vector, and performing feature extraction on the labeled image to obtain a labeled feature vector;

[0098] Step S130, clustering the unlabeled feature vector to obtain a category vector and an outlier vector; wherein the category vector is the cluster centroid;

[0099] Step S140, constructing a category dictionary according to the category vector, and constructing an outlier dictionary according to the outlier vector;

[0100] Step S150: input the labeled feature vector into a preset original training model for comparative learning and training to obtain a pedestrian re-identification model.

[0101] In step S110 of some embodiments, original training data is obtained, where the original training data includes unlabeled images and labeled images, unlabeled images refer to images that have not yet been assigned labels, such as images that include pedestrians or images that do not include pedestrians and only include objects, and labeled images refer to images that have been assigned labels.

[0102] In step S120 of some embodiments, feature extraction is performed on the unlabeled image to obtain an unlabeled feature vector, and feature extraction is performed on the labeled image to obtain a labeled feature vector.

[0103] In step S130 of some embodiments, the unlabeled feature vector is clustered to obtain a category vector and an outlier vector; wherein the category vector is the cluster centroid, indicating the center point of the cluster, and is used to represent the category of the cluster; wherein the category vector corresponds to multiple feature vectors of the same category, indicating the category, and the outlier vector is a sample vector that still has no label after clustering processing.

[0104] In step S140 of some embodiments, a category dictionary is constructed based on the category vector, and an outlier dictionary is constructed based on the outlier vector. The embodiment disclosed in the present application uses the category vector to replace all feature vectors for storage, which can reduce memory space. Subsequent updates to a category vector are equivalent to updating an entire category, which can solve the problem of inconsistent update progress. In addition, the embodiment disclosed in the present application retains the outlier vectors generated by clustering and uses them as difficult negative example samples to participate in subsequent loss calculations, which can increase the number of negative examples in contrastive learning and improve the optimization effect.

[0105] In step S150 of some embodiments, the labeled feature vector is input into a preset original training model for comparative learning training until the model converges to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image.

[0106] The training method of the model proposed in the embodiment of the present application is obtained by obtaining original training data; wherein the original training data includes unlabeled images and labeled images; feature extraction is performed on the unlabeled images to obtain unlabeled feature vectors, and feature extraction is performed on the labeled images to obtain labeled feature vectors, and the method of storing the labeled feature vectors can reduce the memory space; clustering is performed on the unlabeled feature vectors to obtain category vectors and outlier vectors; wherein the category vector is the cluster centroid; a category dictionary is constructed according to the category vector, and an outlier dictionary is constructed according to the outlier vector, which can retain the outlier samples generated by clustering and increase the training data in contrastive learning; the labeled feature vector is input into the preset original training model for contrastive learning training to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image. The embodiment of the present application discloses that by storing the outlier feature vector in the outlier dictionary and adding it and the category dictionary to the contrastive learning training, the training data can be increased, thereby improving the training efficiency of the model.

[0107] In some embodiments, Figure 2 As shown, step S120 specifically includes but is not limited to steps S121 to S125.

[0108] Step S121, obtaining a preset feature extraction model;

[0109] Step S122, performing convolution processing on the unlabeled image through a convolution layer to obtain a convolution vector;

[0110] Step S123, performing average pooling processing on the convolution vector through a global average pooling layer to obtain a pooling vector;

[0111] Step S124, performing batch normalization on the pooled vector through a batch normalization layer to obtain a batch normalized vector;

[0112] Step S125, normalizing the batch standard vector through a normalization layer to obtain an unlabeled feature vector.

[0113] In step S121 of some embodiments, a preset feature extraction model is obtained, and the feature extraction model includes a convolution layer, a global average pooling layer, a batch normalization layer, and a normalization layer. In practical applications, ResNet50 can be used as the backbone network of the feature extractor, and the weight parameters pre-trained on ImageNet are used to initialize the feature extraction model. In addition, the pooling layer and the fully connected layer after ResNet50 are removed, and a global average pooling layer, a batch normalization layer, and an L2 normalization layer are added after the convolution layer, so that the feature extraction model finally outputs a 2048-dimensional feature vector to improve the performance of the feature extraction model when performing feature retrieval.

[0114] In step S122 of some embodiments, the unlabeled image is input into the convolution layer of the feature extraction model for convolution processing to obtain a convolution vector.

[0115] In step S123 of some embodiments, the convolution vector is input into the global average pooling layer of the feature extraction model for average pooling processing to obtain a pooling vector.

[0116] In step S124 of some embodiments, the pooled vector is input into a batch normalization layer of a feature extraction model for batch normalization processing to obtain a batch normalized vector.

[0117] In step S125 of some embodiments, the batch standard vector is input into the normalization layer of the feature extraction model for normalization processing to obtain an unlabeled feature vector.

[0118] In some embodiments, Figure 3 As shown, step S130 specifically includes but is not limited to steps S131 to S132.

[0119] Step S131, clustering the unlabeled feature vectors according to a preset clustering algorithm to obtain at least one clustering vector;

[0120] Step S132, calculating the average value of the cluster vectors to obtain the category vector.

[0121] In step S131 of some embodiments, a preset clustering algorithm, such as a DBSCAN clustering algorithm, is obtained, and the unlabeled feature vectors are clustered according to the clustering algorithm to obtain multiple categories, each category including at least one clustering vector.

[0122] In step S132 of some embodiments, the average value of the cluster vectors is calculated to obtain a category vector, which represents a certain category and also represents the centroid of the cluster. All category vectors can be recorded as {c1, c2, ..., c k}, where K is the number of clustering categories.

[0123] It should be noted that the disclosed embodiment of the present application stores the category vectors of all categories in the category dictionary, and stores all clustered outlier samples in the outlier dictionary. In addition, the training data can be re-clustered at intervals of a certain training time or training times, so the number of clustered categories and the number of outlier samples change with the training process.

[0124] In some embodiments, Figure 4 As shown, step S150 specifically includes but is not limited to steps S151 to S155.

[0125] Step S151, obtaining a category vector of a corresponding category from a category dictionary according to the labeled feature vector as a first preliminary feature vector, and taking the remaining category vectors in the category dictionary as second preliminary feature vectors;

[0126] Step S152, constructing a positive sample pair according to the labeled feature vector and the first preliminary feature vector;

[0127] Step S153, constructing negative sample data according to the outlier vector in the outlier dictionary and the second preliminary feature vector;

[0128] Step S154, calculating the contrast loss function of the original training model according to the positive sample pairs and the negative sample data to obtain a loss value;

[0129] Step S155, adjusting the model parameters of the original training model according to the loss value to train the original training model to obtain a pedestrian re-identification model.

[0130] In step S151 of some embodiments, a category vector of a corresponding category is obtained from a category dictionary according to the labeled feature vector as the first preliminary feature vector, and the remaining category vectors in the category dictionary are used as the second preliminary feature vector. Specifically, if the category of the labeled feature vector is category A, a category vector of the same category as category A is obtained from the category dictionary as the first preliminary feature vector, and the remaining category vectors in the category dictionary, that is, category vectors that are not category A, are used as the second preliminary feature vector.

[0131] In step S152 and step S153 of some embodiments, positive sample pairs are constructed based on the labeled feature vector and the first preliminary feature vector; and negative sample data are constructed based on the outlier vector in the outlier dictionary and the second preliminary feature vector.

[0132] In step S154 of some embodiments, the contrast loss function of the original training model is calculated based on the positive sample pairs and the negative sample data to obtain a loss value. The contrast loss function used in the embodiments disclosed in the present application may be an InfoNCE loss function, as shown in formula (1):

[0133]

[0134] Among them, q is the labeled vector of the query sample, c + is the centroid of the cluster that belongs to the same label or category as q, x j is the outlier sample feature, and τ is the temperature hyperparameter. + It and q form a positive sample pair, and the remaining K-1 cluster centroids and outlier samples are used as negative samples. i represents an integer between 0 and K, and j represents an integer between 0 and N.

[0135] In step S155 of some embodiments, the model parameters of the original training model are adjusted according to the loss value to train the original training model until the contrast loss function tends to be stable, and the pedestrian re-identification model is obtained after the model converges.

[0136] The disclosed embodiment of the present application uses category-level feature vectors instead of sample-level storage to reduce memory space. At the same time, each update is equivalent to updating an entire category, which solves the problem of inconsistent update progress. In addition, the outlier samples generated by clustering are retained and used as hard negative sample samples to participate in loss calculation, which increases the number of negative examples in contrastive learning and improves the optimization effect.

[0137] In some embodiments, Figure 5 As shown, between step S154 and step S155, the training method of the model of the embodiment disclosed in the present application specifically also includes but is not limited to steps S210 to S220.

[0138] Step S210, obtaining a preset momentum update factor;

[0139] Step S220 , performing momentum update on the category dictionary or clustering update on the category dictionary according to the labeled feature vector and the momentum update factor, to obtain an updated category dictionary.

[0140] In step S210 of some embodiments, after calculating the loss value, the category dictionary is updated using the query sample, that is, using the labeled feature vector, and firstly, the momentum update factor m needs to be obtained.

[0141] In step S220 of some embodiments, momentum update is performed on the category dictionary or cluster update is performed on the category dictionary according to the labeled feature vector and the momentum update factor to obtain an updated category dictionary. Taking momentum update as an example, the embodiment disclosed in this application adopts formula (2) for momentum update, and the process is as follows:

[0142] c + ←m·c + +(1-m)·q(2)

[0143] Where m is a momentum update factor. In the disclosed embodiment, the update method of the category dictionary can be performed alternately using momentum update and cluster update, which can further improve the efficiency of model training. Specifically, after each training, the centroids of clusters with the same label in the category dictionary are updated with momentum using labeled feature vectors. After multiple trainings, the feature extraction model with updated parameters can be used to re-extract features from all unlabeled training data, and then the feature vectors are re-clustered using a clustering algorithm to obtain a new category dictionary and outlier dictionary.

[0144] In some embodiments, the process of the testing phase is: extracting the trained feature extraction model into a test set, including image features in labeled images and unlabeled images, using labeled images to retrieve feature vectors of pedestrians with the same identity in unlabeled images, and for each labeled image, finding the top k images similar to it in the unlabeled images, and according to the returned sorted list, there are the number n of retrieval targets in the top k positions, calculating the hit rate, and judging whether the model meets the expected requirements based on the hit rate.

[0145] The calculation formula (3) is specifically:

[0146]

[0147] Among them, rank represents a ranking function, which is used to find the ranking of a certain value in a certain area, that is, to return the ranking of a number in a list of numbers, for example, to return the ranking of n in k. Rank-k represents the hit rate of the number n of search targets in the first k positions.

[0148] The training method of the model proposed in the embodiment of the present application is obtained by obtaining original training data; wherein the original training data includes unlabeled images and labeled images; feature extraction is performed on the unlabeled images to obtain unlabeled feature vectors, and feature extraction is performed on the labeled images to obtain labeled feature vectors, and the method of storing the labeled feature vectors can reduce the memory space; clustering is performed on the unlabeled feature vectors to obtain category vectors and outlier vectors; wherein the category vector is the cluster centroid; a category dictionary is constructed according to the category vector, and an outlier dictionary is constructed according to the outlier vector, which can retain the outlier samples generated by clustering and increase the training data in contrastive learning; the labeled feature vector is input into the preset original training model for contrastive learning training to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image. The embodiment of the present application discloses that by storing the outlier feature vector in the outlier dictionary and adding it and the category dictionary to the contrastive learning training, the training data can be increased, thereby improving the training efficiency of the model.

[0149] In some embodiments, Figure 6 As shown, the training process of the model in the embodiment disclosed in the present application is as follows: clustering the training data to obtain cluster samples, wherein the cluster samples include multiple categories ( Figure 6The same pattern in the cluster represents the same category); the category dictionary is initialized in the cluster samples, and the average value of the feature vectors of all samples in the category is taken for storage; at the same time, the outlier samples are initialized, that is, stored in the outlier dictionary; the query sample is input into the feature extractor f for feature extraction to obtain the vector q, and the category dictionary or the outlier dictionary is updated by comparing and learning the vector q, the category dictionary and the outlier dictionary, which is beneficial to the optimization of the model.

[0150] The disclosed embodiments of the present application are mainly aimed at improving the clustering-based pseudo-labeling method in unsupervised pedestrian re-identification, designing a category-instance memory dictionary, improving the problem of inconsistent updates of its memory dictionary, reducing storage memory, and using additional clustered outlier samples to optimize the training model. Through the above improvements, the model is effectively promoted to perform unsupervised comparative learning, and the representation ability of the model is significantly improved. The unsupervised pedestrian re-identification algorithm designed in this application has high recognition accuracy and good applicability, and can be applied to pedestrian re-identification in actual scenarios.

[0151] Reference Figure 7 The disclosed embodiment of the present application also provides a pedestrian re-identification method for generating a target pedestrian image, which specifically includes but is not limited to steps S310 to S350.

[0152] Step S310, obtaining an original pedestrian image to be identified;

[0153] Step S320, extracting features from the original pedestrian image to obtain a feature extraction vector;

[0154] Step S330, inputting the feature extraction vector into a pedestrian re-identification model;

[0155] Step S340, filtering out a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model;

[0156] Step S350: Generate a corresponding target pedestrian image according to the label feature vector.

[0157] In step S310 of some embodiments, an original pedestrian image to be identified is obtained.

[0158] In step S320 of some embodiments, feature extraction is performed on the original pedestrian image to obtain a feature extraction vector; specifically, feature extraction can be performed on the original pedestrian image through a feature extraction model to obtain a feature extraction vector.

[0159] In step S330 of some embodiments, the feature extraction vector is input into a person re-identification model, wherein the person re-identification model includes a category dictionary.

[0160] In step S340 of some embodiments, a pedestrian re-identification model is used to match a corresponding label feature vector from a category dictionary according to the feature extraction vector; wherein the pedestrian re-identification model is trained according to the training method of the embodiment of the first aspect of the present application;

[0161] In step S350 of some embodiments, a corresponding target pedestrian image is generated according to the label feature vector.

[0162] The disclosed embodiment of the present application also provides a model training device for training a pedestrian re-identification model, such as Figure 8 As shown, the training method of the above-mentioned model can be implemented, and the device includes: a data acquisition module 410, a first feature extraction module 420, a clustering module 430, a dictionary construction module 440 and a model training module 450; the data acquisition module 410 is used to obtain original training data; wherein the original training data includes unlabeled images and labeled images; the first feature extraction module 420 is used to extract features from unlabeled images to obtain unlabeled feature vectors, and to extract features from labeled images to obtain labeled feature vectors; the clustering module 430 is used to cluster the unlabeled feature vectors to obtain category vectors and outlier vectors; wherein the category vector is the cluster centroid; the dictionary construction module 440 is used to construct a category dictionary according to the category vector, and to construct an outlier dictionary according to the outlier vector; the model training module 450 is used to input the labeled feature vector into a preset original training model for comparative learning training to obtain a pedestrian re-identification model; wherein the original training model includes an outlier dictionary and a category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image.

[0163] The model training device of the embodiment disclosed in the present application is used to execute the model training method in the above embodiment. Its specific processing process is the same as the model training method in the above embodiment, and will not be repeated here.

[0164] The disclosed embodiment of the present application also provides a pedestrian re-identification device for generating a target pedestrian image, such as Fig. 9As shown, the above-mentioned pedestrian re-identification method can be implemented, and the device includes: an image acquisition module 510, a second feature extraction module 520, a vector input module 530, a vector screening module 540 and an image generation module 550; the image acquisition module 510 is used to acquire the original pedestrian image to be identified; the second feature extraction module 520 is used to extract features from the original pedestrian image to obtain a feature extraction vector; the vector input module 530 is used to input the feature extraction vector into the pedestrian re-identification model; wherein the pedestrian re-identification model includes a category dictionary, and the pedestrian re-identification model is trained according to the training method of any one of the embodiments of the first aspect of the present application; the vector screening module 540 is used to filter out a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model; the image generation module 550 is used to generate a corresponding target pedestrian image according to the label feature vector.

[0165] The pedestrian re-identification device of the embodiment disclosed in the present application is used to execute the pedestrian re-identification method in the above embodiment. Its specific processing process is the same as the pedestrian re-identification method in the above embodiment, and will not be repeated here.

[0166] The disclosed embodiment of the present application also provides a computer device, including:

[0167] at least one processor, and

[0168] a memory communicatively connected to at least one processor; wherein,

[0169] The memory stores instructions, and the instructions are executed by at least one processor so that when the at least one processor executes the instructions, a method as in any one of the embodiments of the first aspect of the present application or the embodiments of the second aspect of the present application is implemented.

[0170] Combine the following Fig.10 The hardware structure of the computer device is described in detail. The computer device includes: a processor 610 , a memory 620 , an input / output interface 630 , a communication interface 640 and a bus 650 .

[0171] The processor 610 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided by the embodiments disclosed in this application;

[0172] The memory 620 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory 620 can store operating systems and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 620, and the processor 610 calls and executes the training method of the model of the embodiment disclosed in this application or executes the pedestrian re-identification method of the embodiment disclosed in this application;

[0173] Input / output interface 630, used to implement information input and output;

[0174] Communication interface 640, used to realize communication interaction between the device and other devices, which can be realized by wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.); and

[0175] bus 650 , which transmits information between the various components of the device (e.g., processor 610 , memory 620 , input / output interface 630 , and communication interface 640 );

[0176] The processor 610 , the memory 620 , the input / output interface 630 , and the communication interface 640 are connected to each other in communication within the device via a bus 650 .

[0177] The embodiments disclosed in the present application also provide a storage medium, which is a computer-readable storage medium, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the model training method of the embodiments disclosed in the present application or execute the pedestrian re-identification method of the embodiments disclosed in the present application.

[0178] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0179] The present application discloses a model training method, a model training device, a pedestrian re-identification method, a pedestrian re-identification device, a computer device, and a storage medium provided in an embodiment. The method comprises acquiring an unlabeled image and a labeled image; performing feature extraction on the unlabeled image to obtain an unlabeled feature vector, and performing feature extraction on the labeled image to obtain a labeled feature vector. The memory space can be reduced by storing the labeled feature vector; clustering the unlabeled feature vector to obtain a category vector and an outlier vector; constructing a category dictionary according to the category vector, and constructing an outlier dictionary according to the outlier vector, so as to retain the outlier samples generated by clustering and increase the training data in contrastive learning; inputting the labeled feature vector into a preset original training model for contrastive learning training to obtain a pedestrian re-identification model. By storing the outlier feature vector in the outlier dictionary and adding it and the category dictionary to the contrastive learning training, the training data can be increased, thereby improving the training efficiency of the model, improving the training effect of the model, and improving the accuracy of pedestrian re-identification.

[0180] The embodiments described in the embodiments disclosed in this application are intended to more clearly illustrate the technical solutions of the embodiments disclosed in this application, and do not constitute a limitation on the technical solutions provided by the embodiments disclosed in this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments disclosed in this application are equally applicable to similar technical problems.

[0181] It can be understood by those skilled in the art that Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 and Figure 7 The technical solutions shown in the figure do not constitute a limitation on the embodiments disclosed in the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.

[0182] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0183] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0184] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0185] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0186] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0187] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0188] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0190] The preferred embodiments of the embodiments disclosed in the present application are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments disclosed in the present application is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments disclosed in the present application shall be within the scope of the rights of the embodiments disclosed in the present application.

Claims

1. A model training method, characterized in that: The training method is used to train a person re-identification model, and includes: Acquire original training data; wherein the original training data includes unlabeled images and labeled images; Performing feature extraction on the unlabeled image to obtain an unlabeled feature vector, and performing feature extraction on the labeled image to obtain a labeled feature vector; Performing clustering processing on the unlabeled feature vector to obtain a category vector and an outlier vector; wherein the category vector is a cluster centroid; constructing a category dictionary according to the category vector, and constructing an outlier dictionary according to the outlier vector; Inputting the labeled feature vector into a preset original training model for comparative learning training to obtain the pedestrian re-identification model; wherein the original training model includes the outlier dictionary and the category dictionary, and the pedestrian re-identification model is used to identify the original pedestrian image; The step of inputting the labeled feature vector into a preset original training model for comparative learning training to obtain the pedestrian re-identification model includes: According to the labeled feature vector, the category vector of the corresponding category is obtained from the category dictionary as a first preliminary feature vector, and the remaining category vectors in the category dictionary are used as second preliminary feature vectors; Constructing a positive sample pair according to the labeled feature vector and the first preliminary feature vector; Constructing negative sample data according to the outlier vector in the outlier dictionary and the second preliminary feature vector; Calculate the contrast loss function of the original training model according to the positive sample pair and the negative sample data to obtain a loss value; Adjusting the model parameters of the original training model according to the loss value to train the original training model to obtain the pedestrian re-identification model; Wherein, after calculating the loss function of the original training model according to the positive sample pair and the negative sample data to obtain the loss value, the method further includes: Get the preset momentum update factor; According to the labeled feature vector and the momentum update factor, momentum update is performed on the category dictionary or cluster update is performed on the category dictionary to obtain the updated category dictionary.

2. The training method according to claim 1, characterized in that: The step of extracting features from the unlabeled image to obtain an unlabeled feature vector includes: Obtain a preset feature extraction model; wherein the feature extraction model includes a convolution layer, a global average pooling layer, a batch standardization layer and a normalization layer; Performing convolution processing on the unlabeled image through the convolution layer to obtain a convolution vector; Performing average pooling processing on the convolution vector through the global average pooling layer to obtain a pooling vector; Performing batch normalization on the pooled vector through the batch normalization layer to obtain a batch normalized vector; The batch standard vector is normalized by the normalization layer to obtain the unlabeled feature vector.

3. The training method according to claim 1, characterized in that: The clustering process is performed on the unlabeled feature vector to obtain a category vector, including: Clustering the unlabeled feature vector according to a preset clustering algorithm to obtain at least one clustering vector; The average value of the cluster vectors is calculated to obtain the category vector.

4. A pedestrian re-identification method, characterized in that: Used to generate target pedestrian images, including: Obtaining an original pedestrian image to be identified; Performing feature extraction on the original pedestrian image to obtain a feature extraction vector; Inputting the feature extraction vector into a pedestrian re-identification model; wherein the pedestrian re-identification model includes a category dictionary, and the pedestrian re-identification model is trained according to the training method according to any one of claims 1 to 3; Filtering a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model; Generate the corresponding target pedestrian image according to the label feature vector.

5. A model training device, characterized in that: The training device is used to train a pedestrian re-identification model, including: Data acquisition module: used to acquire original training data; wherein the original training data includes unlabeled images and labeled images; The first feature extraction module is used to extract features from the unlabeled image to obtain an unlabeled feature vector, and to extract features from the labeled image to obtain a labeled feature vector; Clustering module: used for clustering the unlabeled feature vector to obtain a category vector and an outlier vector; wherein the category vector is a cluster centroid; A dictionary construction module: used to construct a category dictionary according to the category vector, and to construct an outlier dictionary according to the outlier vector; Model training module: used for inputting the labeled feature vector into a preset original training model for comparative learning training to obtain the pedestrian re-identification model; wherein the original training model includes the outlier dictionary and the category dictionary, and the pedestrian re-identification model is used for identifying the original pedestrian image; The model training module is used to input the labeled feature vector into a preset original training model for comparative learning training to obtain the pedestrian re-identification model, including: According to the labeled feature vector, the category vector of the corresponding category is obtained from the category dictionary as a first preliminary feature vector, and the remaining category vectors in the category dictionary are used as second preliminary feature vectors; Constructing a positive sample pair according to the labeled feature vector and the first preliminary feature vector; Constructing negative sample data according to the outlier vector in the outlier dictionary and the second preliminary feature vector; Calculate the contrast loss function of the original training model according to the positive sample pair and the negative sample data to obtain a loss value; Adjusting the model parameters of the original training model according to the loss value to train the original training model to obtain the pedestrian re-identification model; Wherein, after calculating the loss function of the original training model according to the positive sample pair and the negative sample data to obtain the loss value, the device is further used for: Get the preset momentum update factor; According to the labeled feature vector and the momentum update factor, momentum update is performed on the category dictionary or cluster update is performed on the category dictionary to obtain the updated category dictionary.

6. A pedestrian re-identification device, characterized in that: Used to generate target pedestrian images, including: Image acquisition module: used to obtain the original pedestrian image to be identified; A second feature extraction module: used to extract features from the original pedestrian image to obtain a feature extraction vector; A vector input module: used for inputting the feature extraction vector into a pedestrian re-identification model; wherein the pedestrian re-identification model includes a category dictionary, and the pedestrian re-identification model is trained according to the training method according to any one of claims 1 to 3; A vector screening module: used for screening out a label feature vector corresponding to the feature extraction vector from the category dictionary through the pedestrian re-identification model; Image generation module: used to generate the corresponding target pedestrian image according to the label feature vector.

7. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is used to execute: The training method according to any one of claims 1 to 3; or The pedestrian re-identification method as claimed in claim 4.

8. A storage medium, the storage medium being a computer-readable storage medium, characterized in that: The computer readable storage device contains a computer program, and when the computer program is executed by a computer, the computer is used to perform: The training method according to any one of claims 1 to 3; or The pedestrian re-identification method as claimed in claim 4.

Citation Information

Patent Citations

  • Unsupervised pedestrian re-identification method for enhancing sample data

    CN111832511A

  • Pedestrian re-identification model training method and device based on active learning

    CN111967429A