Target identification method and device based on correlation filter
Through the method based on correlation filters, the filter model is trained using HOG features and local retaining divergence matrix, which solves the problem of low target recognition accuracy and achieves higher recognition accuracy and noise immunity.
Patent Information
- Application Number
- CN202411389787.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-06-07
- Filing Date
- 2024-10-08
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the target recognition accuracy is not high, especially in the problem of insufficient mining of image data information and noise interference is easily affected.
Using the target recognition method based on correlation filters, the filter model is trained by obtaining the HOG feature samples of the image, and the weight matrix is constructed using the local maintain divergence matrix and the Gaussian kernel. Combining the Fourier transform and Lagrange multiplier solution, the filter is obtained. Template and identify the target type by PSR value.
It improves the accuracy of target recognition, enhances the anti-interference ability to noise, and enhances the robustness of recognition.
Smart Images

Figure CN119229205A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a target recognition method and device based on correlation filters. Background Art
[0002] Target tracking technology is a hot topic in the current research field of computer vision and image processing, and is widely used in military and civilian fields. In recent years, correlation filters have achieved good results in the fields of target tracking, target detection and target recognition. In actual recognition applications, targets are easily blocked by other objects, such as license plate recognition systems; there are also problems of misidentification due to the high degree of similarity between targets and non-targets, such as face recognition systems in access control. The correlation filter performs a cross-correlation operation on the image to be identified and the filter template to obtain a response output, and identifies the target by comparing the peak to sidelobe ratio (PSR) of the response output. Therefore, it can more accurately calculate the similarity between the filter template and the target, and has certain anti-interference and anti-occlusion capabilities. The support vector machine (SVM) is introduced into the maximum margin correlation filter (MMCF) algorithm of the correlation filter, which further improves the accuracy of target recognition.
[0003] However, there are two problems in MMCF training: first, MMCF only uses sample pixel scalar features and does not sufficiently mine image data information; second, MMCF does not take into account the structural connection between sample data. Insufficient training makes MMCF susceptible to noise interference during recognition, thus making the accuracy of target recognition insufficient. Summary of the invention
[0004] The present invention provides a target recognition method and device based on correlation filter, which are used to solve the defect of low target recognition accuracy in the prior art.
[0005] A target recognition method based on correlation filter, comprising:
[0006] Step 1: Obtain the HOG feature sample corresponding to the target image sample;
[0007] Step 2: training a filter model according to the HOG feature sample;
[0008] Step 3: Determine a filter template according to the filter model;
[0009] Step 4: Determine the PSR value between the HOG feature of the image to be tested and the filter template, and identify the type of the target according to the PSR value.
[0010] Further, in the target recognition method based on correlation filter as described above, the HOG feature samples corresponding to the image samples include:
[0011] Step 11: using a camera to obtain an original image corresponding to the target, and then graying and gamma correcting the original image to obtain a processed image;
[0012] Step 12: Determine the gradient corresponding to each pixel in the processed image, and determine the horizontal gradient component h and the vertical gradient component v corresponding to each pixel according to the gradient corresponding to each pixel;
[0013] Step 13: Determine the gradient magnitude and direction corresponding to each pixel according to the horizontal gradient component h and the vertical gradient component v;
[0014] Step 14: Divide the image sample into a plurality of image units, and determine a gradient histogram corresponding to each image unit according to the gradient magnitude and direction corresponding to each pixel;
[0015] Step 15: combining the gradient histograms corresponding to the adjacent 2×2 image units to obtain a combined feature; and normalizing the combined feature using the L2-norm norm to obtain a local HOG feature corresponding to the 2×2 image units;
[0016] Step 16: Combine all local HOG features corresponding to the image sample to obtain a HOG feature sample of the target image sample.
[0017] Further, in the target recognition method based on correlation filter as described above, the training filter model according to the HOG feature sample includes:
[0018] Step 21: construct a weight matrix in the form of a Gaussian kernel according to the HOG feature sample;
[0019] Step 22: Using the idea of local preservation projection, construct the local preservation divergence matrix Z of the Kth class according to the weight matrix K ;
[0020] Step 23: The local preservation divergence matrix Z of all classes K Sum and construct the local divergence matrix Z w ;
[0021] Step 24: According to the local preservation divergence matrix Z w , train the filter model and obtain the trained filter model.
[0022] Further, in the target recognition method based on correlation filter as described above, determining the filter template according to the filter model includes:
[0023] Step 31: Perform Fourier transform on the filter model and simplify it to obtain a simplified filter model;
[0024]
[0025] Among them, v i Indicates the HOG feature corresponding to the i-th image, g i represents the ideal expected correlation output of the i-th input image; w is the filter template; w T is the transpose of w; Z w is the local preservation divergence matrix; C is the penalty coefficient, ξ i is the slack variable corresponding to the i-th image sample; λ is the balance coefficient, and N is the number of image samples; is the cross-correlation operation; y i is the sample label, b is the bias, c is i is a constant, its positive sample is 1 and its negative sample is 0;
[0026] Formula (7) is transformed into the frequency domain using Fourier transform, where the support vector part is Fourier transformed:
[0027]
[0028] in, is the filter template w in the frequency domain, is the locality preserving divergence matrix Z in the frequency domain w , is the HOG feature data v in the frequency domain, b′=b×d, d is the dimension of the data, b is the offset, represents conjugate transpose;
[0029] The Fourier transform of the correlation filtering part is:
[0030]
[0031] in, is a diagonal matrix in the frequency domain conjugation of; is the ideal expected correlation output g in the frequency domain i ;
[0032] Ignore 1 / d, Can be rewritten as:
[0033]
[0034] Where 1 = [1…1] T , Yes i , and substitute equation (10) into equation (9):
[0035]
[0036]
[0037] in,
[0038] Combining (10) and (11):
[0039]
[0040] Step 32: Determine the Lagrange multiplier of the simplified filter model using the Lagrange dual problem;
[0041]
[0042] Among them, α i , β i is the Lagrange multiplier, and the partial derivative of equation (13) is:
[0043]
[0044] Substituting the result of formula (14) into formula (13), we can get the Wolf dual problem:
[0045]
[0046] Among them, α=[α1,...,α N ] T
[0047] Step 33: Determine a filter template corresponding to the filter model according to the Lagrange multiplier;
[0048] Use the SMO algorithm to solve the Lagrange multiplier vector α, then the frequency domain filter template
[0049]
[0050] Step 34: Apply the frequency domain filter template An inverse Fourier transform is performed to obtain a spatial domain filter template w, and the spatial domain filter template w is used to perform a cross-correlation operation on the HOG features of the image to be tested, and finally the type of the target is identified by a set PSR threshold.
[0051] The target recognition method and device based on correlation filter provided by the present invention can mine the characteristic information of the target by training the filter model with HOG feature, thereby improving the accuracy of target recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 This is a flow chart of the target recognition method based on correlation filter provided by the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] The following is a brief introduction to MMCF:
[0056] The MMCF algorithm is an algorithm that introduces SVM into the correlation filter. SVM is a classic classifier, which is widely used in the fields of pedestrian recognition, face recognition, etc., and has the advantages of good generalization performance and high precision. When the correlation filter was first proposed, it was only for detecting the similarity between signals, but later studies found that it can also be applied to image processing, such as image tracking and image recognition, and has the advantages of good degradability and translation invariance. Therefore, the MMCF introduced by SVM into the correlation filter combines the advantages of the two algorithms and further improves the recognition rate of the correlation filter and SVM in image recognition.
[0057] The support vector machine provided by the present invention is first introduced below:
[0058] Suppose there is a data set The definition of SVM is as follows:
[0059]
[0060] Among them, w is the normal vector of the classification hyperplane, b is the bias, ξ is the slack variable, T represents the transpose, C is the penalty coefficient, and y iis the sample label, which refers to the category to be identified. In general, the sample label is {-1, 1}, the target to be identified is 1, and the non-target is -1; x i Represents the original pixel features of the i-th image.
[0061] The maximum interval correlation filter is introduced below:
[0062] The correlation filter can be viewed as optimizing the Euclidean distance between two correlation outputs: the ideal expected correlation output of the input image, and the correlation output of the training image and the filter template. The filter template is obtained using the correlation filter, which is defined as:
[0063]
[0064] in, is the cross-correlation operation, g i is the ideal expected correlation output of the i-th input image, w represents the filter template, and x i Represents the original pixel features of the i-th image.
[0065] MMCF combines SVM:
[0066]
[0067] Among them, w is both the classification hyperplane normal vector and the filter template, λ is the balance coefficient, c is a constant related to the sample, c i is a constant (1 when the sample data is a target and 0 when it is not a target); ξ i Represents the slack variable corresponding to image i.
[0068] The target recognition method based on correlation filter provided by the present invention is introduced below. Figure 1 The flow chart of the target recognition method based on correlation filter provided by the present invention is as follows: Figure 1 As shown, the method comprises the following steps:
[0069] Step 1: Get the HOG feature sample of the image sample.
[0070] Specifically, HOG feature is a vector feature that calculates the local direction histogram of an image, which can better extract the direction and shape information of the image, so it is widely used in target detection and recognition. The specific method of obtaining it is:
[0071] Step 11: Use a camera to obtain an original image corresponding to the target, and then perform grayscale and gamma correction processing on the original image to obtain a processed image;.
[0072] Specifically, the acquired target original image is normalized. The color and illumination changes of the image sometimes affect the model's recognition of the target, so before extracting the HOG feature, the image is first grayed and gamma corrected.
[0073] Step 12: Determine the gradient of each pixel in the processed image, and determine the horizontal gradient component h and the vertical gradient component v of each pixel according to the gradient of each pixel.
[0074] Specifically, using the gradient operators [-1,0,1] and [1,0,-1] T Calculate the gradient of each pixel in the image, and obtain the horizontal gradient component h and the vertical gradient component v respectively. Then the gradient amplitude G corresponding to each pixel is a for Direction G d for
[0075] Step 13: Determine the gradient magnitude and direction corresponding to each pixel according to the horizontal gradient component h and the vertical gradient component v.
[0076] Step 14: Divide the image into multiple image units, and count the gradient histogram corresponding to each image unit according to the gradient amplitude and direction corresponding to each pixel.
[0077] Specifically, the gradient histogram of the image unit cell is counted. The image is divided into multiple smaller parts, called cells, and the gradient of each pixel in the cell is calculated. Generally, a 9-bin method is used to count the gradient histogram in the cell.
[0078] Step 15: combining the gradient histograms corresponding to the adjacent 2×2 image units to obtain a combined feature; and normalizing the combined feature using the L2-norm norm to obtain a local HOG feature corresponding to the 2×2 image units;
[0079] Step 16: Combine all local HOG features corresponding to the image to obtain a HOG feature sample of the image sample.
[0080] Specifically, the gradient features of the cells in the sliding box (block) are combined. Generally, adjacent 2×2 cells are grouped into a block, the feature vectors of each cell are combined, and the feature vectors are normalized using the L2-norm norm. Thus, the obtained local feature vectors are combined to obtain the HOG features of the image.
[0081] Step 2: Train the filter model based on the HOG feature samples.
[0082] Specifically, the HOG feature is used to obtain the vector features of the target in the image, so as to more accurately characterize the target shape and edge features. The filter model is trained using the HOG feature samples, so that the trained filter model can more accurately identify the target.
[0083] Step three: Determine the filter template according to the filter model.
[0084] Step 4: Determine the PSR value between the HOG feature to be tested and the filter template, and identify the type of the target according to the PSR value.
[0085] The method provided by the present invention can better mine the characteristic information of the target by training the filter model with HOG features, thereby improving the accuracy of target recognition.
[0086] The following is a detailed description of how to train the filter model based on the HOG feature sample, which specifically includes the following steps:
[0087] Step 21: According to the HOG feature samples, a weight matrix is constructed in the form of a Gaussian kernel.
[0088] Step 22: Using the idea of local preservation projection, construct the local preservation divergence matrix Z of the Kth class according to the weight matrix K .
[0089] Step 23: Preserve the local divergence matrix Z for all classes K Sum and construct the local divergence matrix Z w ;
[0090] Step 24: According to the local preservation divergence matrix Z w , train the filter model and obtain the trained filter model.
[0091] Specifically, first, the weight matrix is constructed in the form of a Gaussian kernel: the Euclidean distance between feature data points is calculated, multiple nearest data points of a data point are found by setting the threshold, and the weights are constructed in the form of a Gaussian kernel function. Represents the weights corresponding to the i-th HOG feature and the j-th HOG feature (when the j-th data point is one of the nearest neighbors of the i-th data point in terms of Euclidean distance, the weight is constructed by the Gaussian kernel, otherwise the weight is 0); finally, the weights between each data point are calculated to construct the adjacency graph weight matrix W K , is the adjacency graph weight matrix W K Then, the locality preserving scatter matrix is constructed using the idea of locality preserving projections (LPP) by using the matrix. The specific construction method is as follows:
[0092] First, use the adjacency graph weight matrix W K Construct a diagonal matrix D K , in, is a diagonal matrix D K Elements of the adjacency graph weight matrix W K The sum of the column vectors is constructed into a diagonal matrix D K Diagonal elements at corresponding positions.
[0093] Secondly, using the diagonal matrix D K Construct the locality preserving divergence matrix Z of the Kth class K .
[0094] Finally, the local preserving scatter matrix Z for all classes K The local divergence matrix Z is constructed by summing w , suppose K = 1, 2 two types of sample data, then Z w is defined as follows:
[0095]
[0096] Among them, Z K is the local preservation divergence matrix of the K-th class of data:
[0097]
[0098] Among them, V K is the K-th data matrix. For example, in the access control face recognition system, the K-th data indicates that there are K types of faces (when K = 1, 2 two types of sample data, it is considered that there are two types of faces, one for the current person and the other for everyone else). K -W K is the Laplace matrix of the sample data, which is used to describe the data flow structure. K is a diagonal matrix whose elements It is W K Elements of the matrix, W K is the adjacency graph weight matrix, let v Ki 、v Kj is the characteristic data point of the Kth class sample (in the face recognition system in access control, v Ki represents the i-th data node of the K-th type of face, v Kj The adjacency graph G used to represent the local flow structure of the data has a total of N nodes. If data node i is one of the k nearest neighbors of data node j, then v Ki ∈N K (v Kj ), construct the weight matrix W in the form of Gaussian kernel K, whose elements as follows:
[0099]
[0100] Among them, t is the Gaussian kernel function parameter, N K is the data node v Ki The set of nearest neighbors.
[0101] The method provided by the present invention obtains the structural connection inside the target data by adding a local preserving divergence matrix in the training stage, thereby reducing the influence of noise in the acquired image on the training results, making the training template more robust, and thus improving the accuracy of target recognition.
[0102] The following is a detailed introduction on how to determine the filter template based on the filter model, which specifically includes the following steps:
[0103] Step 31: Perform Fourier transform on the filter model and simplify it to obtain a simplified filter model;
[0104] The local preserving divergence matrix Z w And HOG features are added to the correlation filter model:
[0105]
[0106] Among them, v i represents the HOG feature corresponding to the i-th image, g i represents the ideal expected correlation output for the i-th input image.
[0107] According to the convolution theorem, formula (7) is converted to the frequency domain using Fourier transform to improve the calculation speed. First, the support vector part in the model is Fourier transformed:
[0108]
[0109] in, is the filter template w in the frequency domain, the local preserving divergence matrix Z w , is the HOG feature data v in the frequency domain, b′=b×d, d is the dimension of the data, b is the offset, represents the conjugate transpose.
[0110] The conversion of the correlation filtering part is:
[0111]
[0112] in, is the diagonal matrix of the i-th image data, is g in the frequency domaini (In the present invention, the data with superscript ^ are all the data in the frequency domain after conversion). Ignore 1 / d, Can be rewritten as:
[0113]
[0114] Where 1 = [1…1] T , substitute formula (10) into formula (9):
[0115]
[0116] in, is a diagonal matrix in the frequency domain conjugation of;
[0117] Combining (10) and (11):
[0118]
[0119] Step 32: Determine the Lagrange multiplier of the simplified filter model using the Lagrange dual problem;
[0120] Solve using the Lagrange dual problem:
[0121]
[0122] Among them, α i , β i is the Lagrange multiplier, and the partial derivative of equation (13) is:
[0123]
[0124] Substituting the result of formula (14) into formula (13), we can get the Wolf dual problem:
[0125]
[0126] Among them, α=[α1,...,α N ] T .
[0127] Step 33: Determine the filter template corresponding to the filter model according to the Lagrange multiplier.
[0128] Use the SMO algorithm to solve the Lagrange multiplier vector α and the filter template in the frequency domain
[0129]
[0130] Where Y is the diagonal element yi The diagonal matrix of .
[0131] Step 34: Apply the frequency domain filter template An inverse Fourier transform is performed to obtain a spatial domain filter template w, and the spatial domain filter w is used to perform a cross-correlation operation on the HOG features of the image to be tested, and finally the type of the target is identified by a set PSR threshold.
[0132] Specifically, first calculate the output response matrix of the HOG features of the image to be tested and the filter template w; then calculate the PSR value of the peak response based on the output response matrix; finally, identify the target based on the PSR value of the peak response and the preset PSR threshold. For example: assuming that the target to be identified is a human face, the number of categories is different in different cases, and there are as many categories as there are human faces in the system. Assuming that the data image collected by the system collects 100 people's faces (knowing who these people are), there are 100 categories. Generally, a one-to-many method is used for training and identification, that is, a certain person is taken as the positive class and all other people are taken as the negative class. The filter template corresponding to each person is trained and then cross-correlation operations are performed separately for identification. When the PSR value obtained exceeds the preset value, it is considered to be the person corresponding to this template.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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. However, 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 invention.
Claims
1. A target recognition method based on correlation filter, characterized in that: include: Step 1: Obtain the HOG feature sample corresponding to the target image sample; Step 2: training a filter model according to the HOG feature sample; Step 3: Determine a filter template according to the filter model; Step 4: Determine the PSR value between the HOG feature of the image to be tested and the filter template, and identify the type of the target according to the PSR value.
2. The target recognition method based on correlation filter according to claim 1, characterized in that: The HOG feature samples corresponding to the image samples include: Step 11: using a camera to obtain an original image corresponding to the target, and then graying and gamma correcting the original image to obtain a processed image; Step 12: Determine the gradient corresponding to each pixel in the processed image, and determine the horizontal gradient component h and the vertical gradient component v corresponding to each pixel according to the gradient corresponding to each pixel; Step 13: Determine the gradient magnitude and direction corresponding to each pixel according to the horizontal gradient component h and the vertical gradient component v; Step 14: Divide the image sample into a plurality of image units, and determine a gradient histogram corresponding to each image unit according to the gradient magnitude and direction corresponding to each pixel; Step 15: combining the gradient histograms corresponding to the adjacent 2×2 image units to obtain a combined feature; and normalizing the combined feature using the L2-norm norm to obtain a local HOG feature corresponding to the 2×2 image units; Step 16: Combine all local HOG features corresponding to the image sample to obtain a HOG feature sample of the target image sample.
3. The target recognition method based on correlation filter according to claim 1 is characterized in that: The training of the filter model according to the HOG feature sample comprises: Step 21: construct a weight matrix in the form of a Gaussian kernel according to the HOG feature sample; Step 22: Using the idea of local preservation projection, construct the local preservation divergence matrix Z of the Kth class according to the weight matrix K ; Step 23: The local preservation divergence matrix Z of all classes K Sum and construct the local divergence matrix Z w ; Step 24: According to the local preservation divergence matrix Z w , train the filter model and obtain the trained filter model.
4. The target recognition method based on correlation filter according to claim 1 is characterized in that: Determining the filter template according to the filter model includes: Step 31: Perform Fourier transform on the filter model and simplify it to obtain a simplified filter model; Among them, v i Indicates the HOG feature corresponding to the i-th image, g i represents the ideal expected correlation output of the i-th input image; w is the filter template; w T is the transpose of w; Z w is the local preserving divergence matrix; C is the penalty coefficient, ξ i is the slack variable corresponding to the i-th image sample; λ is the balance coefficient, and N is the number of image samples; is the cross-correlation operation; y i is the sample label, b is the bias, c is i is a constant, its positive sample is 1 and its negative sample is 0; Formula (7) is transformed into the frequency domain using Fourier transform, where the support vector part is Fourier transformed: in, is the filter template w in the frequency domain, is the locality preserving divergence matrix Z in the frequency domain w , is the HOG feature data v in the frequency domain, b′=b×d, d is the dimension of the data, b is the offset, represents conjugate transpose; The conversion of the correlation filtering part is: in, is the diagonal matrix of the i-th image data, is the ideal expected correlation output of the ith input image in the frequency domain; Ignore 1 / d, Can be rewritten as: Where 1 = [1…1] T , substitute formula (10) into formula (9): in, is a diagonal matrix in the frequency domain conjugation of; Combining (10) and (11): Step 32: Determine the Lagrange multiplier of the simplified filter model using the Lagrange dual problem; Among them, α i , β i is the Lagrange multiplier, and the partial derivative of equation (13) is: Substituting the result of formula (14) into formula (13), we can get the Wolf dual problem: Where, α=[α1,...,α N ] T Step 33: Determine a filter template corresponding to the filter model according to the Lagrange multiplier; Use the SMO algorithm to solve the Lagrange multiplier vector α, then the frequency domain filter template Step 34: Apply the frequency domain filter template An inverse Fourier transform is performed to obtain a spatial domain filter template w, and the spatial domain filter template w is used to perform a cross-correlation operation on the HOG features of the image to be tested, and finally the type of the target is identified by a set PSR threshold.