A feature extraction method for target re-identification
Through the slice method, the complexity problem of multiple business requirements in the target re-identification system is solved, and the efficient integration of retrieval accuracy, retrieval time and storage space is achieved, reducing system complexity and development costs.
Patent Information
- Application Number
- CN202110557889.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-21
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-05-21
AI Technical Summary
Traditional methods require training multiple deep learning models in the target recognition system to meet the requirements of different services for retrieval accuracy, search time and storage space, resulting in increased system complexity and development costs.
The neural network model is trained by slice method, and the total loss function is determined by slicing the feature vector and category center parameters, and the model parameters are updated using the backpropagation method to achieve flexibility and efficiency of feature extraction.
While ensuring the search accuracy, the system complexity and development costs are reduced, the search accuracy, search time and storage space are efficiently integrated, and business flexibility is provided, and the feature length can be switched according to different needs.
Smart Images

Figure CN113255695B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to a feature extraction method for target re-identification. Background Art
[0002] At present, in different business scenarios, the requirements for target re-identification retrieval accuracy, retrieval time, and storage space are different. For example, some businesses require very high retrieval accuracy and relatively low requirements for retrieval time and storage space; while other businesses require faster retrieval time and smaller storage space. In order to cope with these different businesses, the traditional approach is to train multiple deep learning models separately, each model extracts feature vectors of different lengths, and then select different models according to different business needs.
[0003] If there are multiple different business needs in the same target re-identification system, and these businesses have different requirements for retrieval accuracy, retrieval time, and storage space, the above traditional approach will require training multiple models, which will increase the complexity and space cost of the entire system, while also increasing development costs. Summary of the invention
[0004] One of the purposes of the present invention is to provide a feature extraction method for target re-identification, which can simultaneously meet the different requirements of different businesses on retrieval accuracy, retrieval time and storage space.
[0005] An embodiment of the present invention provides a feature extraction method for target re-identification, comprising:
[0006] Get the image to be extracted;
[0007] Feature extraction is performed on the image to be extracted based on a neural network model trained in advance using a slicing method.
[0008] Preferably, the training steps of the neural network model are as follows:
[0009] Get the input image;
[0010] Inputting the input image into a preset neural network model to obtain a first eigenvector;
[0011] Slicing the first eigenvector to obtain a plurality of second eigenvectors;
[0012] Slice the initialized category center parameter to obtain multiple category center parameter slices;
[0013] Determining a total loss function based on the class center parameter slice, the second feature vector, the first feature vector, and the initialized class center parameter;
[0014] The initialized category center parameters and the parameters of the neural network model are updated based on the total loss function.
[0015] Preferably, determining a total loss function based on the category center parameter slice, the second feature vector, the first feature vector and the initialized category center parameter comprises:
[0016] Determining a plurality of first sub-loss functions based on the category center parameter slice and the second feature vector;
[0017] Determining a second sub-loss function based on the first feature vector and the initialized category center parameter;
[0018] Based on the first sub-loss functions and the second sub-loss functions, the total loss function is determined; the calculation formula of the total loss function is as follows:
[0019]
[0020] Wherein, L is the total loss function, It is the second sub-loss function of the total loss function; is the i-th first sub-loss function; μ0 is the preset coefficient corresponding to the second sub-loss function; μ i is the preset coefficient corresponding to the i-th first sub-loss function; n is the number of the first loss functions; N is the length of the first feature vector; M i is the length of the i-th second eigenvector.
[0021] Preferably, 0 <M i <N;1≤n≤N-1。
[0022] Preferably, slicing the first feature vector to obtain a plurality of second feature vectors comprises:
[0023] Starting from the front element of the first feature vector, a preset number of elements of the feature vector are sequentially taken as the second feature vector.
[0024] Preferably, the expression of the second sub-loss function is as follows:
[0025]
[0026] Among them, M represents the number of images in a training set, s, m, and k are all hyperparameters, and θ yi Represents the angle between the feature vector of the i-th image target and its actual category center vector, θ l It represents the angle between the feature vector of the target in the lth image and the center vector of other categories.
[0027] Preferably, the category center parameter slices correspond one-to-one to the second feature vectors.
[0028] Preferably, the back propagation method is used to update the parameters of the initialized category center and the parameters of the neural network model.
[0029] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0030] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0032] Figure 1 A schematic diagram of a model training of a feature extraction method for target re-identification in an embodiment of the present invention;
[0033] Figure 2 Schematic diagram of the position of the taken feature vector elements and the corresponding loss function;
[0034] Figure 3 Schematic diagram of the angle between the target feature vector and the category center vector. DETAILED DESCRIPTION
[0035] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0036] See also Figures 1 to 3 , Figure 1 The batch_size in the figure is the number of images in a batch during model training; h is the image height; w is the image width; c is the number of image channels; N is the length of the feature vector output by the model; class_num is the number of target categories of the image used for training; feature vector slicing means: starting from the front element, taking the front part of the elements of the feature vector as the new feature vector, and this new feature vector is the feature vector slice.
[0037] The existing normal training process is as follows:
[0038] Use image classification network for training, and treat each different target as a different category; the image classification network can be divided into two sub-networks according to function. The first is a network for extracting image features, set as sub-network A; the second sub-network is set as B, and B is classified according to the features output by A. After the classification network training is completed, sub-network B is discarded and sub-network A is retained to extract image features for the task of target re-identification;
[0039] The training steps of the neural network model of this application are as follows:
[0040] Get the input image;
[0041] Inputting the input image into a preset neural network model to obtain a first eigenvector;
[0042] Slicing the first eigenvector to obtain a plurality of second eigenvectors;
[0043] Slice the initialized category center parameter to obtain multiple category center parameter slices;
[0044] Determining a total loss function based on the class center parameter slice, the second feature vector, the first feature vector, and the initialized class center parameter;
[0045] The initialized category center parameters and the parameters of the neural network model are updated based on the total loss function.
[0046] Figure 1The "category center parameter" in the figure is the parameter (weight) of subnetwork B; the parameters of the entire image classification network need to be initialized before training, that is, to give each parameter an original value, which can be set to 0 or randomly initialized. Slicing means taking a part, corresponding to the slice of the feature vector. Assuming that the dimension (shape) of the original feature vector is: batch_size*N, the dimension of the original classification center parameter needs to be N*class_num (batch_size is the number of training pictures, and class_num is the number of classification categories); when the network is forward calculated, the feature vector is multiplied by the classification center parameter, and the output dimension is batch_size*class_num, which can be used to judge the classification result; when slicing, if the slice dimension taken out of the feature vector is batch_size*m (m<=N), then the classification center parameter also needs to take the slice dimension of m*class_num, so that the output dimension after multiplication can be guaranteed to be the same. In addition, parameter adjustment uses the "back propagation method". All neural networks are trained based on this method. The parameters in the network are updated once each iteration. The parameters that need to be adjusted (updated) are: all parameters (weights) involved in the training in the network, including sub-network A and sub-network B.
[0047] Determining a total loss function based on the category center parameter slice, the second feature vector, the first feature vector and the initialized category center parameter; comprising:
[0048] Determining a plurality of first sub-loss functions based on the category center parameter slice and the second feature vector;
[0049] Determining a second sub-loss function based on the first feature vector and the initialized category center parameter;
[0050] The total loss function is determined based on the first sub-loss functions and the second sub-loss functions.
[0051] The structure of the total loss function used in this technique is expressed as follows:
[0052]
[0053] Wherein, L is the total loss function, It is the second sub-loss function of the total loss function; is the i-th first sub-loss function; μ0 is the preset coefficient corresponding to the second sub-loss function; μ i is the preset coefficient corresponding to the i-th first sub-loss function; n is the number of the first loss functions; N is the length of the first feature vector; M i is the length of the i-th second eigenvector.
[0054] 0 <M i <N;1≤n≤N-1。
[0055] Figure 2 It is a schematic diagram of the position of the taken feature vector elements and the corresponding loss function; in the figure, Vi represents the element of the feature vector, where i represents the position in the feature vector.
[0056] Preferably, slicing the first feature vector to obtain a plurality of second feature vectors comprises:
[0057] Starting from the front element of the first feature vector, a preset number of elements of the feature vector are sequentially taken as the second feature vector.
[0058] Preferably, the expression of the second sub-loss function is as follows:
[0059]
[0060] Among them, M represents the number of images in a training set, s, m, and k are all hyperparameters, and θ yi Represents the angle between the feature vector of the i-th image target and its actual category center vector, θ l It represents the angle between the feature vector of the target in the lth image and the center vector of other categories. During training, this loss function will make θj-k as large as possible, thus ensuring that the feature vector is far away from the center vector of other categories, as shown in the figure Figure 3 .
[0061] By using the target feature extraction technology of the present application, the retrieval accuracy of the feature vector with an extraction length of N can be ensured, while the feature elements that "contribute greatly" to the system can be "moved forward", so that when the first M feature elements of the feature vector are extracted for calculation, the retrieval accuracy can also achieve good results.
[0062] This target feature extraction technology combines multiple models in traditional practices into one. While ensuring retrieval accuracy, it integrates the functions that originally required multiple models (each model extracts feature vectors of different lengths) into the same model, achieving efficient fusion of retrieval accuracy, retrieval time and storage space. At the same time, this fusion has business flexibility and can switch the length of extracted features at will according to different businesses, greatly reducing development costs and system complexity and space costs.
[0063] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A feature extraction method for target re-identification, when using an image classification network for training, each different target is regarded as a different category; the image classification network is divided into two sub-networks according to function, the first is a network A for extracting image features, and the second sub-network is set to B, the parameters of sub-network B are defined as category center parameters, and B is classified according to the features output by A; After the classification network training is completed, sub-network B is discarded and sub-network A is retained to extract the features of the image for the task of target re-identification, which is characterized by: include: Get the image to be extracted; Performing feature extraction on the image to be extracted based on a neural network model trained in advance using a slicing method; The training steps of the neural network model are as follows: Get the input image; Inputting the input image into a preset neural network model to obtain a first eigenvector; Slicing the first feature vector, starting from the front element of the first feature vector, sequentially taking a preset number of elements of the feature vector to obtain a second feature vector; Slice the category center parameter to obtain multiple category center parameter slices; the category center parameter slices correspond to the feature vector slices, and the dimension of the original feature vector is defined as: batch_size*N, then the dimension of the original category center parameter needs to be N*class_num, where batch_size is the number of training images, and class_num is the number of classified categories. At this time, during the network forward calculation, the feature vector is multiplied by the category center parameter, and the output dimension is batch_size*class_num, which can be used to judge the classification result; when slicing, if the dimension of the slice taken out of the feature vector is batch_size*m (m<=N), then the category center parameter also needs to take the dimension of the slice as m*class_num, so that the dimension of the slice taken out of the feature vector is consistent with the dimension of the slice taken out of the category center; determining a total loss function based on the class center parameter slice, the second feature vector, the first feature vector, and the class center parameter; Determining a plurality of first sub-loss functions based on the category center parameter slice and the second feature vector; Determining a second sub-loss function based on the first feature vector and the category center parameter; Based on the first sub-loss functions and the second sub-loss functions, the total loss function is determined; the calculation formula of the total loss function is as follows: in, is the total loss function, It is the second sub-loss function of the total loss function; For the The first sub-loss function; is a preset coefficient corresponding to the second sub-loss function; For the a preset coefficient corresponding to the first sub-loss function; is the number of the first loss functions; is the length of the first eigenvector; For the The length of the second feature vector; 0< < ;1< ≤ -1; Among them, M represents the number of images in a training set, s, m, and k are all hyperparameters. Represents the angle between the feature vector of the target in the i-th image and the center vector of its actual category, It means the The angle between the feature vector of the target in the image and the center vector of other categories; The category center parameters and the parameters of the neural network model are updated based on the total loss function.
2. The feature extraction method for target re-identification according to claim 1, characterized in that: The category center parameter slices correspond to the second feature vectors in a one-to-one manner.
3. The feature extraction method for target re-identification according to claim 1, characterized in that: The back propagation method is used to update the category center parameters and the parameters of the neural network model.
