Pedestrian re-identification method, device, equipment and storage medium based on self-supervised learning
Through self-supervised learning and data augmentation technology, the problem of improving the accuracy of pedestrian re-identification model is solved due to the small data set, and a higher pedestrian re-identification accuracy and simplified model deployment is achieved.
Patent Information
- Application Number
- CN202210168277.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-23
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-02-23
AI Technical Summary
Due to the small number of training data sets, the existing pedestrian recognition technology cannot improve the model accuracy, which hinders the practicality of pedestrian recognition technology.
Using a self-supervised learning method, the training data set after data augmentation is trained through the same neural network, so that the model can learn the prior laws of the image itself, thereby improving the accuracy of pedestrian re-identification and solving the difficulty of training data acquisition. question.
The recognition accuracy of pedestrian re-identification is improved, the problem of insufficient number of training data sets is overcome, and the complexity of the model is not increased in actual deployment.
Smart Images

Figure CN114529946B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a pedestrian re-identification method, device, equipment and storage medium based on self-supervised learning. Background Art
[0002] Person re-identification is a technology that uses computer vision technology to determine whether a specific target exists in an image or video sequence. At present, person re-identification technologies mainly include representation learning, metric learning, and methods based on local features or video sequences. Unlike face recognition, which can directly crawl celebrity pictures from the Internet, due to the particularity of the task, the training data set collection and labeling of these person re-identification methods are difficult, and the existing data sets can often only reach the level of tens of thousands. On the one hand, the small number of training data sets makes it impossible to further improve the accuracy of person re-identification methods. On the other hand, even if the smaller training data sets are merged in training, it may not necessarily form a positive contribution. These have hindered the further practical application of person re-identification technology. Summary of the invention
[0003] In view of this, an object of one or more embodiments of the present invention is to propose a pedestrian re-identification method, apparatus, device and storage medium based on self-supervised learning to solve at least one of the above problems.
[0004] Based on the above purpose, according to a first aspect of the present invention, a pedestrian re-identification method based on self-supervised learning is provided, comprising:
[0005] Acquire image data to be recognized;
[0006] Performing person re-identification on the image data to be identified based on the trained person re-identification model to obtain a person re-identification result;
[0007] Among them, the training of the trained pedestrian re-identification model includes:
[0008] Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set;
[0009] Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set;
[0010] Calculate a first loss function based on the first eigenvector and the second eigenvector;
[0011] The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
[0012] Optionally, calculating a first loss function based on the first eigenvector and the second eigenvector includes:
[0013] Among them, C i,j represents the mutual correlation coefficient between the i-th sample from the first training data set and the j-th sample from the second training data set, i=j indicates that the j-th sample is a data enhancement sample of the i-th sample, and λ is a weight factor.
[0014] Optionally, the mutual correlation coefficient includes:
[0015] Where m is the number of samples in the first training data set, T A m,i represents the first output feature vector corresponding to the i-th sample, T B m,j Represents the second output feature vector corresponding to the j-th sample.
[0016] Optionally, the second loss function includes: a difficult sample sampling triplet loss function and a classification loss function of the first neural network.
[0017] Optionally, the overall loss of the first neural network includes the sum of the first loss function and the second loss function, specifically including:
[0018] L total =α·L self-sup +β·L triHard +γ·L softmax , where α, β, γ are given parameters, L self-sup is the first loss function, L triHard is the triplet loss function of the first neural network for difficult sample sampling, L softmax is the classification loss function of the first neural network.
[0019] Optionally, the difficult sample sampling triplet loss function includes:
[0020] For each training batch in the first training data set, randomly select P target pedestrians with IDs, and randomly select K different pictures for each target pedestrian, so a training batch contains P×K pictures;
[0021] For each image a in the training batch, select the most difficult positive sample and the most difficult negative sample to form a triple with a;
[0022] Define the picture set with the same ID as a as A, and the picture set formed by the remaining pictures with different IDs as B, then the difficult sample sampling triple loss function includes:
[0023]
[0024] Among them, α is a manually set threshold parameter. The Euclidean distance between image a and each image in the training batch in the feature space is calculated, and then the positive sample p with the farthest distance from a and the negative sample n with the closest distance are selected to calculate the triplet loss.
[0025] Optionally, the enhancement processing includes: spatial domain enhancement and / or frequency domain enhancement.
[0026] According to a second aspect of the present invention, a pedestrian re-identification device based on self-supervised learning is provided, comprising:
[0027] An acquisition module, used for acquiring image data to be identified;
[0028] A recognition module, used for performing pedestrian re-recognition on the image data to be recognized based on a trained pedestrian re-recognition model to obtain a pedestrian re-recognition result;
[0029] Among them, the training of the trained pedestrian re-identification model includes:
[0030] Obtaining first output data based on a data training set and a preset teacher model set corresponding to the data training set;
[0031] Training the neural network based on the data training set to obtain a student model and second output data output by the student model;
[0032] Calculating a loss function of the student model based on the first output data, the second output data, and a discriminator network;
[0033] The model parameters of the student model are adjusted to minimize the loss function, thereby obtaining the trained person re-identification model.
[0034] According to a third aspect of the present invention, there is provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0035] According to a fourth aspect of the present invention, a non-transitory computer-readable storage medium is provided, characterized in that the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in the first aspect.
[0036] From the above description, it can be seen that the pedestrian re-identification method, device, equipment and storage medium based on self-supervised learning provided by one or more embodiments of the present invention use the same neural network as a self-supervised training branch to train the training data set based on data enhancement, so that the pedestrian re-identification model can learn the inherent prior laws of the image itself, thereby improving the accuracy of pedestrian re-identification and solving the problem of difficulty in collecting training data. In the actual deployment environment, there is no need to deploy a network with a self-supervised training branch, which will not bring additional model complexity to the pedestrian re-identification network. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate one or more embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only one or more embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 is a schematic flow chart of a pedestrian re-identification method based on self-supervised learning according to an embodiment of the present invention;
[0039] Figure 2 is a schematic example of a pedestrian re-identification method based on self-supervised learning according to an embodiment of the present invention;
[0040] Figure 3 is a schematic block diagram of a pedestrian re-identification device based on self-supervised learning according to an embodiment of the present invention;
[0041] Figure 4 A schematic block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0043] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in one or more embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0044] Due to the unfavorable conditions and interference factors in actual applications, such as no frontal face, posture changes, occlusion, shooting angle, environmental changes, light differences, etc., it is difficult to collect training data sets for pedestrian re-identification tasks, and they can often only reach the level of tens of thousands. The small amount of training data restricts the training of pedestrian re-identification models and cannot further improve the accuracy of the models, which also hinders the further practical application of pedestrian re-identification technology. Therefore, how to overcome the difficulties in data collection to improve the training accuracy of pedestrian re-identification has become an urgent problem to be solved.
[0045] The inherent prior laws in images can be effectively utilized to allow computers to accomplish seemingly impossible tasks, such as automatically coloring images by utilizing the intrinsic correlation between object categories and color distribution, and restoring images by utilizing the correlation between object categories and shape textures.
[0046] In order to effectively improve the problem of insufficient training samples caused by difficulties in data collection, the present invention proposes to perform person re-identification training based on self-supervised learning to improve the recognition accuracy of person re-identification.
[0047] Based on the above considerations, an embodiment of the present invention provides a pedestrian re-identification method based on self-supervised learning. Figure 1 , Figure 1 FIG. 2 shows a schematic flow chart of a pedestrian re-identification method based on self-supervised learning according to an embodiment of the present invention. Figure 1 As shown in Figure 2, the pedestrian re-identification method based on self-supervised learning includes:
[0048] Step S110, obtaining image data to be identified;
[0049] Step S120, performing person re-identification on the image data to be identified based on the trained person re-identification model to obtain a person re-identification result;
[0050] Among them, the training of the trained pedestrian re-identification model includes:
[0051] Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set;
[0052] Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set;
[0053] Calculate a first loss function based on the first eigenvector and the second eigenvector;
[0054] The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
[0055] Among them, the training data set and the training data set after data enhancement are respectively subjected to feature extraction using the same neural network to obtain the first eigenvector and the second eigenvector, and the first loss function between the first eigenvector and the second eigenvector is calculated, and then the overall loss function in the training process is calculated in combination with the second loss function during the model's own training, and the pedestrian re-identification model is obtained by training with the goal of minimizing the overall loss function. This embodiment uses the same neural network as a self-supervised training branch to train the training data set based on data enhancement, so that the pedestrian re-identification model can learn the inherent prior laws of the image itself, thereby improving the accuracy of pedestrian re-identification and solving the problem of difficulty in collecting training data. In the actual deployment environment, there is no need to deploy a network with a self-supervised training branch, and no additional model complexity is brought to the pedestrian re-identification network. It can be widely used in various scenarios where pedestrian re-identification is required.
[0056] Optionally, in step S110, image data to be identified is obtained.
[0057] The image data to be identified may be real-time data directly acquired by an image acquisition device, or may be image data acquired from a local data source or a remote data source.
[0058] In some embodiments, the image data to be identified may include video data and images. In some embodiments, the image data to be identified may be one frame of image or multiple frames of image in the video data. In some embodiments, the video data may be framed to obtain the image data. In some embodiments, the image data to be identified may also be a continuous or discontinuous sequence of images.
[0059] Optionally, in step S120, person re-identification is performed on the image data to be identified based on a trained person re-identification model to obtain a person re-identification result.
[0060] Specifically, the image data to be identified may be input into a trained person re-identification model, and the trained person re-identification model performs corresponding processing on the image data to be identified and outputs the person re-identification result.
[0061] In some embodiments, the pedestrian re-identification result may include: identity information of the target object, such as ID number, name, etc.
[0062] In some embodiments, the training of the trained person re-identification model includes:
[0063] Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set;
[0064] Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set;
[0065] Calculate a first loss function based on the first eigenvector and the second eigenvector;
[0066] The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
[0067] In some embodiments, the enhancement processing may include: spatial domain enhancement. In some embodiments, spatial domain enhancement may include at least one of the following: grayscale change, histogram correction method, image smoothing, image sharpening. In some embodiments, grayscale change may include at least one of the following: linear change, piecewise linear change or nonlinear change (such as logarithmic transformation, exponential transformation, etc.). In some embodiments, image smoothing may include at least one of the following: mean filtering, median filtering, over-limit pixel smoothing, grayscale K nearest neighbor averaging, maximum uniformity smoothing or selective edge-preserving smoothing. In some embodiments, image sharpening may include at least one of the following: gradient sharpening, Laplace transformation, high-pass filtering.
[0068] In some embodiments, the enhancement processing may include: frequency domain enhancement. In some embodiments, frequency domain enhancement may include at least one of the following: high pass filtering, low pass filtering, homomorphic filtering enhancement, color enhancement (eg, false color enhancement or pseudo color enhancement).
[0069] In some embodiments, calculating a first loss function based on the first feature vector and the second feature vector includes:
[0070] Among them, C i,j represents the mutual correlation coefficient between the i-th sample from the first training data set and the j-th sample from the second training data set, i=j indicates that the j-th sample is a data enhancement sample of the i-th sample, and λ is a weight factor.
[0071] In some embodiments, the cross-correlation coefficients may include:
[0072] Where m is the number of samples in the first training data set, T A m,i represents the first output feature vector corresponding to the i-th sample, T B m,j Represents the second output feature vector corresponding to the j-th sample.
[0073] In some embodiments, the second loss function includes: a difficult sample sampling triplet loss function and a classification loss function of the first neural network.
[0074] The calculation of the triplet loss function with batch hard mining (TriHard loss) can include: for each training batch in the first training data set, randomly select P target pedestrians with IDs, and randomly select K different pictures for each target pedestrian, that is, a training batch contains P×K pictures. Then, for each picture a in the training batch, select the most difficult positive sample and the most difficult negative sample to form a triplet with a. The picture set with the same ID as a can be defined as A, and the picture set formed by the remaining pictures with different IDs is B, then TriHard loss can be expressed as:
[0075]
[0076] Among them, α is a manually set threshold parameter. The Euclidean distance between image a and each image in the training batch in the feature space is calculated, and then the positive sample p with the farthest distance (least similar) to a and the negative sample n with the closest distance (most similar) are selected to calculate the triplet loss.
[0077] The classification loss function can include the SoftMax loss function L softmax , those skilled in the art know how to calculate this function, which will not be described in detail here.
[0078] In some embodiments, the overall loss of the first neural network may include the sum of the first loss function and the second loss function, specifically including:
[0079] L total =α·L self-sup +β·L triHard +γ·L softmax , where α, β, and γ are given parameters.
[0080] In some embodiments, Figure 2 As shown, Figure 2 A schematic example of a pedestrian re-identification method based on self-supervised learning according to an embodiment of the present invention is shown. Figure 2 In the example, the second neural network 210 as the self-supervisory branch is consistent with the backbone network of the recognition part, that is, the first neural network 220, except that the input data is randomly enhanced. The goal of the self-supervisory branch is to identify different perspectives a, b (corresponding to X A ,X B , where X A is the original data, X B For X AThe feature vector T extracted by the same network structure under the data after the enhanced data A , T B The diagonal elements of the cross-correlation matrix C between the two should be as close to 1 as possible, and the remaining elements should be as close to 0 as possible, thereby calculating the first loss function. The first neural network 220 can be set to f, and its model parameter is θ. For the input X of different perspectives of the training data set X A ,X B The corresponding output feature is T A =f θ (X A ), T B =f θ (X B ), we can get the cross-correlation matrix C, and then get the first loss function L self-sup Then, combined with the triple loss function L of the difficult sample sampling of the recognition part triHard And the classification loss function L softmax The overall loss is obtained. The minimization of the overall loss is used as the training goal of the student model for training, and a trained person re-identification model can be obtained.
[0081] It should be noted that the method of one or more embodiments of the present invention may be performed by a single device, such as a computer or server. The method of this embodiment may also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices may only perform one or more steps in the method of one or more embodiments of the present invention, and the multiple devices may interact with each other to complete the described method.
[0082] It should be noted that the above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0083] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, one or more embodiments of the present invention further provide a pedestrian re-identification device based on self-supervised learning.
[0084] refer to Figure 3 , the pedestrian re-identification device based on self-supervised learning includes:
[0085] An acquisition module, used for acquiring image data to be identified;
[0086] A recognition module, used for performing pedestrian re-recognition on the image data to be recognized based on a trained pedestrian re-recognition model to obtain a pedestrian re-recognition result;
[0087] Among them, the training of the trained pedestrian re-identification model includes:
[0088] Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set;
[0089] Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set;
[0090] Calculate a first loss function based on the first eigenvector and the second eigenvector;
[0091] The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
[0092] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more embodiments of the present invention, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0093] The device of the above embodiment is used to implement the corresponding pedestrian re-identification method based on self-supervised learning in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0094] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, one or more embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the self-supervised learning-based pedestrian re-identification method described in any of the above embodiments is implemented.
[0095] Figure 4 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 410, a memory 420, an input / output interface 430, a communication interface 440, and a bus 450. The processor 410, the memory 420, the input / output interface 430, and the communication interface 440 are connected to each other through the bus 450 in the device.
[0096] The processor 410 can 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 of the present invention.
[0097] The memory 420 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 420 may store an operating system and other application programs. When the technical solution provided by the embodiment of the present invention is implemented by software or firmware, the relevant program code is stored in the memory 420 and is called and executed by the processor 410.
[0098] The input / output interface 430 is used to connect the input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0099] The communication interface 440 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0100] The bus 450 comprises a pathway for transmitting information between the various components of the device (eg, the processor 410, the memory 420, the input / output interface 430, and the communication interface 440).
[0101] It should be noted that, although the above device only shows the processor 410, the memory 420, the input / output interface 430, the communication interface 440 and the bus 450, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present invention, and does not necessarily include all the components shown in the figure.
[0102] The electronic device of the above embodiment is used to implement the corresponding pedestrian re-identification method based on self-supervised learning in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0103] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, one or more embodiments of the present invention also provide a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the pedestrian re-identification method based on self-supervised learning as described in any of the above embodiments.
[0104] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media 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 memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0105] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the pedestrian re-identification method based on self-supervised learning as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0106] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention (including the claims) is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present invention as described above, which are not provided in detail for the sake of simplicity.
[0107] In addition, to simplify the description and discussion, and in order not to obscure one or more embodiments of the present invention, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the devices may be shown in the form of block diagrams to avoid obscuring one or more embodiments of the present invention, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which one or more embodiments of the present invention will be implemented (i.e., these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present invention, it will be apparent to those skilled in the art that one or more embodiments of the present invention may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0108] Although the invention has been described in conjunction with specific embodiments of the invention, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0109] One or more embodiments of the present invention are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present invention should be included in the protection scope of the present invention.
Claims
1. A pedestrian re-identification method based on self-supervised learning, characterized in that: include: Acquire image data to be recognized; Performing person re-identification on the image data to be identified based on the trained person re-identification model to obtain a person re-identification result; Among them, the training of the trained pedestrian re-identification model includes: Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set; Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set; Calculating a first loss function based on the first eigenvector and the second eigenvector, wherein calculating the first loss function specifically includes: ,in, represents the mutual correlation coefficient between the i-th sample from the first training data set and the j-th sample from the second training data set, When , it means that the jth sample is the data enhancement sample of the i-th sample. is the weight factor; The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
2. The method according to claim 1, characterized in that The mutual correlation coefficients include: , where m is the number of samples in the first training data set, T A m,i represents the first output feature vector corresponding to the i-th sample, T B m,j Represents the second output feature vector corresponding to the j-th sample.
3. The method according to claim 2, characterized in that The second loss function includes: a difficult sample sampling triplet loss function and a classification loss function of the first neural network.
4. The method according to claim 3, characterized in that: The overall loss of the first neural network includes the sum of the first loss function and the second loss function, specifically including: , where α, β, γ are given parameters, L self-sup is the first loss function, L triHard is the triplet loss function of the first neural network for difficult sample sampling, L softmax is the classification loss function of the first neural network.
5. The method according to claim 4, characterized in that The difficult sample sampling triplet loss function includes: For each training batch in the first training data set, randomly select P target pedestrians with IDs, and randomly select K different pictures for each target pedestrian, so a training batch contains P×K pictures; For each image a in the training batch, select the most difficult positive sample and the most difficult negative sample to form a triple with a; Define the picture set with the same ID as a as A, and the picture set formed by the remaining pictures with different IDs as B, then the difficult sample sampling triple loss function includes: L triHard = ; Among them, α is a threshold parameter set artificially. The Euclidean distance between image a and each image in the training batch in the feature space is calculated, and then the positive sample p with the farthest distance from a and the negative sample n with the closest distance are selected to calculate the triplet loss.
6. The method according to claim 1, characterized in that The enhancement processing includes: spatial domain enhancement and / or frequency domain enhancement.
7. A pedestrian re-identification device based on self-supervised learning, characterized in that: include: An acquisition module, used for acquiring image data to be identified; A recognition module, used for performing pedestrian re-recognition on the image data to be recognized based on a trained pedestrian re-recognition model to obtain a pedestrian re-recognition result; Among them, the training of the trained pedestrian re-identification model includes: Training a first neural network based on a first training data set to obtain a first feature vector of the first training data set; Training a second neural network identical to the first neural network based on a second training data set to obtain a second feature vector of the second training data set; wherein the first training data set is enhanced to obtain the second training data set; Calculating a first loss function based on the first eigenvector and the second eigenvector, wherein calculating the first loss function specifically includes: ,in, represents the mutual correlation coefficient between the i-th sample from the first training data set and the j-th sample from the second training data set, When , it means that the jth sample is the data enhancement sample of the i-th sample. is the weight factor; The model parameters of the first neural network are adjusted to minimize the sum of the first loss function and the second loss function of the first neural network, thereby obtaining the trained person re-identification model.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute any one of claims 1 to 6.
Citation Information
Patent Citations
Pedestrian re-identification model training method and device, computing equipment and storage medium
CN113936302A
