Line of sight estimation method and system
By introducing cross-stage partial modules and adversarial training into the gaze estimation model, the problems of low data utilization and poor generalization ability of the CNN gaze estimation algorithm are solved, and more efficient and robust gaze feature estimation is achieved.
Patent Information
- Application Number
- CN202410953901.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The CNN-based gaze estimation algorithm has the problem of low data utilization during the training process, lacks robustness and generalization, requires a large amount of data to cover various possible gaze directions and eye appearance changes, and is prone to overfitting.
Using the ResNet50 framework combined with CSPNet and GELAN ideas, we build a line of sight estimation model, use cross-stage partial modules to reuse features, improve feature utilization, and generate more diverse and authentic feature representations through adversarial training to reduce overfitting. risk.
It improves the generalization ability and accuracy of the line of sight estimation model, reduces the dependence on the distribution of training data, enhances the adaptability and robustness of the model, and reduces the amount of calculation and memory consumption.
Smart Images

Figure CN118506430B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a line of sight estimation method and system. Background Art
[0002] Gaze estimation algorithms can be divided into geometry-based methods and appearance-based methods. Geometry-based methods rely on key features of the eye, such as the corner of the eye, pupil position, etc., and are accurate in estimation and stable in different domains. However, they have high requirements on the quality and resolution of the image. In order to estimate the gaze without being strictly restricted by the quality and resolution of the image, an appearance-based method is used, which directly learns a model that maps the appearance of the eye or face to the gaze direction. However, the training of the model requires a large amount of data and is prone to domain overfitting.
[0003] To achieve high-precision estimation, the appearance-based CNN (Convolutional Neural Networks) algorithm is used, which uses a convolutional neural network to predict the gaze direction from the appearance image of the eye or face. Gaze estimation is achieved by learning the complex mapping relationship between eye or facial features and gaze direction.
[0004] However, when training CNN-based gaze estimation algorithms, they lack robustness and generalization, and require a large amount of data to cover various possible gaze directions and eye appearance changes. Summary of the invention
[0005] The present application provides a sight line estimation method and system to solve the problem of low data utilization rate using a CNN sight line estimation algorithm.
[0006] In a first aspect, the present application provides a line of sight estimation method, comprising:
[0007] Constructing a sight line estimation model, wherein the sight line estimation model comprises at least a first module, a second module, a third module, a fourth module and a fifth module;
[0008] Passing the image to be detected through the first module to output a feature map, wherein the image to be detected is a face image, and the feature map is a collection of multiple feature values;
[0009] Passing the feature map through a first branch block of the second module, outputting a first residual feature map;
[0010] Inputting the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map;
[0011] Inputting the second residual feature map into a third module, a fourth module and a fifth module in sequence to output a third residual feature map;
[0012] Converting the third residual feature map into a feature vector;
[0013] The feature vector is converted into a probability vector using a normalized exponential layer, wherein the probability vector is used to represent the probability of the corresponding category of the image to be detected;
[0014] The sight line feature of the image to be detected is estimated according to the probability vector, where the sight line feature includes the direction and angle of the sight line.
[0015] In some feasible embodiments, the step of passing the feature map through a first branch block of the second module to output a first residual feature map includes:
[0016] Inputting the feature map into the first convolution layer, the second convolution layer and the first convolution layer in sequence to output a first response map, wherein the first convolution layer is a 1×1 convolution layer of the first branch block, and the second convolution layer is a 3×3 convolution layer of the first branch block;
[0017] Inputting the feature map into the first convolutional layer to output a second response map;
[0018] The first response map and the second response map are activated through an activation function to output a first residual feature map.
[0019] In some feasible embodiments, the step of inputting the first residual feature map into at least two second branch blocks of the second module and outputting a second residual feature map comprises:
[0020] Splitting the first residual feature map into a first part and a second part along the channel dimension;
[0021] Inputting the first part into the first convolution layer, the second convolution layer and the third convolution layer in sequence to output a local response map;
[0022] The local response map and the second part are input into the first convolutional layer to output a second residual feature map, where the second residual feature map includes local feature information and global feature information of the first residual feature map.
[0023] In some feasible embodiments, the step of inputting the first residual feature map into at least two second branch blocks of the second module and outputting a second residual feature map comprises:
[0024] Inputting the first part into a first convolutional layer, and outputting a third response map;
[0025] Inputting the third response map into the second convolutional layer, and outputting a fourth response map;
[0026] Inputting the fourth response map into the first convolutional layer, and outputting a fifth response map;
[0027] Performing a translation operation on the third response graph, the fourth response graph and the fifth response graph, and outputting a translation response graph;
[0028] The second part and the translation response map are respectively input into the first convolutional layer to output a second residual feature map.
[0029] In some feasible embodiments, the step of sequentially inputting the second residual feature map into a third module, a fourth module, and a fifth module to output a third residual feature map includes:
[0030] Inputting the second residual feature map into the first branch block and at least three second branch blocks of the third module in sequence to output a fourth residual feature map;
[0031] Inputting the fourth residual feature map into the first branch block and at least four second branch blocks of the fourth module in sequence to output a fifth residual feature map;
[0032] The fifth residual feature map is sequentially input into the first branch block and at least five second branch blocks of the fifth module to output a third residual feature map.
[0033] In some feasible embodiments, estimating the sight line feature of the image to be detected according to the probability vector includes:
[0034] Use cross entropy loss to calculate the probability of the corresponding category of the image to be detected and the classification loss of the target box label;
[0035] Calculate the expected value of the probability distribution to obtain the predicted line of sight position, where the expected value of the probability distribution is obtained by multiplying the probability value of the pixel by the position coordinate, adding the product values and dividing by the sum of all probability values;
[0036] Calculating a mean square error of an expected value of the probability distribution;
[0037] Adding the mean square error to the cross entropy loss to output a first composite loss;
[0038] The sight line feature of the image to be detected is estimated using the first composite loss.
[0039] In some feasible embodiments, the step of inputting the first residual feature map into at least two second branch blocks of the second module and outputting the second residual feature map comprises:
[0040] Adjusting the width and height of the first residual feature map by upsampling, and adjusting the number of channels of the first residual feature map by a convolution operation to generate a sixth residual feature map, wherein the number of channels, width, and height of the sixth residual feature map are the same as the number of channels, width, and height of the feature map;
[0041] The sixth residual feature map is input into at least two of the second branch blocks.
[0042] In some feasible embodiments, the method further includes:
[0043] Input the feature vectors to a first fully connected layer and a second fully connected layer respectively, and output a yaw angle prediction value and a pitch angle prediction value, wherein the first fully connected layer is used to predict the yaw angle, and the second fully connected layer is used to predict the pitch angle;
[0044] Calculating a second composite loss and a third composite loss, wherein the second composite loss is a loss generated by a gaze binary classification loss and a regression loss of a yaw angle, and the third composite loss is a loss generated by a gaze binary classification loss and a regression loss of a pitch angle;
[0045] Calculating first gradient information and second gradient information, the first gradient information being the gradient of the second composite loss relative to the predicted value of the yaw angle, and the second gradient information being the gradient of the third composite loss relative to the predicted value of the pitch angle;
[0046] The first gradient information is used to update the weights and bias of the first fully connected layer, and the second gradient information is used to update the weights and bias of the second fully connected layer.
[0047] In a second aspect, the present application provides a sight line estimation system, which is used to execute the sight line estimation method described in the first aspect, including:
[0048] A construction unit, the construction unit is used to construct a sight line estimation model, the sight line estimation model at least includes a first module, a second module, a third module, a fourth module and a fifth module;
[0049] An estimation unit, the estimation unit is used to pass the image to be detected through a first module to output a feature map, the image to be detected is a face image, and the feature map is a collection of multiple feature values; and, pass the feature map through a first branch block of the second module to output a first residual feature map; and, input the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map; and, input the second residual feature map into a third module, a fourth module and a fifth module in sequence to output a third residual feature map; and, convert the third residual feature map into a feature vector; and, use a normalized exponential layer to convert the feature vector into a probability vector, the probability vector is used to characterize the probability of the corresponding category of the image to be detected; and, estimate the line of sight features of the image to be detected according to the probability vector, the line of sight features including the direction and angle of the line of sight.
[0050] It can be seen from the above technical scheme that the present application provides a sight estimation method and system, the method comprising: constructing a sight estimation model, the sight estimation model comprising at least a first module, a second module, a third module, a fourth module and a fifth module; passing the image to be detected through the first module to output a feature map, the image to be detected is a face image, and the feature map is a set of multiple feature values; then passing the feature map through the first branch block of the second module to output a first residual feature map; inputting the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map; inputting the second residual feature map into the third module, the fourth module and the fifth module in sequence to output a third residual feature map; converting the third residual feature map into a feature vector; then using a normalized index layer to convert the feature vector into a probability vector, the probability vector is used to characterize the probability of the corresponding category of the image to be detected; estimating the sight feature of the image to be detected according to the probability vector, the sight feature including the direction and angle of the sight. The method realizes the reuse of some features by connecting different branch blocks across stages in the sight estimation model to improve the utilization rate of features. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0052] Figure 1 A schematic diagram of the structure of Resnet50 provided for some embodiments of the present application;
[0053] Figure 2 A schematic diagram of a line of sight estimation method provided in some embodiments of the present application;
[0054] Figure 3 A schematic diagram of the sight line estimation model structure provided in some embodiments of the present application;
[0055] Figure 4 A schematic diagram of a processing flow of a first branch block provided in some embodiments of the present application;
[0056] Figure 5 A schematic diagram of a processing flow of a second branch block provided in some embodiments of the present application;
[0057] Figure 6 A schematic diagram of a processing flow of a second branch block provided for some other embodiments of the present application;
[0058] Figure 7 A schematic diagram of a first composite loss of a Resnet-based sight line estimation network provided in some embodiments of the present application;
[0059] Figure 8 A schematic diagram of the first composite loss of a Resnet sight estimation network based on CSPNet improvement provided in some embodiments of the present application;
[0060] Fig. 9 A schematic diagram of a first composite loss of a line of sight estimation model provided in some embodiments of the present application;
[0061] Fig.10 A schematic diagram of the structure of an estimation system provided for some embodiments of the present application. DETAILED DESCRIPTION
[0062] The following embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following embodiments do not represent all implementations consistent with the present application. They are only examples of systems and methods consistent with some aspects of the present application as detailed in the claims.
[0063] The CNN gaze estimation algorithm based on appearance design is a method that uses a convolutional neural network (CNN) to predict the gaze direction from the appearance image of the eye or face. This method achieves gaze estimation by learning the complex mapping relationship between eye or facial features and gaze direction.
[0064] In the CNN gaze estimation algorithm based on appearance design, a large amount of eye or face image data with gaze direction annotated is required to train the CNN model. Image data can be obtained through special eye tracking equipment or manual annotation. During the training process, the CNN model automatically learns to extract useful features from the image and establishes a mapping relationship between these features and gaze direction.
[0065] Once the model training is complete, it can be applied to the image to be detected, and the gaze direction can be predicted by inputting the appearance image of the eye or face. During the prediction process, the CNN model extracts the features of the input image and estimates the gaze direction based on the learned mapping relationship.
[0066] However, in order to train an accurate model, a large amount of labeled data is required, and it may take a lot of time and resources to collect and process the data. The performance of the model may be affected by the distribution of the training data. If there is a large difference between the training data and the actual usage scenario, the generalization ability of the model may decrease. Complex CNN models may have more parameters and stronger fitting capabilities, but also increase the risk of overfitting. When the model is too complex, it may focus too much on the noise and details in the training data and ignore the essential laws of the data, resulting in reduced performance on new data. And if there is a large deviation between the training data and the actual usage scenario, the model may not be able to adapt to the new environment. For example, the training data may be mainly based on a specific population, lighting conditions or viewing angles, while these factors may be different in actual applications, resulting in limited generalization of the model.
[0067] In this embodiment, ResNet50 (Residual Network) is used. ResNet50 is a deep convolutional neural network model, which contains 50 convolutional layers. ResNet50 is a deep network composed of multiple residual units stacked together, each of which includes a convolutional layer and a jump connection. Among them, the convolutional layer is used to extract the features of the image, while the jump connection allows the input information to directly skip certain layers and be added to the output of the subsequent layers. It helps the model learn the identity mapping, making it easier to optimize the deep network.
[0068] ResNet50 includes input layer, convolution layer, residual block, pooling layer and fully connected layer. Figure 1 , the network structure of ResNet50 can be divided into five stages (Stage), stage 0 to stage 4, each stage contains a different number of residual blocks. The feature map size and number of channels between these stages will change to adapt to the requirements of feature extraction at different levels. Through such a structural design, ResNet50 can alleviate the gradient vanishing problem in deep neural network training while maintaining high performance.
[0069] To solve the problem of low data utilization, this embodiment uses CSPNet (Cross Stage Partial Network), a deep convolutional neural network for image classification. By introducing cross-stage partial modules, information is reused in multiple network stages, thereby achieving efficient use of resources. CSPNet can improve the capabilities of CNN while reducing the amount of computation.
[0070] See also Figure 2 Some embodiments of the present application provide a line of sight estimation method, including:
[0071] S100: constructing a line of sight estimation model.
[0072] The line of sight estimation model is based on the resnet50 framework, combining the CSPNet concept and the GELAN (Generative Latent Adversarial Networks) improved network model. Figure 3 The structure of the sight estimation model provided in this embodiment includes five modules, namely, the first module, the second module, the third module, the fourth module and the fifth module. Among them, the first module is a convolution layer and a maximum pooling layer, the second module is a first branch block and two second branch blocks, the third module is a branch block and three second branch blocks, the fourth module is a first branch block and four second branch blocks, and the fifth module is a first branch block and five second branch blocks.
[0073] Among them, the convolution layer of the first module can be a 64-channel 1×1 convolution kernel, a 64-channel 3×3 convolution kernel, or a 64-channel 7×7 convolution kernel, which is not limited in this embodiment. The convolution layer can also be one or more. The convolution layer is used for feature extraction. After feature extraction, the output size is reduced to half of the input through downsampling through the maximum pooling layer. The first module is mainly used for preliminary feature extraction and size adjustment of the input image. The output of the first module is a feature map, which is composed of multiple eigenvalues.
[0074] The first branch block is the first residual block in the model, which enables the line of sight estimation model to learn the feature representation of the data more deeply; the second branch block is the second residual block in the model, which can deepen the hierarchy of the model to learn the feature representation more effectively, and the jump connection helps to solve the gradient vanishing problem, making the model easier to train. The first branch block and the second branch block both use cross-stage connections, that is, within the first branch block and the second branch block, the features of a certain stage can be directly passed to the subsequent stage to achieve feature reuse, and help reduce information loss in the network and improve feature utilization.
[0075] GELAN performs adversarial training in the latent space between the generator (the forward propagation part of the model) and the discriminator (the auxiliary network or part of the loss function). By introducing adversarial training, the model can generate more diverse and realistic feature representations, thereby improving generalization ability.
[0076] S200: Pass the image to be detected through the first module and output a feature map.
[0077] Among them, the image to be detected is a face image whose sight needs to be detected, and the feature map is a collection of multiple feature values. For the image to be detected, it is first input into the first module, and then passes through the convolution layer and the maximum pooling layer. For example, the input image is (3,224,224), where 3 represents three channels, namely RGB channels, and 224 and 224 represent width and height. After passing through the 64-channel 7×7 convolution kernel, it can also pass through the ReLU (Rectified Linear Unit) function. The nonlinear mapping through the ReLU function can further enhance the representation ability of the model. Effectively extract and emphasize the key features in the image, while accelerating the training process of the model and improving the performance of the model. It can also first pass through BN (Batch Normalization, batch normalization), and then pass through the ReLU function. Through the normalization processing of the BN layer, the distribution of the data is more stable, and then through the ReLU function for nonlinear mapping, the training process of the model can be accelerated, and the stability and generalization ability of the model can be improved. At the same time, due to the role of the BN layer, the model's selection of initial weights and learning rates has also become more robust.
[0078] The max pooling layer reduces the size of the feature map by pooling the feature map output by the convolutional layer, thereby simplifying the network complexity and reducing the amount of computation and memory consumption. At the same time, the max pooling layer can also remove redundant information and retain the most representative features, making the model invariant to smaller changes, redundancies, and transformations in the input image. In addition, the max pooling layer can also expand the receptive field, allowing each output neuron to perceive a larger range of input data. For example, after the max pooling layer, the output feature map is (64,56,56). The output of the max pooling layer is used as the input of the second module.
[0079] S300: Pass the feature map through the first branch block of the second module to output a first residual feature map.
[0080] The first branch block may include multiple convolutional layers. In this embodiment, it includes a first convolutional layer and a second convolutional layer. The first convolutional layer is a 1×1 convolutional layer, and the second convolutional layer is a 3×3 convolutional layer.
[0081] In some embodiments, the feature map is sequentially input into the first convolution layer, the second convolution layer, and the first convolution layer to output a first response map; the feature map is input into the first convolution layer to output a second response map; the first response map and the second response map are activated through an activation function to output a first residual feature map. In other words, the feature map is subjected to different convolution operations to output different response maps, wherein the first response map and the second response map contain different information, and the two response maps are then processed through an activation function. Since the two response maps contain different feature information, after conversion by a nonlinear activation function, the feature information is further emphasized and distinguished, so that the model can simultaneously utilize the information of multiple feature maps, thereby improving the performance of the model.
[0082] See also Figure 4 For example, the feature map is (C, W, W) and is input into the first convolution layer, the second convolution layer, the first convolution layer and the first convolution layer respectively, and the first response map and the second response map are output. After passing the activation function, the first residual feature map is (C*4, W / S, W / s).
[0083] Since the image size processed by the second branch block is the feature map size input to the first branch block, in some embodiments, upsampling is used to adjust the width and height of the first residual feature map, and a convolution operation is used to adjust the number of channels of the first residual feature map to generate a sixth residual feature map, wherein the number of channels, width, and height of the sixth residual feature map are the same as those of the feature map; and the sixth residual feature map is then input into at least two second branch blocks.
[0084] For example, the first residual feature map is (C*4, W / S, W / s), the number of channels C*4 is adjusted to C through convolution operation, and the height and width W / S, W / s are adjusted to W, W through upsampling.
[0085] S400: Input the first residual feature map into at least two second branch blocks of the second module, and output a second residual feature map.
[0086] After obtaining the first residual feature map with the same number of channels and size as the feature map output by the first module, it is input to the second branch block. That is, the output of the first branch block is the input of the second branch block. Since the second module, the third module, the fourth module, and the fifth module all include multiple second branch blocks, the output of the first second branch block is the input of the second second branch block, the output of the second second branch block is the input of the third second branch block, and so on. The output of the last second branch block is the output of the module.
[0087] In some embodiments, the first residual feature map is divided into a first part and a second part along the channel dimension; the first part is sequentially input into the first convolutional layer, the second convolutional layer and the third convolutional layer to output a local response map; the local response map and the second part are input into the first convolutional layer to output a second residual feature map, and the second residual feature map contains local feature information and global feature information of the first residual feature map.
[0088] See also Figure 5 , there are two ways to split the feature map. It can be split along the channel dimension. For example, the channel of the first residual feature map is W, then the channels of the first part and the second part are W / 2 respectively. It can also be split along the spatial dimension, that is, split along the width or height dimension, that is, the first residual feature map is cropped or sliced. In this embodiment, the first residual feature map is split into a first part and a second part using the channel dimension, and the first part and the second part are (C / 2, W, W). After splitting, the first part and the second part respectively contain part of the channel information of the first residual feature map, and the spatial structure of the feature map can be kept unchanged, allowing the convolution layer to perform different processing on different channel groups.
[0089] Among them, the local response map emphasizes the local features of the first residual feature map, and then fuses the local features with the global feature information of the second part through the first convolutional layer, which helps the model to better capture different aspects of the input data. In addition, the local feature map provided in this embodiment is fused with the second part of the first residual feature map by direct connection, which helps to alleviate the problems of gradient disappearance and model degradation in the model. The direct connection method allows the gradient to flow directly back to the earlier layers, thereby accelerating the training process and improving the performance of the model. And through more feature information, the accuracy of line of sight estimation is improved.
[0090] See also Figure 6 In some other embodiments, the first part can be input into the first convolution layer to output a third response map; the third response map is input into the second convolution layer to output a fourth response map; the fourth response map is input into the first convolution layer to output a fifth response map; the third response map, the fourth response map and the fifth response map are then translated to output a translated response map; the second part and the translated response map are respectively input into the first convolution layer to output a second residual feature map.
[0091] By processing two consecutive first and second convolutional layers, feature information at different levels can be extracted. For example, the first convolutional layer extracts shallower features, and the second convolutional layer extracts deeper features. Inputting the first convolutional layer again can reuse features, which helps the model further refine and enhance feature representation.
[0092] Among them, the translation operation can introduce spatial context information and enhance the spatial sensitivity of different response maps. Because this embodiment is used for the line of sight estimation task, that is, the model can understand the spatial position relationship and subtle changes between parts of the pupil, cornea, etc. in the eye image, so as to infer the observer's line of sight. The translation operation can change the spatial position of different response maps, which helps the model better capture and utilize spatial position information.
[0093] Different information can be captured through the third response map, the fourth response map, and the fifth response map. For example, the positional relationship between the pupil and the cornea and the relative position to the surrounding area. In addition, since the line of sight estimation task may be interfered by factors such as illumination changes and head posture changes, the translation operation can increase the model's adaptability to spatial changes, so that the model can still maintain good performance in the face of interference.
[0094] In some embodiments, the third response map, the fourth response map, and the fifth response map may also be analyzed to set the distance and direction of the translation.
[0095] S500: Input the second residual feature map into the third module, the fourth module and the fifth module in sequence to output a third residual feature map.
[0096] See again Figure 3 , the second residual feature map is sequentially input into the first branch block and at least three second branch blocks of the third module to output a fourth residual feature map; the fourth residual feature map is sequentially input into the first branch block and at least four second branch blocks of the fourth module to output a fifth residual feature map; the fifth residual feature map is sequentially input into the first branch block and at least five second branch blocks of the fifth module to output a third residual feature map. That is, the output of the second module is the input of the third module, the output of the third module is the input of the fourth module, and the output of the fourth module is the input of the fifth module.
[0097] In the second module to the fifth module, the number of second branch blocks increases successively, so that the line of sight estimation model can increase the depth of the network while maintaining the gradient flow, thereby extracting higher-level features. In the second and third modules, the model mainly focuses on extracting low-level features such as edges, textures, etc., so fewer second branch blocks are used. In the fourth and fifth modules, the model needs to extract higher-level abstract features to support complex classification or recognition tasks. Therefore, more second branch blocks are used. As the depth of the network increases, the features that can be extracted by each module become richer and more abstract. By gradually increasing the number of second branch blocks, the model can gradually deepen the level and complexity of the features, thereby improving performance in tasks such as image classification.
[0098] S600: Convert the third residual feature map into a feature vector.
[0099] This can be achieved through global average pooling, global maximum pooling, or flattening operations. It can reduce the number of model parameters and the risk of overfitting. In addition, global pooling can integrate spatial information on feature maps, allowing the model to focus more on global features rather than local details.
[0100] S700: Convert the feature vector into a probability vector using a normalized exponential layer.
[0101] After obtaining the feature vector, the model uses a normalized exponential layer (Softmax layer) to convert the feature vector into a probability vector. The Softmax layer converts the input feature vector into a probability distribution through an exponential function and normalization operation. For example, the Softmax layer performs an exponential operation on each element in the feature vector and divides the result by the sum of all elements after the exponential operation to obtain the probability value corresponding to each element. In this way, each element in the output probability vector represents the probability that the input image belongs to the corresponding category, and the sum of the probabilities of all elements is 1.
[0102] The probability vector is used to represent the probability of the corresponding category of the image to be detected, for example, divided into different angle ranges according to the line of sight direction.
[0103] S800: Estimate the sight line features of the image to be detected according to the probability vector.
[0104] Among them, the sight line features include the direction and angle of the sight line.
[0105] To estimate the direction and angle of the line of sight, in some embodiments, the cross entropy loss is used to calculate the probability of the corresponding category of the image to be detected and the classification loss of the target box label; the expected value of the probability distribution is calculated to obtain the predicted line of sight position; the mean square error of the expected value of the probability distribution is calculated; the mean square error is added to the cross entropy loss to output a first composite loss; and the line of sight features of the image to be detected are estimated using the first composite loss.
[0106] The cross entropy loss is a measure of the difference between the probability distribution predicted by the model and the true label distribution. In this embodiment, assuming that the gaze direction can be divided into multiple discrete categories, the model will output a probability vector, where each element represents the probability that the image to be detected belongs to the corresponding gaze direction category. The true label is a one-hot encoded vector that represents the true gaze direction category of the image. By calculating the cross entropy loss between the predicted probability vector and the true label vector, the performance of the model on the classification task can be evaluated.
[0107] Each pixel position is considered as a possible sight point and is assigned a probability value output by the model. The expected value of the probability distribution is the product of the probability value of the pixel and the position coordinate, and the product is added and divided by the sum of all probability values. It can be used as a weighted average of the sight prediction position, which can more accurately reflect the actual position of the sight.
[0108] To evaluate the accuracy of the model in predicting the line of sight position, the mean square error of the expected value of the probability distribution can be calculated. The mean square error is the average of the squares of the differences between the predicted value and the true value, and is very effective for the regression problem of continuous variables. In this embodiment, the actual line of sight position is compared with the expected value position predicted by the model to calculate the mean square error. By adding the mean square error to the cross entropy loss, a composite loss function can be obtained. The first composite loss takes into account the performance of both classification and regression. By adjusting the weight of the mean square error in the composite loss, the performance of the model on classification and regression tasks can be balanced. Using the first composite loss to train the model allows the model to consider the accuracy of classification and regression at the same time during the optimization process. By updating the parameters of the model through the back-propagation algorithm, the model can gradually learn a more accurate representation of line of sight features.
[0109] The smaller the average value of the first composite loss is, the better the accuracy of the network model in classification and regression is, that is, the higher the accuracy of line of sight estimation is. Figure 7-Figure 9 ,in, Figure 7 For the line of sight estimation network model built only with resnet50, Figure 7 2.711 is the average value of the first compound loss. Figure 8 Based on the improved line of sight estimation network model built with resnet50 based on CSPNet, Figure 8 Where 1.25 is the average value of the first compound loss, Fig. 9 The sight line estimation network model built with resnet50 based on CSPNet and GELAN, that is, the sight line estimation model provided in this application, Fig. 9 1.01 is the average value of the first composite loss. It can be seen that among the three network models, the average value of the first composite loss of the sight line estimation model provided by this embodiment is the smallest, that is, the sight line estimation model provided by this application has the highest accuracy for sight line estimation.
[0110] To improve the accuracy of line of sight estimation, in some embodiments, the feature vectors can also be input into the first fully connected layer and the second fully connected layer respectively, and the yaw angle prediction value and the pitch angle prediction value are output. The first fully connected layer is used to predict the yaw angle, and the second fully connected layer is used to predict the pitch angle; the second compound loss and the third compound loss are calculated; the first gradient information and the second gradient information are calculated; the weights and bias of the first fully connected layer are updated using the first gradient information, and the weights and bias of the second fully connected layer are updated using the second gradient information.
[0111] Among them, the second compound loss is the loss generated by the gaze binary classification loss and regression loss of the yaw angle, and the third compound loss is the loss generated by the gaze binary classification loss and regression loss of the pitch angle; the first gradient information is the gradient of the second compound loss relative to the predicted value of the yaw angle, and the second gradient information is the gradient of the third compound loss relative to the predicted value of the pitch angle.
[0112] Two fully connected layers and two composite loss functions are used to optimize the prediction of yaw and pitch angles respectively. For each gaze angle (yaw and pitch), the loss function can be composed of two parts: gaze binary classification and regression component.
[0113] Gaze binary classification is used to determine whether the image under inspection contains a valid gaze (whether someone is looking in a certain direction). The regression component is used to minimize the difference between the predicted gaze angle and the actual gaze angle.
[0114] In the forward propagation phase, the image to be detected passes through the model to generate predicted values of yaw and pitch angles. The two predicted values are compared with their corresponding true values to calculate the value of the composite loss function. The two loss values are back-propagated through the network to update the network weights.
[0115] Two fully connected layers are used to regress each gaze angle independently, that is, in the structure of the neural network, there are two parallel fully connected layers responsible for predicting the yaw and pitch angles respectively. Each fully connected layer receives the feature representation from the previous layer (which may be a convolutional layer or other type of layer) and performs a linear transformation by learning weights and biases.
[0116] During training, the model optimizes its weights by minimizing the difference between the predicted angles and the true angles. This is achieved by using a regression loss function, such as the mean squared error, which calculates the average of the squared differences between the predicted values and the true values. Through the back-propagation algorithm and the gradient descent optimizer, the model gradually adjusts its weights to minimize the loss function and improve the prediction accuracy. The trained model can receive new images to be detected and output the corresponding yaw and pitch angle predictions, thereby regressing the gaze angle.
[0117] Based on the above line of sight estimation method, see Fig.10 Some embodiments of the present application also provide a sight line estimation system, including:
[0118] A construction unit 100, the construction unit 100 is used to construct a sight line estimation model, the sight line estimation model at least includes a first module, a second module, a third module, a fourth module and a fifth module;
[0119] The estimation unit 200 is used to pass the image to be detected through the first module to output a feature map, the image to be detected is a face image, and the feature map is a collection of multiple feature values; and, pass the feature map through the first branch block of the second module to output a first residual feature map; and, input the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map; and, input the second residual feature map into the third module, the fourth module and the fifth module in sequence to output a third residual feature map; and, convert the third residual feature map into a feature vector; and, use a normalized exponential layer to convert the feature vector into a probability vector, the probability vector is used to characterize the probability of the corresponding category of the image to be detected; and, estimate the line of sight features of the image to be detected based on the probability vector, the line of sight features including the direction and angle of the line of sight.
[0120] The present application provides a sight estimation method and system, the method comprising: constructing a sight estimation model, the sight estimation model comprising at least a first module, a second module, a third module, a fourth module and a fifth module; passing an image to be detected through the first module, outputting a feature map, the image to be detected is a face image, and the feature map is a set of multiple feature values; passing the feature map through the first branch block of the second module, outputting a first residual feature map; inputting the first residual feature map into at least two second branch blocks of the second module, outputting a second residual feature map; inputting the second residual feature map into the third module, the fourth module and the fifth module in sequence to output a third residual feature map; converting the third residual feature map into a feature vector; then using a normalized index layer to convert the feature vector into a probability vector, the probability vector is used to characterize the probability of the corresponding category of the image to be detected; estimating the sight feature of the image to be detected according to the probability vector, the sight feature including the direction and angle of the sight. The method realizes the reuse of some features by connecting different branch blocks across stages in the sight estimation model, so as to improve the utilization rate of features.
[0121] Similar parts between the embodiments provided in this application can be referenced to each other. The specific implementation methods provided above are only a few examples under the general concept of this application and do not constitute a limitation on the protection scope of this application. For those skilled in the art, any other implementation methods expanded based on the scheme of this application without creative work belong to the protection scope of this application.
Claims
1. A line of sight estimation method, characterized in that: include: Constructing a sight line estimation model, wherein the sight line estimation model comprises at least a first module, a second module, a third module, a fourth module and a fifth module; Passing the image to be detected through the first module to output a feature map, wherein the image to be detected is a face image, and the feature map is a collection of multiple feature values; Passing the feature map through the first branch block of the second module to output a first residual feature map, including: inputting the feature map to the first convolution layer, the second convolution layer and the first convolution layer in sequence to output a first response map; inputting the feature map to the first convolution layer to output a second response map; the first response map and the second response map pass through an activation function to output a first residual feature map; Inputting the first residual feature map into at least two second branch blocks of the second module, dividing the first residual feature map into a first part and a second part along a channel dimension, so as to output a second residual feature map; The second residual feature map is sequentially input into a third module, a fourth module and a fifth module to output a third residual feature map, wherein the third module includes a first branch block and at least three second branch blocks, the fourth module includes a first branch block and at least four second branch blocks, and the fifth module includes a first branch block and at least five second branch blocks; Converting the third residual feature map into a feature vector; The feature vector is converted into a probability vector using a normalized exponential layer, wherein the probability vector is used to represent the probability of the corresponding category of the image to be detected; The sight line feature of the image to be detected is estimated according to the probability vector, where the sight line feature includes the direction and angle of the sight line.
2. The line of sight estimation method according to claim 1, characterized in that: The first convolution layer is a 1×1 convolution layer of the first branch block, and the second convolution layer is a 3×3 convolution layer of the first branch block.
3. The line of sight estimation method according to claim 1, characterized in that: The step of inputting the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map comprises: Inputting the first part into the first convolution layer, the second convolution layer and the third convolution layer in sequence to output a local response map; The local response map and the second part are input into the first convolutional layer to output a second residual feature map, where the second residual feature map includes local feature information and global feature information of the first residual feature map.
4. The line of sight estimation method according to claim 1, characterized in that: The step of inputting the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map comprises: Inputting the first part into a first convolutional layer, and outputting a third response map; Inputting the third response map into the second convolutional layer, and outputting a fourth response map; Inputting the fourth response map into the first convolutional layer, and outputting a fifth response map; Performing a translation operation on the third response graph, the fourth response graph and the fifth response graph, and outputting a translation response graph; The second part and the translation response map are respectively input into the first convolutional layer to output a second residual feature map.
5. The line of sight estimation method according to claim 1, characterized in that: The step of sequentially inputting the second residual feature map into a third module, a fourth module, and a fifth module to output a third residual feature map comprises: Inputting the second residual feature map into the first branch block and at least three second branch blocks of the third module in sequence to output a fourth residual feature map; Inputting the fourth residual feature map into the first branch block and at least four second branch blocks of the fourth module in sequence to output a fifth residual feature map; The fifth residual feature map is sequentially input into the first branch block and at least five second branch blocks of the fifth module to output a third residual feature map.
6. The sight line estimation method according to claim 1, characterized in that: The estimating the sight line feature of the image to be detected according to the probability vector comprises: Use cross entropy loss to calculate the probability of the corresponding category of the image to be detected and the classification loss of the target box label; Calculate the expected value of the probability distribution to obtain the predicted line of sight position, where the expected value of the probability distribution is obtained by multiplying the probability value of the pixel by the position coordinate, adding the product values and dividing by the sum of all probability values; Calculating a mean square error of an expected value of the probability distribution; Adding the mean square error to the cross entropy loss to output a first composite loss; The sight line feature of the image to be detected is estimated using the first composite loss.
7. The sight line estimation method according to claim 1, characterized in that: The step of inputting the first residual feature map into at least two second branch blocks of the second module to output a second residual feature map comprises: Adjusting the width and height of the first residual feature map by upsampling, and adjusting the number of channels of the first residual feature map by a convolution operation to generate a sixth residual feature map, wherein the number of channels, width, and height of the sixth residual feature map are the same as the number of channels, width, and height of the feature map; The sixth residual feature map is input into at least two of the second branch blocks.
8. The sight line estimation method according to claim 1, characterized in that: The method further comprises: Input the feature vectors to a first fully connected layer and a second fully connected layer respectively, and output a yaw angle prediction value and a pitch angle prediction value, wherein the first fully connected layer is used to predict the yaw angle, and the second fully connected layer is used to predict the pitch angle; Calculating a second composite loss and a third composite loss, wherein the second composite loss is a loss generated by a gaze binary classification loss and a regression loss of a yaw angle, and the third composite loss is a loss generated by a gaze binary classification loss and a regression loss of a pitch angle; Calculating first gradient information and second gradient information, the first gradient information being the gradient of the second composite loss relative to the predicted value of the yaw angle, and the second gradient information being the gradient of the third composite loss relative to the predicted value of the pitch angle; The first gradient information is used to update the weights and bias of the first fully connected layer, and the second gradient information is used to update the weights and bias of the second fully connected layer.
9. A line of sight estimation system, characterized in that: The method for performing the sight line estimation method according to any one of claims 1 to 8 comprises: A construction unit, the construction unit is used to construct a sight line estimation model, the sight line estimation model at least includes a first module, a second module, a third module, a fourth module and a fifth module; An estimation unit, the estimation unit is used to pass the image to be detected through a first module to output a feature map, the image to be detected is a face image, and the feature map is a set of multiple feature values; and the feature map is passed through a first branch block of the second module to output a first residual feature map, including: inputting the feature map to a first convolutional layer, a second convolutional layer, and a first convolutional layer in sequence to output a first response map; inputting the feature map to the first convolutional layer to output a second response map; the first response map and the second response map are activated through an activation function to output a first residual feature map; and inputting the first residual feature map into at least two second branch blocks of the second module to divide the first residual feature map into a first part along a channel dimension. The invention relates to a method for detecting a first residual feature map and a second residual feature map, wherein the first residual feature map is input into a third module, a fourth module and a fifth module in sequence to output a third residual feature map, wherein the third module comprises a first branch block and at least three second branch blocks, the fourth module comprises a first branch block and at least four second branch blocks, and the fifth module comprises a first branch block and at least five second branch blocks; and, the third residual feature map is converted into a feature vector; and, the feature vector is converted into a probability vector using a normalized exponential layer, wherein the probability vector is used to characterize the probability of the corresponding category of the image to be detected; and, the line of sight feature of the image to be detected is estimated according to the probability vector, wherein the line of sight feature comprises the direction and angle of the line of sight.
