Image processing method and device, electronic equipment and medium

Through feature extraction and comparison loss calculation of pedestrian student network, the initial feature vector and pseudo-label update model parameters are solved, and the problems of high label cost and high label error rate in the existing technology are improved, and the accuracy of pedestrian re-identification model and Generalization ability.

CN119229522APending Publication Date: 2024-12-31BEIJING ZHIDA TIANJIE COMMERCIAL OPERATION MANAGEMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411140672.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing pedestrian recognition technology relies on large-scale manual annotation data, resulting in high labeling costs and high label error rates, which affects model accuracy and generalization capabilities.

Method used

Feature extraction and comparison loss calculation are performed through pedestrian student network, and model parameters are updated using the initial feature vectors and pseudo-labels stored in memory, reducing dependence on manual annotation data, reducing labeling costs, and improving the accuracy and robustness of the model.

Benefits of technology

It reduces the label error rate caused by manual annotation, improves the accuracy and generalization ability of the model in the pedestrian re-identification task, and enhances the recognition ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119229522A_ABST
    Figure CN119229522A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and provides an image processing method and device, electronic equipment and a medium. According to the method, a training image set can be acquired, each group of training samples in the training set are inputted to a pedestrian student network, and the training samples comprise pedestrian images and real labels corresponding to the pedestrian images; performing feature extraction on the pedestrian image to obtain first feature vectors of a plurality of parts; determining comparison loss according to the first feature vectors of the plurality of parts of each pedestrian image, the real labels corresponding to the pedestrian images, a plurality of initial feature vectors of the pedestrian images stored in a memory and false labels of the pedestrian images; and updating parameters in the pedestrian-student network according to the comparison loss. According to the technical scheme, the problems that in an existing pedestrian re-identification technology, the labeling cost is high, the label error rate is large, and the model accuracy is reduced are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and medium. Background Art

[0002] Person re-identification is a key computer vision task that aims to accurately retrieve the same person in images captured by different cameras based on a given pedestrian image. Current person re-identification techniques mainly rely on large-scale datasets and manually annotated data to train image recognition models. However, this dependence may lead to several problems: the cost of manually annotated data limits the further expansion of the size of person re-identification datasets. Large-scale datasets are essential for training accurate models, but the cost of annotation may become an obstacle to expanding the size of datasets; label errors caused by manual annotation may seriously damage the model's capabilities, resulting in poor performance of the model in person re-identification tasks. Even a small amount of label errors may have a negative impact on the performance of the model. The quality of the annotated data directly affects the accuracy of the trained image recognition model. Due to the limitations of manual annotation, the model may not fully utilize the information in the dataset, thereby reducing its accuracy and generalization ability. Summary of the invention

[0003] In view of this, the embodiments of the present disclosure provide an image processing method, an apparatus, an electronic device, and a computer-readable storage medium to solve the technical problem in the prior art of low accuracy of image recognition models trained by relying on labeled graphs.

[0004] According to a first aspect of an embodiment of the present disclosure, an image processing method is provided, comprising: obtaining a training image set, and inputting each group of training samples in the training set into a pedestrian student network, wherein the training samples include pedestrian images and true labels corresponding to the pedestrian images; performing feature extraction on the pedestrian images to obtain first feature vectors of multiple parts; determining a contrast loss based on the first feature vectors of multiple parts of each pedestrian image and the true labels corresponding to the pedestrian images, and multiple initial feature vectors of the pedestrian images stored in a memory and pseudo labels of the pedestrian images; and updating parameters in the pedestrian student network based on the contrast loss.

[0005] According to a second aspect of an embodiment of the present disclosure, an image processing device is provided, comprising: an acquisition module, used to acquire a training image set, and input each group of training samples in the training set into a pedestrian student network, wherein the training samples include pedestrian images and real labels corresponding to the pedestrian images; a feature extraction module, used to extract features from pedestrian images to obtain first feature vectors of multiple parts; a determination module, used to determine a contrast loss based on the first feature vectors of multiple parts of each pedestrian image and the real labels corresponding to the pedestrian images, and multiple initial feature vectors of the pedestrian images stored in a memory and pseudo labels of the pedestrian images; and an update module, used to update parameters in the pedestrian student network based on the contrast loss.

[0006] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0007] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0008] Compared with the prior art, the embodiments of the present disclosure have the following beneficial effects: the embodiments of the present disclosure can reduce the reliance on large-scale manually labeled data by utilizing a pedestrian student network for feature extraction and contrast loss calculation, thereby reducing the labeling cost compared to traditional methods, thereby promoting the expansion of the size of pedestrian re-identification datasets. By utilizing the initial feature vectors and pseudo-labels of pedestrian images stored in memory, the label error rate caused by manual labeling can be reduced. This can improve the accuracy and robustness of model training, thereby improving the performance of the pedestrian re-identification model. By calculating contrast loss and updating parameters, the pedestrian student network can be effectively guided to learn the feature representation of pedestrian images. This can improve the accuracy of the model in pedestrian re-identification tasks and enhance its generalization and recognition capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0010] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied;

[0011] Figure 2is a flowchart of an image processing method provided by an embodiment of the present disclosure;

[0012] Figure 3 is a flowchart of another image processing method provided by an embodiment of the present disclosure;

[0013] Figure 4 is a block diagram of an image processing device provided by an embodiment of the present disclosure;

[0014] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0015] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0016] It should be noted that the user information (including but not limited to terminal device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0017] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied.

[0018] like Figure 1 As shown, the system architecture 100 may include one or more of a first terminal device 101, a second terminal device 102, and a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0019] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0020] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send data, etc. The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, portable computers, desktop computers, and the like.

[0021] The server 105 may be a server that provides various services. For example, the server 105 may obtain a training image set from the first terminal device 103 (or the second terminal device 102 or the third terminal device 103), and input each group of training samples in the training set into the pedestrian student network, wherein the training samples include pedestrian images and real labels corresponding to the pedestrian images; perform feature extraction on the pedestrian images to obtain first feature vectors of multiple parts; determine the contrast loss based on the first feature vectors of multiple parts of each pedestrian image and the real labels corresponding to the pedestrian images and the multiple initial feature vectors of the pedestrian images stored in the memory and the pseudo labels of the pedestrian images; update the parameters in the pedestrian student network based on the contrast loss. The technical solution disclosed in the present invention helps to solve the problems of high labeling cost, high label error rate and reduced model accuracy in the existing pedestrian re-identification technology.

[0022] In some embodiments, the image processing method provided by the embodiment of the present invention is generally executed by the server 105, and accordingly, the image processing device is generally set in the server 105. In other embodiments, some terminal devices may have functions similar to those of the server to execute the method. Therefore, the image processing method provided by the embodiment of the present invention is not limited to being executed on the server side.

[0023] The image processing method and device according to the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0024] Figure 2 is a flowchart of an image processing method provided by an embodiment of the present disclosure. The method provided by an embodiment of the present disclosure can be executed by any electronic device with computer processing capabilities, for example, the electronic device can be Figure 1 The server is shown.

[0025] like Figure 2 As shown, the image processing method includes steps S210 to S240.

[0026] In step S210, a training image set is obtained, and each group of training samples in the training set is input into the pedestrian student network, where the training samples include pedestrian images and true labels corresponding to the pedestrian images.

[0027] Step S220: extract features from the pedestrian image to obtain first feature vectors of multiple parts.

[0028] In step S230, the contrast loss is determined based on the first feature vectors of multiple parts of each pedestrian image and the real labels corresponding to the pedestrian image and the multiple initial feature vectors of the pedestrian image and the pseudo labels of the pedestrian image stored in the memory.

[0029] In step S240, the parameters in the pedestrian student network are updated according to the contrast loss.

[0030] This method can reduce the reliance on large-scale manually annotated data by using the pedestrian student network for feature extraction and contrast loss calculation, and reduce the annotation cost compared with traditional methods, thereby promoting the expansion of the size of pedestrian re-identification datasets. By using the initial feature vectors and pseudo labels of pedestrian images stored in memory, the label error rate caused by manual annotation can be reduced. This can improve the accuracy and robustness of model training, thereby improving the performance of the pedestrian re-identification model. Through the calculation of contrast loss and parameter update, the pedestrian student network can be effectively guided to learn the feature representation of pedestrian images. This can improve the accuracy of the model in the pedestrian re-identification task and enhance its generalization and recognition capabilities.

[0031] In some embodiments of the present disclosure, a training image set is a data source for training a pedestrian student network. The training image set consists of multiple groups of training samples, each of which can be understood as a batch. Each batch contains multiple pedestrian images, and each pedestrian image is associated with its corresponding true label. Each training sample consists of a pedestrian image and a true label corresponding to the pedestrian image. These true labels are usually used to identify the identity or characteristics of pedestrians in the image, such as pedestrian ID, gender, clothing and other information. In this embodiment, the pedestrian image can be an image of a pedestrian in a public place authorized by the relevant department. These images may come from images captured by surveillance cameras, security cameras or other camera equipment in public places. These images usually contain pedestrians at different angles, postures and lighting conditions, so that the training model has the ability to recognize pedestrian images in different situations. By using the authorized pedestrian images in public places as training data, the legitimacy and privacy protection of the data can be ensured, and a rich and diverse training sample is provided for the model, which helps to improve the generalization ability and robustness of the model. Such a source of training data ensures the application effect and reliability of the model in actual scenarios.

[0032] In some embodiments, the initial parameters of the pedestrian student network refer to the initial values ​​of the network weights at the beginning of training. These initial parameters have an important impact on the convergence speed and final performance of the network. Usually, the initial parameters are randomly initialized, but they can also be initialized by pre-training.

[0033] ImageNet is a large-scale image database, which is usually used for pre-training of computer vision tasks such as image classification. Pre-training on ImageNet can enable the neural network to learn common image features, which are useful for various visual tasks. In this embodiment, the initial parameters of the pedestrian student network can be initialized using the parameters of ImageNet pre-training. This means that the model parameters trained on the ImageNet data set can be used as the initial parameters of the pedestrian student network, and then fine-tuned on the data set of the pedestrian re-identification task. The parameters of ImageNet pre-training contain rich image feature information and can serve as a good starting point for learning the pedestrian student network. This transfer learning can accelerate the convergence of the model and improve the training efficiency of the model. Through the common features learned on the ImageNet data set, the pedestrian student network can be better generalized to the pedestrian re-identification task and improve the performance of the model on the new data set. Applying the parameters of ImageNet pre-training as the initial parameters of the pedestrian student network can provide a good foundation for the training and performance of the model, which helps to improve the accuracy and generalization ability of the pedestrian re-identification task.

[0034] In some embodiments of the present disclosure, performing feature extraction on a pedestrian image to obtain first feature vectors of multiple parts includes: dividing the pedestrian image into multiple part images according to the part features of the human body image; and performing feature extraction on each part image to obtain first feature vectors of multiple parts. For example, a pedestrian image usually contains different parts such as the head, upper body, and lower body. According to the anatomical structure and features of the human body, the pedestrian image can be divided into multiple part images, such as the head, chest, waist, and legs. Multiple part images: Through segmentation, each part image represents a specific part in the pedestrian image, which can better capture the feature information of different parts. For each part image, a convolutional neural network (CNN) or other feature extraction methods can be used to extract the feature representation of the part. After performing feature extraction on each part image, the first feature vector of the part can be obtained. These feature vectors capture the visual features and information of each part. By performing multi-part feature extraction on the pedestrian image, the feature information of different parts in the pedestrian image can be better captured, and the recognition ability and robustness of the model for pedestrians can be improved. This method can effectively utilize local information in pedestrian images, thereby improving the performance and accuracy of the pedestrian re-identification system.

[0035] In some embodiments of the present disclosure, the contrast loss is determined according to the first feature vectors of multiple parts of each pedestrian image and the real labels corresponding to the pedestrian image and the multiple initial feature vectors of the pedestrian image and the pseudo labels of the pedestrian image stored in the memory. For example, each pedestrian image usually has a real label, which indicates the identity or attribute information of the pedestrian. The pseudo labels generated in the previous clustering process are used to indicate the clustering category of each pedestrian image. Contrastive Loss: It is a loss function used to measure the similarity between feature vectors. In this case, the contrast loss is used to measure the similarity between the feature vector output by the model and the real label or pseudo label. The contrast loss usually compares the distance between the feature vector output by the model and the real label or pseudo label, so that similar samples are closer in the feature space and dissimilar samples are farther away. Through the optimization of the contrast loss, the model is encouraged to learn better feature representations, so that the feature vectors of the same pedestrian are closer and the feature vectors of different pedestrians are more dispersed. In the model training process, the contrast loss together with other loss functions constitutes the overall loss function, and the model parameters are optimized by the back propagation algorithm to minimize the contrast loss. By determining the contrast loss, the pedestrian student network can be guided to learn more discriminative feature representations, thereby improving the performance and accuracy of the pedestrian re-identification task. The design of this loss function helps the model better understand the similarities and differences between pedestrian images.

[0036] Based on the above embodiment, for each feature of a training sample, when selecting positive and negative samples of contrast loss, according to the difficult sample mining strategy, the farthest distance in the same class is selected as the positive sample, and the closest distance in different classes is selected as the negative sample. Since the features are normalized, the distance measurement here can be directly calculated using the vector inner product. Specifically, in the same category, the sample farthest from the current sample is selected as the positive sample. This ensures that the model can better distinguish samples in the same category when learning feature representations. In different categories, the sample closest to the current sample is selected as a negative sample. This can introduce more challenging negative samples and prompt the model to learn more discriminative feature representations. In order to eliminate the scale difference between feature vectors, the feature vectors are usually normalized so that they have similar scales. Since the features are normalized, the vector inner product can be directly used as a distance measurement method. The vector inner product calculation can quickly and effectively measure the similarity between feature vectors. For the normalized feature vectors, the vector inner product calculation can be directly used as a distance measurement. The larger the inner product value, the more similar the two feature vectors are. In the features of each training sample, positive and negative samples are selected according to the difficult sample mining strategy. By calculating the contrast loss between positive and negative samples, the model parameters are optimized to make similar samples closer and dissimilar samples farther apart. Through such positive and negative sample selection and distance measurement, the model can more effectively learn discriminative feature representations and improve the performance and accuracy of the pedestrian student network in pedestrian re-identification tasks. This strategy can help the model better handle differences within the same category and similarities between different categories.

[0037] In some embodiments of the present disclosure, the parameters in the pedestrian student network are updated according to the contrast loss. For example, in each training sample, positive and negative samples are selected according to the difficult sample mining strategy, and the contrast loss between them is calculated. The contrast loss is usually defined by the distance between the positive sample and the negative sample, and the goal is to make the distance between the positive samples as small as possible and the distance between the negative samples as large as possible. The contrast loss is combined with other loss functions to form an overall loss function. Through the back propagation algorithm, the loss function is minimized and the parameters in the network are updated. According to the gradient descent method, the parameters in the network are updated along the negative gradient direction of the loss function. In this way, the network can gradually converge to a local optimal solution, thereby improving the performance of the model. Various optimizers (such as SGD, Adam, etc.) are usually used to update the parameters. These optimizers can automatically adjust the learning rate according to the direction and size of the gradient to accelerate the convergence speed of the model. Parameter updating is an iterative process, and the network can be optimized by calculating the loss, back propagation and parameter updating in each training batch. This process continues for multiple epochs until the model converges or reaches a predetermined training round. During the training process, the performance of the model on the validation set is usually monitored to avoid overfitting and adjust the hyperparameters. This helps ensure the model's generalization ability on unseen data. By updating the parameters in the pedestrian student network based on the contrastive loss, the model can learn more discriminative feature representations, improving the accuracy and performance of the pedestrian re-identification task. This training method can guide the model to learn better feature representations, making the features of the same pedestrian closer and the features of different pedestrians more dispersed.

[0038] Figure 3 FIG. 1 is a flow chart of another image processing method provided by an embodiment of the present disclosure. Figure 3 Before determining the contrast loss, the method further includes steps S310 to S330.

[0039] In step S310, features of pedestrian images are extracted based on a model pre-trained in an image database to obtain initial feature vectors of multiple parts.

[0040] In step S320, the initial feature vectors of multiple departments corresponding to each pedestrian image are clustered by a clustering algorithm to obtain a pseudo label of each pedestrian image.

[0041] In step S330, the initial feature vectors of multiple departments corresponding to each pedestrian image and the pseudo labels of each pedestrian image are stored in a designated file in the memory.

[0042] This method can extract features from pedestrian images based on a model pre-trained in an image database (i.e., a model pre-trained in ImageNet) to obtain initial feature vectors of multiple parts. The initial feature vectors of multiple departments corresponding to each pedestrian image are clustered by a clustering algorithm to obtain pseudo labels for each pedestrian image. The initial feature vectors of multiple departments corresponding to each pedestrian image and the pseudo labels of each pedestrian image are stored in a specified file in the memory. Through this process, the pre-trained model can be used to extract multi-part features of the pedestrian image, and pseudo labels can be generated by a clustering algorithm to provide data preparation for the training of the pedestrian student network. This method can help the model better learn the feature representation of pedestrian images and improve the performance and accuracy of pedestrian re-identification tasks.

[0043] In some embodiments of the present disclosure, before training the pedestrian student network, feature extraction can be performed on the pedestrian image based on the model pre-trained on the image database (i.e., the model pre-trained on ImageNet) to obtain initial feature vectors of multiple parts. The initial feature vectors of multiple departments corresponding to each pedestrian image are clustered by a clustering algorithm to obtain pseudo labels of each pedestrian image. The initial feature vectors of multiple departments corresponding to each pedestrian image and the pseudo labels of each pedestrian image are stored in a specified file in the memory. For example, feature extraction is performed on the pedestrian image using a model pre-trained on an image database (such as ImageNet). These pre-trained models usually have rich image feature representation capabilities. Feature extraction is performed on the image of each part to obtain initial feature vectors of multiple parts. These feature vectors capture the visual information of different parts. The initial feature vectors of multiple parts corresponding to each pedestrian image are clustered by a clustering algorithm (such as K-means clustering, hierarchical clustering, etc.). The clustering algorithm can classify similar feature vectors into the same category, thereby generating pseudo labels for each pedestrian image. These pseudo labels can be used in subsequent supervised learning processes. The initial feature vectors and generated pseudo labels of multiple parts corresponding to each pedestrian image are stored in a specified file in the memory. This makes it easier to use these data in the subsequent model training process.

[0044] In some embodiments of the present disclosure, the method further includes: determining whether the first feature vectors of multiple parts of the pedestrian images of each group are identical to the multiple initial feature vectors of the pedestrian images stored in the memory; if the identical feature vectors are identical, weighting the identical feature vectors according to a preset ratio, and updating the corresponding feature vectors in the memory based on the weighted result. For example, first, extracting feature vectors of multiple parts of each pedestrian image, usually by segmenting the image or using predefined parts for extraction. For each part, obtain its first feature vector, which can be a certain specific representation, such as a feature vector extracted by a convolutional neural network. The initial feature vectors of multiple parts of the previously processed pedestrian images are stored in the memory. These feature vectors may be reference vectors for pedestrian re-identification. For the first feature vector of each part, it is necessary to check whether it is identical to the feature vector stored in the memory. If it is found that the first feature vector of a part is identical to the feature vector in the memory, weighting the identical feature vector according to a preset ratio is performed. The weighted processing can be a simple linear combination, and the two feature vectors are weighted and summed according to a preset ratio. Based on the weighted result, the corresponding feature vector in the memory is updated. This keeps the feature vector in memory consistent with the feature vector of the currently processed image and takes into account the similarities between them. This process may need to be performed separately for the feature vector of each part to ensure that the feature vector of each part is properly processed and updated. In this way, multiple part feature vectors of pedestrian images can be processed efficiently and a set of updated reference feature vectors can be maintained in memory. This helps improve the performance of the pedestrian re-identification system, allowing the model to better capture important features in pedestrian images and improve recognition accuracy.

[0045] Based on the above embodiment, after each training batch is completed, the method of simulating gradient update is triggered. The image features of the current batch are weighted with the same image features in the memory at a certain ratio, and the weighted results are updated to the memory. The image features of the current batch are weighted with the same image features in the memory at a certain ratio. This weighted update helps to keep the sample features in the memory consistent with the features after the current network parameters are updated, avoiding inaccurate sample features in the memory due to the update of the network parameters. Whenever the entire data set is fully trained, all images need to be re-passed through the latest model to obtain features. This means that the entire data set is forward propagated to obtain the latest feature representation. Based on the latest feature representation, clustering algorithms (such as K-means) can be used to cluster these features, thereby assigning pseudo labels to each sample. These pseudo labels can be used as reference labels stored in the memory for subsequent training and updating. In this way, the accuracy of the sample features in the memory can be maintained, and the sample features in the memory can be updated in time to adapt to changes in model parameters. This helps to improve the generalization ability and performance of the model and ensure that the sample features in the memory are consistent with the feature representation of the current model.

[0046] In some embodiments of the present disclosure, at the beginning of training, a teacher network that is exactly the same as the network to be trained (student network) is set. The teacher network and the student network have the same network structure and number of parameters. After each image is subjected to different data enhancements, it passes through the student network and the teacher network respectively, and the output features are constrained to be as similar as possible using the mean square error loss. This ensures that the output features of the student network are consistent with the output features of the teacher network. The teacher network does not use gradients to update parameters, but after each batch training is completed, the parameters of the student network are weighted by a coefficient to the parameters of the teacher network at the corresponding position. In the initial stage, the weighting coefficient is very small to ensure that each iteration can be carried out stably. As the training proceeds, this coefficient is gradually increased to speed up the training speed. This method helps to reduce the instability of the unsupervised training process and guide the training of the student network through the stable output of the teacher network. The small coefficient in the initial stage ensures the stability of the training, and as the training proceeds, the coefficient is gradually increased to increase the training speed. In this way, it not only helps to stabilize the training process, but also has a certain impact on the final accuracy improvement. The stable output of the teacher network can help the student network converge to a better solution faster, thereby improving the performance of the model. Through the above steps, the instability of the unsupervised training process can be effectively reduced, the training efficiency can be improved, and ultimately the accuracy of the model can be improved.

[0047] Based on the above embodiment, the above method further includes: inputting each group of training samples in the training set into the pedestrian teacher network, and extracting features from each pedestrian image through the teacher network to obtain second feature vectors of multiple parts; determining the mean square error loss according to the first feature vectors of multiple parts of each pedestrian image and the second feature vectors of multiple parts of each pedestrian image; determining the target loss according to the contrast loss and the mean square error loss, and updating the parameters in the pedestrian student network based on the target loss. For example, inputting each group of training samples in the training set into the pedestrian teacher network. Extracting features from each pedestrian image through the teacher network to obtain second feature vectors of multiple parts. Using the first feature vector and the second feature vector of multiple parts of each pedestrian image to calculate the mean square error loss. By comparing the differences between these feature vectors, the mean square error loss can be determined to measure the similarity between two groups of feature vectors. After determining the mean square error loss, the contrast loss can be combined to comprehensively consider the similarity between the feature vectors. The contrast loss is usually used to measure the similarity between the feature vector output by the model and the real sample or pseudo label, which helps to improve the distinguishability of the feature. Based on the results of the contrast loss and the mean square error loss, the target loss can be determined. The target loss comprehensively considers the similarity and difference between feature vectors and is a key indicator used to guide the update of model parameters. Finally, based on the determined target loss, the back-propagation algorithm and optimizer can be used to update the parameters in the pedestrian student network. By continuously optimizing the target loss, the model can gradually improve its performance in the pedestrian re-identification task. Through the above steps, the feature vectors and loss functions extracted by the teacher network can be effectively used to guide the training of the student network, thereby improving the performance and accuracy of the pedestrian re-identification system.

[0048] In some embodiments, after all pedestrian images in the training image set are processed by the pedestrian student network, the method further includes: re-extracting features from all pedestrian images in the training image set through the current pedestrian student network, and obtaining third feature vectors of multiple parts of each pedestrian image; clustering the third feature vectors of multiple parts of each pedestrian image through a clustering algorithm to obtain pseudo labels of each pedestrian image; and updating the corresponding feature vectors and pseudo labels in the memory based on the third feature vectors of multiple parts of each pedestrian image and the pseudo labels of each pedestrian image. For example, after all pedestrian images in the training image set are processed by the pedestrian student network, feature extraction is performed again on all pedestrian images through the current pedestrian student network. This time, the third feature vectors of multiple parts of each pedestrian image are extracted. Clustering is performed on the third feature vectors of multiple parts of each pedestrian image using a clustering algorithm (such as K-means clustering, hierarchical clustering, etc.). By using the clustering algorithm, similar feature vectors in the feature space are grouped together, thereby obtaining pseudo labels of each pedestrian image. Based on the third feature vectors of multiple parts of each pedestrian image and the pseudo-labels of each pedestrian image, the corresponding feature vectors and pseudo-labels in the memory are updated. This step can help the model better understand and distinguish the characteristics between different pedestrians, thereby improving the performance of the pedestrian re-identification system. By re-feature extraction, clustering processing and updating feature vectors and pseudo-labels, the model can better learn the feature representation of pedestrian images and improve the recognition accuracy and generalization ability of pedestrians.

[0049] Through the above method, a pedestrian student network with good performance can be trained, and some specified pedestrian recognition tasks can be performed through the pedestrian network to quickly output a corresponding label according to a given image, that is, the identification of the person in the image. For example, the above method also includes: obtaining an image of the target person; dividing the image of the target person into multiple part images according to the part features of the human body image; extracting features from the multiple part images through the pedestrian student network to obtain feature vectors of multiple parts corresponding to the image of the target person; and determining the label of the image of the target person according to the feature vectors of multiple parts corresponding to the image of the target person. For example, first, an image containing the target person is obtained, which can be any image containing the target person, such as a pedestrian image captured by a surveillance camera. The image of the target person is divided according to the part features of the human body image, and the image is decomposed into multiple part images, such as the head, body, legs, etc. The features of these part images are extracted through the trained pedestrian student network. After each part image is processed by the network, the feature vectors of multiple parts corresponding to the image of the target person are obtained. According to the feature vectors of multiple parts corresponding to the image of the target person, the label of the image of the target person can be determined through the pedestrian student network. This label can be a unique identifier used to identify the identity of the target person in the image or other related information. Through the above steps, a corresponding label can be quickly output based on the given image, that is, the identification of the person in the image. This process uses the trained pedestrian student network to extract and identify the part features of the target person's image, thereby achieving a fast and effective pedestrian recognition task. This method can be applied in various scenarios, such as monitoring systems, security inspections, and other occasions where pedestrian identities need to be quickly identified.

[0050] Figure 4 It is a block diagram of an image processing device provided by an embodiment of the present disclosure.

[0051] like Figure 4 As shown, the image processing device 400 includes an acquisition module 410 , a feature extraction module 420 , a determination module 430 and an update module 440 .

[0052] Specifically, the acquisition module 410 is used to acquire a training image set and input each group of training samples in the training set into the pedestrian student network. The training samples include pedestrian images and true labels corresponding to the pedestrian images.

[0053] The feature extraction module 420 is used to extract features from the pedestrian image to obtain first feature vectors of multiple parts.

[0054] The determination module 430 is used to determine the contrast loss based on the first feature vectors of multiple parts of each pedestrian image and the real label corresponding to the pedestrian image and the multiple initial feature vectors of the pedestrian image and the pseudo label of the pedestrian image stored in the memory.

[0055] The updating module 440 is used to update the parameters in the pedestrian student network according to the contrast loss.

[0056] The image processing device 400 can reduce the reliance on large-scale manually labeled data by using a pedestrian student network for feature extraction and contrast loss calculation, and reduce the labeling cost compared to traditional methods, thereby promoting the expansion of the size of pedestrian re-identification data sets. By using the initial feature vectors and pseudo labels of pedestrian images stored in memory, the label error rate caused by manual labeling can be reduced. This can improve the accuracy and robustness of model training, thereby improving the performance of the pedestrian re-identification model. Through the calculation of contrast loss and parameter update, the pedestrian student network can be effectively guided to learn the feature representation of pedestrian images. This can improve the accuracy of the model in pedestrian re-identification tasks and enhance its generalization and recognition capabilities.

[0057] In some embodiments of the present disclosure, the feature extraction module 420 is configured to: divide the pedestrian image into multiple part images according to the part features of the human body image; and perform feature extraction on each part image to obtain first feature vectors of the multiple parts.

[0058] In some embodiments of the present disclosure, before determining the contrast loss, the image processing device 400 is also used to: extract features of pedestrian images based on a model pre-trained in an image database to obtain initial feature vectors of multiple parts; cluster the initial feature vectors of multiple departments corresponding to each pedestrian image through a clustering algorithm to obtain a pseudo label for each pedestrian image; and store the initial feature vectors of multiple departments corresponding to each pedestrian image and the pseudo label of each pedestrian image in a designated file in the memory.

[0059] In some embodiments of the present disclosure, the image processing device 400 is also used to: determine whether the first feature vectors of multiple parts of each group of pedestrian images are identical to multiple initial feature vectors of pedestrian images stored in the memory; if the same feature vectors exist, weight the same feature vectors according to a preset ratio, and update the corresponding feature vectors in the memory based on the weighted results.

[0060] In some embodiments of the present disclosure, the image processing device 400 is also used to: input each group of training samples in the training set into the pedestrian teacher network, and extract features of each pedestrian image through the teacher network to obtain second feature vectors of multiple parts; determine the mean square error loss based on the first feature vectors of multiple parts of each pedestrian image and the second feature vectors of multiple parts of each pedestrian image; determine the target loss based on the contrast loss and the mean square error loss, and update the parameters in the pedestrian student network based on the target loss.

[0061] In some embodiments of the present disclosure, after all pedestrian images in the training image set are processed by the pedestrian student network, the image processing device 400 is also used to: re-extract features of all pedestrian images in the training image set through the current pedestrian student network, and obtain third feature vectors of multiple parts of each pedestrian image; cluster the third feature vectors of multiple parts of each pedestrian image through a clustering algorithm to obtain pseudo labels of each pedestrian image; and update the corresponding feature vectors and pseudo labels in the memory based on the third feature vectors of multiple parts of each pedestrian image and the pseudo labels of each pedestrian image.

[0062] In some embodiments of the present disclosure, the image processing device 400 is also used to: obtain an image of a target person; divide the image of the target person into multiple part images according to part features of the human body image; extract features of the multiple part images through a pedestrian student network to obtain feature vectors of multiple parts corresponding to the image of the target person; and determine a label of the image of the target person based on the feature vectors of the multiple parts corresponding to the image of the target person.

[0063] Figure 5 Schematic diagram of an electronic device 5 provided in an embodiment of the present disclosure. Figure 5 As shown, the electronic device 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 503, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 501 executes the computer program 503, the functions of the modules in the above-mentioned device embodiments are implemented.

[0064] The electronic device 5 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 5 may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5 The electronic device 5 is merely an example and does not limit the electronic device 5 , and may include more or less components than those shown in the figure, or different components.

[0065] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0066] The memory 502 may be an internal storage unit of the electronic device 5, for example, a hard disk or memory of the electronic device 5. The memory 502 may also be an external storage device of the electronic device 5, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. The memory 502 may also include both an internal storage unit of the electronic device 5 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the electronic device.

[0067] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0068] If the integrated module 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 present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0069] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. An image processing method, characterized in that: include: Obtain a training image set, and input each group of training samples in the training set into a pedestrian student network, wherein the training samples include pedestrian images and true labels corresponding to the pedestrian images; Extracting features from the pedestrian image to obtain first feature vectors of multiple parts; Determine the contrast loss according to the first feature vectors of multiple parts of each pedestrian image and the real label corresponding to the pedestrian image and the multiple initial feature vectors of the pedestrian image stored in the memory and the pseudo label of the pedestrian image; According to the contrastive loss, parameters in the pedestrian student network are updated.

2. The method according to claim 1, characterized in that The extracting features of the pedestrian image to obtain first feature vectors of multiple parts includes: dividing the pedestrian image into a plurality of part images according to the part features of the human body image; Feature extraction is performed on the images of each part to obtain first feature vectors of multiple parts.

3. The method according to claim 1, characterized in that Before determining the contrast loss, the method further includes: Extracting features from the pedestrian image based on a model pre-trained in an image database to obtain initial feature vectors of multiple parts; The initial feature vectors of multiple departments corresponding to each pedestrian image are clustered by a clustering algorithm to obtain pseudo labels of each pedestrian image; The initial feature vectors of multiple departments corresponding to each pedestrian image and the pseudo labels of each pedestrian image are stored in a specified file in the memory.

4. The method according to claim 1, characterized in that: The method further comprises: Determine whether first feature vectors of multiple parts of pedestrian images of each group have the same feature vectors as multiple initial feature vectors of pedestrian images stored in the memory; If there are identical feature vectors, the identical feature vectors are weighted according to a preset ratio, and the corresponding feature vectors in the memory are updated based on the weighted result.

5. The method according to claim 1, characterized in that The method further comprises: Inputting each group of training samples in the training set into a pedestrian teacher network, and extracting features from each pedestrian image through the teacher network to obtain second feature vectors of multiple parts; Determine a mean square error loss based on first feature vectors of multiple parts of each pedestrian image and second feature vectors of multiple parts of each pedestrian image; A target loss is determined according to the contrast loss and the mean square error loss, and parameters in the pedestrian student network are updated based on the target loss.

6. The method according to claim 1, characterized in that After all pedestrian images in the training image set are processed by the pedestrian student network, the method further includes: Re-extracting features from all pedestrian images in the training image set through the current pedestrian student network, and obtaining third feature vectors of multiple parts of each pedestrian image; Clustering the third eigenvectors of multiple parts of each pedestrian image using a clustering algorithm to obtain a pseudo label of each pedestrian image; Based on the third feature vectors of the multiple parts of each pedestrian image and the pseudo label of each pedestrian image, the corresponding feature vectors and pseudo labels in the memory are updated.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtain an image of the target person; Cutting the target person's image into a plurality of part images according to the part features of the human body image; Extracting features from the multiple part images through the pedestrian student network to obtain feature vectors of multiple parts corresponding to the image of the target person; The label of the image of the target person is determined according to the feature vectors of the plurality of parts corresponding to the image of the target person.

8. An image processing device, characterized in that: include: An acquisition module, used for acquiring a training image set, and inputting each group of training samples in the training set into a pedestrian student network, wherein the training samples include pedestrian images and true labels corresponding to the pedestrian images; A feature extraction module, used for extracting features from the pedestrian image to obtain first feature vectors of multiple parts; A determination module, configured to determine a contrast loss based on first feature vectors of multiple parts of each pedestrian image and a true label corresponding to the pedestrian image and multiple initial feature vectors of the pedestrian image stored in a memory and a pseudo label of the pedestrian image; An updating module is used to update parameters in the pedestrian student network according to the contrast loss.

9. 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 computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.