A face detection method and device based on human eye recognition
The face detection method and device leverage eye recognition and neural networks to enhance accuracy by training on eye region differences, addressing false detection issues caused by lighting and position variations.
Patent Information
- Application Number
- CN202410604310.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Face detection methods are prone to false detection due to factors such as lighting and position variations, affecting the accuracy of the detection results.
A face detection method and device based on human eye recognition, utilizing a neural network model trained on difference features of eye regions, which involves determining training and detection difference feature data through pupil center alignment and iterative calculations to improve accuracy.
Enhances face detection accuracy by using artificial intelligence to match target face portrait data based on eye difference characteristics, reducing the impact of external factors and improving robustness.
Smart Images

Figure CN118397683B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face detection, and in particular to a face detection method and device based on human eye recognition. Background Art
[0002] Face images usually contain rich information, such as color, texture, and shape. By using image processing algorithms, these face-related features can be extracted. Eyes are one of the important features of the face, and they are usually located in a specific position in the face image. Therefore, extracting eye features from face images can serve as an important basis for subsequent face detection.
[0003] In the related technology, during the process of face detection, each feature on the face is detected to obtain a match. During a large number of face detection processes, multiple factors such as lighting and position will affect the face image to be detected, so that the final detection result may have the problem of false detection. Summary of the invention
[0004] In order to solve the above technical problems existing in the prior art, an embodiment of the present invention provides a face detection method and device based on human eye recognition. The technical solution is as follows:
[0005] On the one hand, a face detection method based on human eye recognition is provided, the method comprising the following steps:
[0006] Acquire training face portrait data, and determine a first target feature and a second target feature based on the training face portrait data, wherein the first target feature is an eye region image of one side of the face in the training face portrait, and the second target feature is an eye region image of the other side of the face in the training face portrait;
[0007] Determine training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature;
[0008] Constructing an initial neural network model, importing the training difference feature data and the training face portrait data into the initial neural network model and performing iterative calculation;
[0009] Outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used to determine target face portrait data according to target difference feature data;
[0010] Acquire detected face portrait data, and determine target difference feature data based on the detected face portrait data;
[0011] Inputting the target difference feature data into the target neural network model and obtaining the target face portrait data;
[0012] The target face portrait data is matched with the detected face portrait data, and a detection result is determined based on the matching result.
[0013] Optionally, determining training difference feature data based on the first target feature and the second target feature, the training difference feature data being data corresponding to a difference image between the first target feature and the second target feature, includes:
[0014] Acquire a first point based on the first target feature, where the first point is a point where the center of the pupil is located in the eye region image of one side of the face in the training face portrait;
[0015] Acquire a second point based on the second target feature, where the second point is the point where the center of the pupil is located in the eye region image of the other side of the face in the training face portrait;
[0016] constructing an overlapping layer based on the first point and the second point, and determining the difference image based on the overlapping layer;
[0017] The training difference feature data is determined based on the difference image.
[0018] Optionally, determining the training difference feature data based on the difference image includes:
[0019] The difference image is read based on the imread function of the OpenCV library, and converted into a grayscale image using the cvtColor function;
[0020] Use the absdiff function to calculate the grayscale image;
[0021] The imshow function is used to generate the training difference feature data.
[0022] Optionally, constructing an initial neural network model, importing the training difference feature data and the training face portrait data into the initial neural network model and performing iterative calculations, including:
[0023] Determine the weight of the training difference feature data based on the type of the training difference feature data, and divide the training difference feature data into at least three groups based on the weight, wherein each of the groups corresponds to and constitutes a feature vector of the training face portrait data;
[0024] An initial neural network model is constructed based on the feature vector, and the initial neural network model is used to iteratively calculate the training difference feature data and the training face portrait data.
[0025] Optionally, outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used to determine target face portrait data according to target difference feature data, including:
[0026] The target face portrait data is matched with the test face portrait data, and the error value is obtained according to the matching result.
[0027] Optionally, acquiring detected face portrait data, and determining target difference feature data based on the detected face portrait data, includes:
[0028] Determine a third target feature and a fourth target feature based on the detected face portrait data, wherein the third target feature is an eye region image of one side of the face in the detected face portrait, and the fourth target feature is an eye region image of the other side of the face in the detected face portrait;
[0029] Detection difference feature data is determined based on the third target feature and the fourth target feature, where the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature.
[0030] Optionally, the detection difference feature data is determined based on the third target feature and the fourth target feature, the detection difference feature data being data corresponding to a difference image between the third target feature and the fourth target feature, and includes:
[0031] Acquire a third point based on the third target feature, the third point being the point where the center of the pupil is located in the eye region image of one side of the face in the detected face portrait;
[0032] Acquire a fourth point based on the fourth target feature, the fourth point being the point where the center of the pupil is located in the eye region image of the other side of the face in the detected face portrait;
[0033] constructing an overlapping layer based on the third point and the fourth point, and determining the difference image based on the overlapping layer;
[0034] The detected difference feature data is determined based on the difference image.
[0035] Optionally, determining the detection difference feature data based on the difference image includes:
[0036] The difference image is read based on the imread function of the OpenCV library, and converted into a grayscale image using the cvtColor function;
[0037] Use the absdiff function to calculate the grayscale image;
[0038] The imshow function is used to generate the detected difference feature data.
[0039] On the other hand, a face detection device based on human eye recognition is provided, the device implements the above-mentioned face detection method based on human eye recognition, and the device includes:
[0040] A first acquisition module, used to acquire training face portrait data, and determine a first target feature and a second target feature based on the training face portrait data, wherein the first target feature is an eye region image of one side of the face in the training face portrait, and the second target feature is an eye region image of the other side of the face in the training face portrait;
[0041] A first determining module, configured to determine training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature;
[0042] A first construction module is used to construct an initial neural network model, import the training difference feature data and the training face portrait data into the initial neural network model and perform iterative calculation;
[0043] A first calculation module, used for outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used for determining target face portrait data according to target difference feature data;
[0044] A second acquisition module is used to acquire detected face portrait data and determine target difference feature data based on the detected face portrait data;
[0045] A third acquisition module, used for inputting the target difference feature data into the target neural network model and acquiring the target face portrait data;
[0046] The first matching module is used to match the target face portrait data with the detection face portrait data, and determine the detection result according to the matching result.
[0047] Optionally, the device further comprises:
[0048] a fourth acquisition module, configured to acquire a first point position based on the first target feature, wherein the first point position is a point position where a pupil center position is located in an eye region image of one side of a face in the training face portrait;
[0049] a fifth acquisition module, configured to acquire a second point position based on the second target feature, wherein the second point position is a point position where a pupil center position is located in an eye region image of the other side of the face in the training face portrait;
[0050] A second determining module, configured to construct an overlapping layer based on the first point and the second point, and determine the difference image based on the overlapping layer;
[0051] The third determination module is used to determine the training difference feature data based on the difference image.
[0052] Optionally, the device further comprises:
[0053] A first conversion module is used to read the difference image based on the imread function of the OpenCV library and convert it into a grayscale image using the cvtColor function;
[0054] A second calculation module, used for calculating the grayscale image using an absdiff function;
[0055] The first generating module is used to generate the training difference feature data using the imshow function.
[0056] Optionally, the device further comprises:
[0057] A first combining module is used to determine the weight of the training difference feature data based on the type of the training difference feature data, and to divide the training difference feature data into at least three groups based on the weight, wherein each of the groups corresponds to and constitutes a feature vector of the training face portrait data;
[0058] The second construction module is used to construct an initial neural network model based on the feature vector, and the initial neural network model is used to iteratively calculate the training difference feature data and the training face portrait data.
[0059] Optionally, the device further comprises:
[0060] The error determination module is used to match the target face portrait data with the test face portrait data and obtain the error value according to the matching result.
[0061] Optionally, the device further comprises:
[0062] a fourth determination module, configured to determine a third target feature and a fourth target feature based on the detected face portrait data, wherein the third target feature is an eye region image of one side of the face in the detected face portrait, and the fourth target feature is an eye region image of the other side of the face in the detected face portrait;
[0063] The fifth determination module is used to determine detection difference feature data based on the third target feature and the fourth target feature, where the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature.
[0064] Optionally, the device further comprises:
[0065] a sixth acquisition module, configured to acquire a third point position based on the third target feature, wherein the third point position is a point position where a pupil center position is located in an eye region image of a side of the face in the detected face portrait;
[0066] a seventh acquisition module, configured to acquire a fourth point position based on the fourth target feature, wherein the fourth point position is a point position where a pupil center position is located in an eye region image of the other side of the face in the detected face portrait;
[0067] a sixth determining module, configured to construct an overlapping layer based on the third point and the fourth point, and determine the difference image based on the overlapping layer;
[0068] A seventh determination module determines the detection difference feature data based on the difference image.
[0069] Optionally, the device further comprises:
[0070] A second conversion module is used to read the difference image based on the imread function of the OpenCV library and convert it into a grayscale image using the cvtColor function;
[0071] A third calculation module, used for calculating the grayscale image using an absdiff function;
[0072] The second generating module is used to generate the detection difference feature data using the imshow function.
[0073] In another aspect, an electronic device is provided, the electronic device comprising:
[0074] processor;
[0075] A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are loaded and executed by the processor, the steps of the above-mentioned face detection method based on human eye recognition are implemented.
[0076] On the other hand, a computer-readable storage medium is provided, in which a program code is stored. The program code can be called by a processor to execute the steps of the above-mentioned face detection method based on human eye recognition.
[0077] The beneficial effects brought about by the technical solution provided by the present invention include at least:
[0078] The present invention proposes a face detection method and device based on human eye recognition, which adopt artificial intelligence to obtain generated target face portrait data based on the difference characteristics of two eyes in the face portrait to be detected, and match the target face portrait data with the face portrait data to be detected. According to the matching result, a higher matching value proves that the acquired face portrait to be detected is normal and has not been affected by external factors. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0080] Figure 1 It is a flowchart of a face detection method based on human eye recognition provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0081] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment 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.
[0082] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.
[0083] The embodiment of the present invention provides a face detection method based on human eye recognition, which can be implemented by an electronic device, which can be a terminal or a server. Figure 1 As shown, the method comprises the following steps:
[0084] S101: Acquire training facial portrait data, and determine a first target feature and a second target feature based on the training facial portrait data, wherein the first target feature is an eye area image of one side of the face in the training facial portrait, and the second target feature is an eye area image of the other side of the face in the training facial portrait.
[0085] In the process of obtaining training face portrait data, face portrait data from a variety of different scenes, different lighting conditions, different angles and different expressions should be selected as much as possible. For each training sample, its eye area image and other relevant features need to be accurately labeled so that the model can better learn and recognize these features. Based on the training face portrait data, the first target feature and the second target feature can be determined. Among them, the first target feature is the eye area image of one side of the face in the training face portrait, and the second target feature is the eye area image of the other side of the face in the training face portrait. By comparing these features, the completeness of the detection can be better determined.
[0086] S102: Determine training difference feature data based on the first target feature and the second target feature, where the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature.
[0087] Specifically, step S102 includes the following steps:
[0088] S102-1: Acquire a first point based on the first target feature, where the first point is a point where a pupil center is located in an eye region image of one side of the face in the training face portrait.
[0089] The first target feature refers to the center position of the pupil in the eye region image. Image processing technology is usually used to identify the pupil and determine its center position. Among them, it involves the application of algorithms such as edge detection, morphological analysis, and region growing. These algorithms can help extract the outline of the pupil from the image and further determine its geometric center point. In some cases, changes in lighting conditions may affect the visibility of the pupil and the effect of edge detection. Therefore, it may be necessary to use a more adaptive algorithm or combine multiple algorithms to process eye images under different conditions, which is not limited here. In addition, the process of obtaining the center position of the pupil also needs to take into account individual differences. Different people may have different eye sizes, shapes, and colors, which will affect the accuracy of pupil detection. Therefore, in order to improve the generalization ability of the algorithm, it is possible to consider using some adaptive techniques to adjust the algorithm parameters or use multimodal information fusion methods to improve recognition accuracy.
[0090] S102-2: Acquire a second point based on the second target feature, where the second point is the point where the center of the pupil is located in the eye area image of the other side of the face in the training face portrait.
[0091] This step is the same as step S102-1 and will not be described in detail here.
[0092] S102-3: construct an overlapping layer based on the first point and the second point, and determine the difference image based on the overlapping layer.
[0093] In order to ensure the accuracy of the overlap, various algorithms and techniques can be used to align the images. Among them, feature point-based algorithms can be used to achieve alignment by identifying and matching feature points in the images. This method is not only fast but also accurate and can effectively process various types of images. After aligning the images, a difference image can be determined based on the overlapping layers. A difference image refers to the difference between two or more images and can be used to detect changes in images, identify objects, measure displacement, etc. When constructing a difference image, a pixel-level comparison method is used, that is, the pixels in the overlapping area are compared to determine the difference between them. This process can be implemented using various algorithms, such as threshold-based algorithms, morphology-based algorithms, etc.
[0094] S102-4: Determine the training difference feature data based on the difference image.
[0095] Specifically, first, the difference image can be read based on the imread function of the OpenCV library and converted into a grayscale image using the cvtColor function, then the absdiff function is used to calculate the grayscale image, and finally, the imshow function is used to generate the training difference feature data.
[0096] S103: construct an initial neural network model, import the training difference feature data and the training face portrait data into the initial neural network model and perform iterative calculation.
[0097] In the process of building the initial neural network model, the training difference feature data and training face portrait data need to be imported into the model first. The training difference feature data refers to the features extracted during the training process to distinguish different categories. These features are usually reflected in different feature dimensions in the data set. The training face portrait data is a matrix or vector generated based on the training samples to represent the image data.
[0098] Iterative calculation refers to the process of repeatedly calculating the weight parameters of the neural network to gradually optimize the performance of the model. In each iteration, the back propagation algorithm is used to calculate the gradient of the loss function and update the weight parameters based on the gradient information. Through continuous iteration, the error of the model can be gradually reduced and its fit to the training data can be improved. In the process of iterative calculation, appropriate activation functions and loss functions are selected to ensure that the model can correctly learn and classify data.
[0099] Through the above steps, an initial neural network model can be constructed, and its performance can be continuously optimized through iterative calculation. As an implementation method, the weight of the training difference feature data can be determined based on the type of the training difference feature data, and the training difference feature data can be divided into at least three groups based on the weight, wherein each of the groups corresponds to and constitutes a feature vector of the training face portrait data, and then, an initial neural network model is constructed based on the feature vector, and the initial neural network model is used to iteratively calculate the training difference feature data and the training face portrait data.
[0100] S104: Outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used to determine target facial portrait data according to target difference feature data.
[0101] It can be understood that after multiple iterative calculations, the model continuously optimizes and adjusts the network parameters, and finally can accurately determine the target face portrait data based on the target difference feature data, and improve the accuracy and robustness of face recognition.
[0102] As an implementation method, the target face portrait data is matched with the test face portrait data, and an error value is obtained based on the matching result.
[0103] It is understandable that the matching process is based on the similarity of image features. Different algorithms can be used, such as feature extraction + feature comparison, deep learning, etc. Among them, the feature extraction + feature comparison method extracts the geometric features and texture features of the face, and then compares them with the test face portrait data to obtain the matching result.
[0104] S105: Acquire detected facial portrait data, and determine target difference feature data based on the detected facial portrait data.
[0105] Specifically, step S105 includes the following steps:
[0106] S105-1: Determine a third target feature and a fourth target feature based on the detected facial portrait data, wherein the third target feature is an eye area image of one side of the face in the detected facial portrait, and the fourth target feature is an eye area image of the other side of the face in the detected facial portrait.
[0107] S105-2: Determine detection difference feature data based on the third target feature and the fourth target feature, where the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature.
[0108] A third point is obtained based on the third target feature, and the third point is the point where the center of the pupil is located in the eye area image of one side of the detected face portrait; a fourth point is obtained based on the fourth target feature, and the fourth point is the point where the center of the pupil is located in the eye area image of the other side of the detected face portrait; an overlapping layer is constructed based on the third point and the fourth point, and the difference image is determined based on the overlapping layer; and the detection difference feature data is determined based on the difference image.
[0109] Specifically, first, the difference image can be read based on the imread function of the OpenCV library and converted into a grayscale image using the cvtColor function, then the absdiff function is used to calculate the grayscale image, and finally, the imshow function is used to generate the detection difference feature data.
[0110] S106: Input the target difference feature data into the target neural network model and obtain the target face portrait data.
[0111] By inputting these difference data into the neural network model, it can help the model better understand the characteristics of the input data and improve its recognition accuracy. The back propagation algorithm can be used here, which adjusts the weights and parameters of the neural network by calculating the difference between the output and the expected output and backpropagating these differences to the input layer. Through multiple iterations and adjustments, the neural network can gradually improve its prediction results and improve the accuracy of the output target face portrait data. By inputting the target difference feature data into the target neural network model, more accurate target face portrait data can be obtained.
[0112] S107: Match the target face portrait data with the detection face portrait data, and determine the detection result according to the matching result.
[0113] Specifically, feature point matching algorithms, deep learning algorithms, etc. can be used. These algorithms will compare the target face portrait data with the detection face portrait data, and give a matching degree based on the comparison results. The higher the matching degree, the more similar the two faces are, and vice versa.
[0114] After obtaining the matching result, the detection result needs to be determined based on the matching result. Specifically, it can be determined based on a preset threshold. If the matching degree is higher than the threshold, then it can be considered that the detected face and the target face are the same person; otherwise, they are not. The selection of this threshold is very important, because different thresholds may lead to different detection results.
[0115] The present application proposes a face detection method based on human eye recognition. First, training face portrait data is obtained, and a first target feature and a second target feature are determined based on the training face portrait data, wherein the first target feature is an eye area image of one side of the face in the training face portrait, and the second target feature is an eye area image of the other side of the face in the training face portrait. Then, training difference feature data is determined based on the first target feature and the second target feature, and the training difference feature data is data corresponding to the difference image of the first target feature and the second target feature. Then, an initial neural network model is constructed, and the training difference feature data and the training face portrait data are imported into the initial neural network model and iteratively calculated. Then, a target neural network model is output according to the iterative calculation result, and the target neural network model is used to determine the target face portrait data according to the target difference feature data. Then, detection face portrait data is obtained, and target difference feature data is determined based on the detection face portrait data. Then, the target difference feature data is input into the target neural network model and the target face portrait data is obtained. Finally, the target face portrait data is matched with the detection face portrait data, and the detection result is determined according to the matching result. The present application proposes a face detection method based on human eye recognition, which adopts an artificial intelligence approach to obtain generated target face portrait data based on the difference features of the two eyes in the face portrait to be detected, and matches the target face portrait data with the face portrait data to be detected. According to the matching result, a higher matching value proves that the acquired face portrait to be detected is normal and has not been affected by external factors on the image.
[0116] Accordingly, an embodiment of the present invention further provides a face detection device based on human eye recognition, wherein the device implements the above-mentioned face detection method based on human eye recognition, including:
[0117] A first acquisition module, used to acquire training face portrait data, and determine a first target feature and a second target feature based on the training face portrait data, wherein the first target feature is an eye region image of one side of the face in the training face portrait, and the second target feature is an eye region image of the other side of the face in the training face portrait;
[0118] A first determining module, configured to determine training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature;
[0119] A first construction module is used to construct an initial neural network model, import the training difference feature data and the training face portrait data into the initial neural network model and perform iterative calculation;
[0120] A first calculation module, used for outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used for determining target face portrait data according to target difference feature data;
[0121] A second acquisition module is used to acquire detected face portrait data and determine target difference feature data based on the detected face portrait data;
[0122] A third acquisition module, used for inputting the target difference feature data into the target neural network model and acquiring the target face portrait data;
[0123] The first matching module is used to match the target face portrait data with the detection face portrait data, and determine the detection result according to the matching result.
[0124] In some feasible implementations, the following further includes:
[0125] a fourth acquisition module, configured to acquire a first point position based on the first target feature, wherein the first point position is a point position where a pupil center position is located in an eye region image of one side of a face in the training face portrait;
[0126] a fifth acquisition module, configured to acquire a second point position based on the second target feature, wherein the second point position is a point position where a pupil center position is located in an eye region image of the other side of the face in the training face portrait;
[0127] A second determining module, configured to construct an overlapping layer based on the first point and the second point, and determine the difference image based on the overlapping layer;
[0128] The third determination module is used to determine the training difference feature data based on the difference image.
[0129] In some feasible implementations, the following further includes:
[0130] A first conversion module is used to read the difference image based on the imread function of the OpenCV library and convert it into a grayscale image using the cvtColor function;
[0131] A second calculation module, used for calculating the grayscale image using an absdiff function;
[0132] The first generating module is used to generate the training difference feature data using the imshow function.
[0133] In some feasible implementations, the following further includes:
[0134] A first combining module is used to determine the weight of the training difference feature data based on the type of the training difference feature data, and to divide the training difference feature data into at least three groups based on the weight, wherein each of the groups corresponds to and constitutes a feature vector of the training face portrait data;
[0135] The second construction module is used to construct an initial neural network model based on the feature vector, and the initial neural network model is used to iteratively calculate the training difference feature data and the training face portrait data.
[0136] In some feasible implementations, the following further includes:
[0137] The error determination module is used to match the target face portrait data with the test face portrait data and obtain the error value according to the matching result.
[0138] In some feasible implementations, the following further includes:
[0139] a fourth determination module, configured to determine a third target feature and a fourth target feature based on the detected face portrait data, wherein the third target feature is an eye region image of one side of the face in the detected face portrait, and the fourth target feature is an eye region image of the other side of the face in the detected face portrait;
[0140] The fifth determination module is used to determine detection difference feature data based on the third target feature and the fourth target feature, where the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature.
[0141] In some feasible implementations, the following further includes:
[0142] a sixth acquisition module, configured to acquire a third point position based on the third target feature, wherein the third point position is a point position where a pupil center position is located in an eye region image of a side of the face in the detected face portrait;
[0143] a seventh acquisition module, configured to acquire a fourth point position based on the fourth target feature, wherein the fourth point position is a point position where a pupil center position is located in an eye region image of the other side of the face in the detected face portrait;
[0144] a sixth determining module, configured to construct an overlapping layer based on the third point and the fourth point, and determine the difference image based on the overlapping layer;
[0145] A seventh determination module determines the detection difference feature data based on the difference image.
[0146] In some feasible implementations, the following further includes:
[0147] A second conversion module is used to read the difference image based on the imread function of the OpenCV library and convert it into a grayscale image using the cvtColor function;
[0148] A third calculation module, used for calculating the grayscale image using an absdiff function;
[0149] The second generating module is used to generate the detection difference feature data using the imshow function.
[0150] The present invention proposes a face detection device based on human eye recognition. First, training face portrait data is obtained, and a first target feature and a second target feature are determined based on the training face portrait data, wherein the first target feature is an eye area image of one side of the face in the training face portrait, and the second target feature is an eye area image of the other side of the face in the training face portrait. Then, training difference feature data is determined based on the first target feature and the second target feature, and the training difference feature data is data corresponding to the difference image of the first target feature and the second target feature. Then, an initial neural network model is constructed, and the training difference feature data and the training face portrait data are imported into the initial neural network model and iteratively calculated. Then, a target neural network model is output according to the iterative calculation result, and the target neural network model is used to determine target face portrait data according to the target difference feature data. Then, detection face portrait data is obtained, and target difference feature data is determined based on the detection face portrait data. Then, the target difference feature data is input into the target neural network model and the target face portrait data is obtained. Finally, the target face portrait data is matched with the detection face portrait data, and the detection result is determined according to the matching result. A face detection device based on human eye recognition proposed in the present invention adopts an artificial intelligence method to obtain generated target face portrait data based on the difference characteristics of two eyes in the face portrait to be detected, and matches the target face portrait data with the face portrait data to be detected. According to the matching result, a higher matching value proves that the acquired face portrait to be detected is normal and has not been affected by external factors.
[0151] In an exemplary embodiment, the present invention further provides an electronic device, the electronic device comprising:
[0152] processor;
[0153] A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are loaded and executed by the processor, the steps of the above-mentioned face detection method based on human eye recognition are implemented.
[0154] In an exemplary embodiment, the present invention further provides a computer-readable storage medium, wherein at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor to implement the steps of the above-mentioned face detection method based on human eye recognition. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0155] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0156] References in the specification to "one embodiment", "an embodiment", "an exemplary embodiment", "some embodiments", etc. indicate that the described embodiments may include a particular feature, structure, or characteristic, but not every embodiment may include the particular feature, structure, or characteristic. In addition, when a particular feature, structure, or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the relevant art to implement such feature, structure, or characteristic in conjunction with other embodiments (whether or not explicitly described).
[0157] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0158] In the present invention, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0159] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0160] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0163] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0164] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.
[0165] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A face detection method based on human eye recognition, It is characterized in that The following steps are involved: Acquire training face portrait data, and determine a first target feature and a second target feature based on the training face portrait data, wherein the first target feature is an eye region image of one side of the face in the training face portrait, and the second target feature is an eye region image of the other side of the face in the training face portrait; Determine training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature; Constructing an initial neural network model, importing the training difference feature data and the training face portrait data into the initial neural network model and performing iterative calculation; Outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used to determine target face portrait data according to target difference feature data; Acquire detected face portrait data, and determine target difference feature data based on the detected face portrait data; Inputting the target difference feature data into the target neural network model and obtaining the target face portrait data; The target face portrait data is matched with the detected face portrait data, and the detection result is determined according to the matching result.
2. The face detection method based on human eye recognition according to claim 1, It is characterized in that Determining training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature, including: Acquire a first point based on the first target feature, where the first point is a point where the center of the pupil is located in the eye region image of one side of the face in the training face portrait; Acquire a second point based on the second target feature, where the second point is the point where the center of the pupil is located in the eye region image of the other side of the face in the training face portrait; constructing an overlapping layer based on the first point and the second point, and determining the difference image based on the overlapping layer; The training difference feature data is determined based on the difference image.
3. The face detection method based on human eye recognition according to claim 2, It is characterized in that Determining the training difference feature data based on the difference image includes: The difference image is read based on the imread function of the OpenCV library, and converted into a grayscale image using the cvtColor function; Use the absdiff function to calculate the grayscale image; The imshow function is used to generate the training difference feature data.
4. The face detection method based on human eye recognition according to claim 3, It is characterized in that Constructing an initial neural network model, importing the training difference feature data and the training face portrait data into the initial neural network model and performing iterative calculations, including: Determine the weight of the training difference feature data based on the type of the training difference feature data, and divide the training difference feature data into at least three groups based on the weight, wherein each of the groups corresponds to and constitutes a feature vector of the training face portrait data; An initial neural network model is constructed based on the feature vector, and the initial neural network model is used to iteratively calculate the training difference feature data and the training face portrait data.
5. The face detection method based on human eye recognition according to claim 4, It is characterized in that Outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used to determine target face portrait data according to target difference feature data, including: The target face portrait data is matched with the test face portrait data, and the error value is obtained according to the matching result.
6. The face detection method based on human eye recognition according to claim 5, It is characterized in that Acquiring detected face portrait data, and determining target difference feature data based on the detected face portrait data, including: Determine a third target feature and a fourth target feature based on the detected face portrait data, wherein the third target feature is an eye region image of one side of the face in the detected face portrait, and the fourth target feature is an eye region image of the other side of the face in the detected face portrait; Detection difference feature data is determined based on the third target feature and the fourth target feature, where the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature.
7. The face detection method based on human eye recognition according to claim 6, It is characterized in that Determining detection difference feature data based on the third target feature and the fourth target feature, wherein the detection difference feature data is data corresponding to a difference image between the third target feature and the fourth target feature, including: Acquire a third point based on the third target feature, the third point being the point where the center of the pupil is located in the eye region image of one side of the face in the detected face portrait; Acquire a fourth point based on the fourth target feature, the fourth point being the point where the center of the pupil is located in the eye region image of the other side of the face in the detected face portrait; constructing an overlapping layer based on the third point and the fourth point, and determining the difference image based on the overlapping layer; The detected difference feature data is determined based on the difference image.
8. The face detection method based on human eye recognition according to claim 7, It is characterized in that Determining the detection difference feature data based on the difference image includes: The difference image is read based on the imread function of the OpenCV library, and converted into a grayscale image using the cvtColor function; Use the absdiff function to calculate the grayscale image; The imshow function is used to generate the detected difference feature data.
9. A face detection device based on human eye recognition, the device being used to implement the method as claimed in any one of claims 1 to 8, It is characterized in that The device comprises: A first acquisition module, used to acquire training face portrait data, and determine a first target feature and a second target feature based on the training face portrait data, wherein the first target feature is an eye region image of one side of the face in the training face portrait, and the second target feature is an eye region image of the other side of the face in the training face portrait; A first determining module, configured to determine training difference feature data based on the first target feature and the second target feature, wherein the training difference feature data is data corresponding to a difference image between the first target feature and the second target feature; A first construction module is used to construct an initial neural network model, import the training difference feature data and the training face portrait data into the initial neural network model and perform iterative calculation; A first calculation module, used for outputting a target neural network model according to the iterative calculation result, wherein the target neural network model is used for determining target face portrait data according to target difference feature data; A second acquisition module is used to acquire detected face portrait data and determine target difference feature data based on the detected face portrait data; A third acquisition module, used for inputting the target difference feature data into the target neural network model and acquiring the target face portrait data; The first matching module is used to match the target face portrait data with the detection face portrait data, and determine the detection result according to the matching result.
10. An electronic device, It is characterized in that The electronic device comprises: processor; A memory having computer-readable instructions stored thereon, wherein the computer-readable instructions, when loaded and executed by the processor, implement the method according to any one of claims 1 to 8.
