A face recognition method and device based on InsightFace and LIS file management
Through the face recognition method of InsightFace and LIS file management, local features of the face image are extracted and classified in the LIS color space. Combined with low-rank decomposition and weighted sparse representation, the problem of low face recognition accuracy in the existing technology is solved. , achieving a more efficient recognition effect.
Patent Information
- Application Number
- CN202410585413.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-05-13
AI Technical Summary
Existing face recognition technology cannot effectively extract local features of face images, and is easily interfered by external background, resulting in low recognition accuracy.
The face recognition method based on InsightFace and LIS file management is used to collect face images in real time, locate the features of multiple face parts, convert them into high-dimensional face embedding vectors, and classify them in the LIS color space to extract low-dimensional people. Face features, combined with low-rank decomposition and weighted sparse representation, reduce background interference and improve recognition efficiency.
It improves the accuracy and reliability of face recognition, enhances the extraction of face area features, reduces interference, improves recognition efficiency, and avoids inaccurate recognition problems caused by illumination changes, occlusions and facial dirt.
Smart Images

Figure CN118230395B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face recognition, and in particular to a face recognition method and device based on InsightFace and LIS file management. Background Art
[0002] Face recognition algorithms are algorithms used to identify and verify the identity of an individual or analyze facial image features. They are widely used in various ways in real life, such as access control, mobile phone unlocking, city monitoring, and exam monitoring.
[0003] Existing face recognition technologies either fail to consider extracting local features of face images through multiple training samples, or fail to consider that faces may be disturbed by external background when embedded, which may make the face image unclear and result in low face recognition accuracy. Summary of the invention
[0004] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and to propose a face recognition method and device based on InsightFace and LIS file management, which can improve the accuracy of face recognition.
[0005] In a first aspect, the present invention provides a face recognition method based on InsightFace and LIS file management, comprising:
[0006] Acquire an initial first face image in real time, locate multiple face part features of the first face image, and when performing face embedding according to the multiple face part features, convert the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image;
[0007] Acquire color features of the second face image in the LIS color space, and classify the face area and the non-face area according to the color features to obtain location data of the face area on the second face image; wherein the LIS color space includes: brightness, information content and saturation;
[0008] A second high-dimensional face embedding vector corresponding to the position data is obtained from the second face image, and low-dimensional face features are extracted from the second high-dimensional face embedding vector, and face recognition is performed based on the low-dimensional face features.
[0009] The present invention uses facial part feature positioning for facial images to extract the features of each organ on the face separately, realize the extraction of local features of the facial image, and convert the obtained facial part features into facial embedding vectors, which is convenient for comparing and identifying facial images. The LIS color space is also used to classify facial areas and non-face areas, which is convenient for locating high-dimensional facial embedding vectors in the facial image according to the obtained position data, and can ensure that the high-dimensional facial embedding vectors in the accurate facial areas are obtained, while ignoring the interference of non-face areas, thereby improving the accuracy and reliability of image detection; the present invention also extracts low-dimensional facial features from the second high-dimensional facial embedding vector to reduce the dimension of the facial features, thereby accelerating the efficiency of facial recognition.
[0010] In combination with the first aspect, in some embodiments, obtaining the color feature of the second facial image in the LIS color space includes:
[0011] Obtain a color representation of the second facial image in terms of brightness, information and saturation, and extract color features based on the color representation; wherein the color features include: complexion, skin texture and hair color.
[0012] The present invention uses the LIS color space to extract color features of facial images in the LIS color space of brightness (Light), information content (Information content) and saturation (Saturation), and can obtain color feature representations of the complexion, skin texture, hair color, etc. of the person, thereby facilitating the distinction between facial areas and non-facial areas, avoiding interference of non-facial areas on facial recognition, and thus improving the accuracy and reliability of image detection.
[0013] In combination with the first aspect and the foregoing embodiment, extracting low-dimensional facial features from the second high-dimensional face embedding vector includes:
[0014] The second high-dimensional face embedding vector is respectively subjected to low-rank decomposition and weighted sparse representation to obtain a low-dimensional face feature with high data content obtained by converting the second high-dimensional face embedding vector.
[0015] The present invention adopts low-rank decomposition of high-dimensional face embedding vectors, represents each image as an approximation of a low-rank matrix, so as to extract important information features while ignoring other interfering information features, and combines weighted sparse representation to weight important information features and enhance important facial part features to obtain low-dimensional facial features with high data content, thereby reducing interference, enhancing useful features, and representing useful features in a low-dimensional form, which not only reduces background interference, but also reduces the model's demand for data volume, thereby improving the accuracy of face recognition while improving recognition efficiency.
[0016] In combination with the first aspect and the foregoing embodiment, the step of performing low-rank decomposition on the second high-dimensional face embedding vector includes:
[0017] Performing low-rank decomposition on the second high-dimensional face embedding vector, using the obtained low-dimensional first low-rank decomposition result as an anchor sample, and obtaining positive samples belonging to the same portrait as the anchor sample and negative samples different from the anchor sample;
[0018] According to the ternary loss function established by the anchor sample, the positive sample and the negative sample, a second low-rank decomposition result with discriminativeness is obtained, so that a low-dimensional facial feature is obtained according to the second low-rank decomposition result.
[0019] The present invention adopts the method of expressing the high-dimensional face embedding vector as an approximation of a low-rank matrix and introduces a discriminative loss function to ensure that the features after low-rank decomposition have good discriminability in the face recognition task, thereby improving the accuracy of retaining useful information features and removing interference information features, and solving the problem of inaccurate facial recognition caused by factors such as illumination changes, occlusion and facial dirt during face recognition, thereby improving the accuracy of face recognition.
[0020] In combination with the first aspect and the foregoing embodiment, obtaining low-dimensional facial features according to the second low-rank decomposition result includes:
[0021] According to the basis vectors corresponding to the second low-rank decomposition result in the second face image, weights are introduced to enhance the features of facial parts to obtain low-dimensional facial features with high data content; wherein the second face image is represented by a linear combination of a set of basis vectors.
[0022] In combination with the first aspect and the above embodiment, the performing face recognition according to the low-dimensional face features includes:
[0023] Matching the low-dimensional facial features with facial features of a stored third facial image to obtain an identity verification result;
[0024] Performing a face authenticity check on the first face image according to the spectrum information of the transparency image collected from the first face image to obtain a face authenticity result;
[0025] According to the identity authentication result and the face authenticity result, a recognition result of the first face image is obtained, and the recognition result is stored in the blockchain.
[0026] The present invention extracts features of facial parts and judges the authenticity of facial images at the same time, thereby improving the discrimination accuracy of facial recognition, preventing fake and forged portraits from successfully passing facial recognition, and further improving the accuracy of facial recognition.
[0027] In combination with the first aspect and the above-mentioned embodiment, performing a face authenticity check on the first face image according to the spectral information of the transparency picture collected from the first face image to obtain a face authenticity result includes:
[0028] According to the infrared spectrum of the transparency image collected from the first facial image, determining whether there is a mask material in the first facial image that has a different reflection or absorption of infrared radiation from real skin;
[0029] Alternatively, judging whether there is a mask material with abnormal reflection or absorption of ultraviolet light in the first face image according to the ultraviolet spectrum of the transparency image collected from the first face image;
[0030] Alternatively, judging whether there is a mask material with abnormal reflection or absorption of fused light in the first face image according to a fused spectrum of multi-wavelength fusion of a transparency image collected from the first face image;
[0031] If the mask material exists in the first face image, the face authenticity result is false; if the mask material does not exist in the first face image, the face authenticity result is true;
[0032] Wherein, the spectral information includes: the infrared spectrum, the ultraviolet spectrum and the fusion spectrum.
[0033] The present invention uses infrared spectrum, ultraviolet spectrum or fusion spectrum to identify the authenticity of human faces, and can detect deceptive methods such as using masks, photos or videos, thereby effectively improving the discrimination accuracy of face recognition, avoiding the situation where fake and counterfeit portraits successfully pass face recognition and cause illegal access, thereby improving the accuracy and reliability of face recognition.
[0034] In combination with the first aspect and the above embodiment, the real-time acquisition of the initial first face image includes:
[0035] Collect multiple mode pictures of face images, pre-process the multiple mode pictures, and save the obtained pre-processed images into LIS file management, so that the images can be read from the LIS file management to obtain the first face image; wherein the multiple mode pictures include: color pictures, grayscale pictures and transparency pictures.
[0036] The present invention adopts Library and Information Science (LIS) file management, which can uniformly process facial images, thereby ensuring the uniformity of the source of facial recognition images and facilitating facial recognition.
[0037] In combination with the first aspect and the above embodiment, when performing face embedding according to the multiple face part features, converting the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image includes:
[0038] According to the residual face embedding network based on the trained first InsightFace face recognition algorithm and combined with the network structure composed of a convolutional attention module and a depth-level separable convolution, multiple local face part features are converted into a feature-enhanced first high-dimensional face embedding vector to obtain an embedded second face image.
[0039] In a second aspect, the present invention provides a face recognition device based on InsightFace and LIS file management, comprising: an embedding module, a face region classification module and a recognition module; wherein,
[0040] The embedding module is used to collect an initial first face image in real time, locate multiple face part features of the first face image, and when performing face embedding according to the multiple face part features, convert the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image;
[0041] The face region classification module is used to obtain the color features of the second face image in the LIS color space, and classify the face region and the non-face region according to the color features to obtain the position data of the face region on the second face image;
[0042] The recognition module is used to obtain a second high-dimensional face embedding vector corresponding to the position data from the second face image, extract low-dimensional face features from the second high-dimensional face embedding vector, and perform face recognition based on the low-dimensional face features. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a flowchart of a face recognition method based on InsightFace and LIS file management provided in an embodiment of the present application;
[0044] Figure 2 It is a complete flow chart of a face recognition method based on InsightFace and LIS file management provided in an embodiment of the present application;
[0045] Figure 3 It is a schematic diagram of the process of facial image acquisition provided by an embodiment of the present application;
[0046] Figure 4 It is a schematic diagram of the process of extracting facial features provided by an embodiment of the present application;
[0047] Figure 5 is a schematic diagram of a facial region for local feature extraction provided by an embodiment of the present application;
[0048] Figure 6 is a schematic diagram of a face embedding model provided in an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the face recognition process provided by the embodiment of the present application;
[0050] Figure 8 It is a schematic diagram of the structure of face recognition provided by an embodiment of the present application;
[0051] Fig. 9 It is a structural schematic diagram of a face recognition device based on InsightFace and LIS file management provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] Example 1
[0054] See also Figure 1 , is a flow chart of a face recognition method based on InsightFace and LIS file management provided in an embodiment of the present application, including steps S11 to S13, specifically:
[0055] Step S11, collecting an initial first face image in real time, and locating multiple face part features of the first face image, when performing face embedding according to the multiple face part features, converting the multiple face part features into multiple first high-dimensional face embedding vectors respectively, to obtain an embedded second face image.
[0056] In some embodiments, real-time acquisition of an initial first facial image includes: acquiring multiple mode screens of the facial image, preprocessing the multiple mode screens, and saving the obtained preprocessed images to LIS file management, so that the image can be read from the LIS file management to obtain the first facial image; wherein the multiple mode screens include: color screens, grayscale screens, and transparency screens.
[0057] It is worth noting that the first face image is a face image read from the LIS file management, and the second face image is a face image obtained after embedding the face.
[0058] It is worth mentioning that Library and Information Science (LIS) file management is used to save the collected facial images for subsequent processing or analysis, so that the collected facial images can be processed and compared with the pre-stored facial images.
[0059] In some embodiments, the plurality of mode images are pre-processed, including at least one of denoising, contrast enhancement or image size normalization, to improve subsequent facial image contrast effects.
[0060] In some embodiments, a terminal is used to configure a camera for facial image acquisition, specifically including: first adjusting the resolution of the camera configured by the terminal to 1080p (1920x1080 pixels) and manually focusing until the camera brightness is adjusted to 80% and the contrast is 60% to ensure that the quality of the facial image acquired by the camera is improved, and then programming the camera through the open source computer vision library (OpenCV) and the cv2 library of the Python programming language to read the three image background displays of the color picture, grayscale picture and transparency picture of the same image, and then obtaining three different display effects of the image through the three different channels to more clearly identify the image, so as to more accurately judge the authenticity of the facial image, and then use the programming interface to access the camera to acquire the facial image, and then save the acquired facial image to the LIS file management for subsequent comparison, analysis and verification.
[0061] In some embodiments, the specific parameter pairs of the cv2 library include: cv2 library, cv2.imread function and return value; wherein, the cv2 library is a Python programming language binding of the open source computer vision library, and the cv2 library is used to read, display and save images; the cv2.imread function is used to read image files; the return value returns multiple mode images represented by NumPy arrays; wherein the multiple mode images include: color images, grayscale images and transparency images; wherein NumPy is a Python toolkit.
[0062] In some embodiments, the multiple mode images are preprocessed, and the preprocessed images are bound to the seat account in the data control to ensure that each face has a unique identification account, thereby improving the security of the face algorithm.
[0063] In some embodiments, the multiple mode images are pre-processed, and features of the pre-processed images are bound to the agent accounts in the data control.
[0064] It is worth noting that when the face recognition result is obtained, the recognition result will be fed back to the agent account through the recognition account to indicate whether the face recognition and identity authentication corresponding to the agent account are successful.
[0065] In some embodiments, locating multiple facial part features of the first facial image includes: using a Haar cascade classifier or a facial key point detector to detect and locate local parts (i.e., facial parts) concentrated in the collected facial image, thereby achieving detection and positioning collection of local parts.
[0066] It is worth noting that the Haar cascade classifier is a strong classifier cascade classifier based on Haar-like features, which is accelerated by integral graph operation combined with Adaboost training. The construction of Haar-like features includes: representing the area demarcated in the image with two sub-regions of the same number of pixels, and giving different weights to the two sub-regions, respectively calculating the sum of weighted pixels in the two sub-regions of the designated area, and taking the difference of the sum of weighted pixels in the two sub-regions as the Haar-like feature. The value of the Haar-like feature can reflect the color change of the area.
[0067] In some embodiments, the detection and positioning acquisition of local parts includes: local feature areas located in the face image, the local feature areas include: at least one of eyes, nose, mouth, face shape, chin or ears, and for each local feature area, a feature extraction method is used for extraction.
[0068] In some embodiments, the feature extraction method includes: using a similarity measurement method to measure the distance between two feature vectors for each local feature through the Euclidean distance similarity measurement method, which is used to compare the similarity between feature vectors in face recognition; wherein, during training, the training samples are also compared for the corresponding local features through the same method.
[0069] In some embodiments, the distance between two feature vectors is measured by the Euclidean distance similarity measurement method and is expressed as:
[0070] ,
[0071] in, Representation characteristics and Features The Euclidean distance between It is a feature The characteristic value of It is a feature The characteristic value of .
[0072] In some embodiments, the distance between two feature vectors is repeatedly calculated through the calculation formula of the Euclidean distance similarity measurement method, and the distance is compared after more than three calculations, so that the similarity between the extracted local features and the collected facial images is improved. The higher the similarity of the local features, the closer they are, which facilitates the subsequent auxiliary face recognition and improves the reliability and accuracy of face recognition.
[0073] In some embodiments, during the training process, at least one of data enhancement, collecting multiple data types, constructing data, or transfer learning is used to increase the number of training samples. Increasing the number of training samples is generally used to improve the performance of face recognition because more samples help the model better learn the changes and features of the face.
[0074] In some embodiments, data enhancement includes: in face recognition, data enhancement applies at least one of rotation, flipping, scaling or translation to expand the training set, which helps the model adapt to different postures, lighting conditions and expressions.
[0075] In some embodiments, collecting more data includes: collecting more facial image data, which is achieved by taking more photos at different angles, different lighting conditions and different backgrounds in a multi-dimensional and multi-space manner.
[0076] In some embodiments, constructing data includes: using computer graphics technology to generate synthetic facial images, these constructed facial images include: multiple combinations of expressions, ages and genders, the advantage of synthetic data is that the changes can be precisely controlled and a large number of samples can be generated.
[0077] In some embodiments, transfer learning includes: using a model that has been trained on other tasks (such as a pre-trained convolutional neural network) to perform transfer learning, effectively expanding the training data, and fine-tuning the pre-trained model to adapt it to the face recognition task, thereby accelerating the training process and improving performance.
[0078] In some embodiments, when face embedding is performed based on the multiple facial part features, the multiple facial part features are respectively converted into multiple first high-dimensional face embedding vectors to obtain an embedded second face image, including: based on a trained first InsightFace face recognition algorithm and a residual face embedding network with a network structure consisting of a convolutional attention module and a depth-level separable convolution, the local multiple facial part features are converted into a feature-enhanced first high-dimensional face embedding vector to obtain the embedded second face image.
[0079] It is worth mentioning that the InsightFace face recognition algorithm is an open source 2D / 3D face analysis tool based on Pytorch and MXNet, which can identify, detect and align faces; CBAM (Convolutional Block Attention Module) is an attention module for feedforward convolutional neural networks. It is an attention mechanism module that combines spatial and channel. When a feature map is given, CBAM will infer the attention map along two independent dimensions (spatial and channel) in sequence, and then multiply the attention map with the input feature map to obtain the final feature for adaptive feature optimization; the residual face embedding network is a face embedding network based on the residual neural network (ResNet) of the CBAM-MobileNet network structure. The first high-dimensional face embedding vector is the initial high-dimensional face embedding vector of the face part feature, and the second high-dimensional face embedding vector is the first high-dimensional face embedding vector of the face part feature after the first InsightFace face recognition algorithm is trained, and combined with the residual face embedding network of the network structure composed of the convolutional attention module and the depth-level separable convolution. The first InsightFace face recognition algorithm is an InsightFace face recognition algorithm with converged loss function obtained after training the initial InsightFace face recognition algorithm. The local multiple face part features include: after dividing the face into multiple local parts, the features corresponding to each part.
[0080] In some embodiments, the InsightFace face recognition algorithm based on the MobileNetV2 network structure is used, combined with a residual face embedding network with a network structure consisting of a convolutional attention module and a depth-level separable convolution, to convert local features into face embedding vectors. The goal of this step is to encode facial information into a high-dimensional vector for comparison and matching.
[0081] In some embodiments, the network structure of MobileNetV2 includes: depthwise separable convolution, dilated convolution, and residual connection technology to reduce the number of parameters and computational complexity while maintaining model performance; among them, MobileNetV2 is embodied in: lightweight structure; depthwise separable convolution; dilated convolution; residual connection.
[0082] In some embodiments, the CBAM module is integrated into the depthwise separable convolution of MobileNet via CBAM-MobileNet to enhance the attention to image features.
[0083] It is worth noting that MobileNetV2 already has deep separable convolution and lightweight features, which is suitable for face embedding tasks on mobile devices. The CBAM module usually includes channel attention and spatial attention.
[0084] In some embodiments, the network result of the InsightFace face recognition algorithm based on the MobileNetV2 network structure includes: input, convolution layer, CBAM module, global pooling layer, dense layer and CBAM-residual face embedding network connected in sequence; wherein, the convolution layer is a depth-separable convolution layer of MobileNetV2; the CBAM module includes: channel attention and spatial attention, which are used to enhance the representation ability of the feature map; the global pooling layer is usually global average pooling, which reduces the dimension of the feature map to a one-dimensional vector; the dense layer is used to generate a face embedding vector; then the CBAM-residual face embedding network is used as input, and finally the face embedding high-dimensional vector is output, which is convenient for comparing and identifying and matching face images.
[0085] Step S12, obtaining color features of the second facial image in the LIS color space, and classifying the face area and the non-face area according to the color features to obtain position data of the face area on the second facial image; wherein the LIS color space includes: brightness, information content and saturation.
[0086] In some embodiments, a color representation of the second facial image in terms of brightness, information content and saturation is obtained, and color features are extracted based on the color representation; wherein the color features include: complexion, skin texture and hair color.
[0087] It is worth mentioning that LIS color space is a color representation method based on brightness (Light), information content (Information content) and saturation (Saturation), which ensures the improvement of contrast and discrimination of face areas and extracts color features, including complexion, skin texture and hair color, which are used to distinguish between face and non-face areas. For each image, it is converted into LIS color space. Information content is the content represented by all pixels in each layer, not embedded representation. For example, the "information" in a photo can represent content such as faces, working environments or animals.
[0088] In some embodiments, the obtained color features are used as inputs of an improved Adaboost classifier to classify face regions and non-face regions; wherein the improved Adaboost algorithm performs weighting according to the importance of the color features to improve the performance of the classifier.
[0089] In some embodiments, the improved Adaboost classifier is weighted by sliding window detection.
[0090] In some embodiments, sliding window detection uses non-maximum suppression.
[0091] In some embodiments, the extracted color features are input into an Adaboost classifier for classification, and whether it is a face is determined based on the classification result. When the classification result is a face, the position data of the face is output based on the classification and detection results, and the faces are aligned based on the position data to ensure that they are consistent in size, angle and position for the next step of face detection; wherein the position data includes: position and size information.
[0092] It is worth mentioning that the face detection step using the improved Adaboost algorithm and the LIS color space-based method aims to accurately locate the position of the face in the image. Once the face is detected, it is aligned to ensure that they are consistent in size, angle and position, which helps to improve the accuracy and reliability of image detection.
[0093] Step S13: obtaining a second high-dimensional face embedding vector corresponding to the position data from the second face image, extracting low-dimensional face features from the second high-dimensional face embedding vector, and performing face recognition based on the low-dimensional face features.
[0094] In some embodiments, extracting low-dimensional facial features from the second high-dimensional face embedding vector includes: performing low-rank decomposition and weighted sparse representation on the second high-dimensional face embedding vector, respectively, to obtain low-dimensional facial features with high data content by converting the second high-dimensional face embedding vector.
[0095] In some embodiments, the second high-dimensional face embedding vector is subjected to low-rank decomposition, including: performing low-rank decomposition on the second high-dimensional face embedding vector, using the obtained low-dimensional first low-rank decomposition result as an anchor sample, and obtaining positive samples belonging to the same portrait as the anchor sample and negative samples different from the anchor sample; obtaining a discriminative second low-rank decomposition result based on a ternary loss function established according to the anchor sample, the positive sample and the negative sample, so as to obtain a low-dimensional face feature according to the second low-rank decomposition result.
[0096] It is worth noting that the first low-rank decomposition result is the address decomposition result obtained after the second high-dimensional face embedding vector is decomposed by low-rank decomposition, which is the intermediate result of obtaining low-dimensional face features. The second low-rank decomposition result is the first low-rank decomposition result processed by the ternary loss function to obtain a discriminative low-rank decomposition result.
[0097] It is worth noting that the facial recognition algorithm based on discriminative low-rank decomposition and weighted sparse representation is used, and the embedded vector is processed to achieve recognition of different faces. This algorithm takes into account factors such as illumination changes, occlusion, and facial dirt to improve the accuracy of facial recognition, as shown below: Discriminative low-rank decomposition is to perform low-rank decomposition of the face images corresponding to the input data (including training sets and test sets), represent each face image as an approximation of the low-rank matrix, and then introduce a discriminative loss function to ensure that the features after low-rank decomposition have good discriminability in face recognition tasks.
[0098] In some embodiments, the discriminative loss function is expressed as:
[0099] ,
[0100] in, It is the anchor sample, that is, the embedded representation of the face image; It is a positive sample, which belongs to the same person as the anchor sample and has a similar embedding; It is a negative sample, which is different from the anchor sample and has a dissimilar embedding; is the loss function; is a non-negative hyperparameter; ( ) represents the embedding function, which maps the input image to the embedding vector; Indicates taking the Euclidean norm (L2 norm).
[0101] It is worth mentioning that is the anchor sample, i.e., the embedded representation of the face image; is a positive sample, which is Similar embedding representations of face images belonging to the same person; is a negative sample, which is Different dissimilar embedding representations; is a hyperparameter, often called a “margin”, that controls the interval between positive and negative samples and is a non-negative number.
[0102] In some embodiments, low-dimensional facial features are obtained based on the second low-rank decomposition result, including: introducing weights to enhance facial part features according to the corresponding basis vectors in the second facial image based on the second low-rank decomposition result, so as to obtain low-dimensional facial features with high data content; wherein, the second facial image is represented by a linear combination of a set of basis vectors.
[0103] In some embodiments, the weighted sparse representation represents the face image corresponding to the input data as a linear combination of a set of basis vectors, where most of the coefficients are zero; this representation captures important structural information of the image, and then introduces weights for each basis vector to focus more on features that are meaningful to the face recognition task.
[0104] In some embodiments, during training, features processed by discriminative low-rank decomposition and weighted sparse representation are used as input to train a classifier for face recognition; during testing, for a new test image (such as the first face image), the same processing flow (discriminative low-rank decomposition and weighted sparse representation) is used to obtain features, and then the trained classifier is used for recognition.
[0105] It is worth mentioning that the above algorithm combines the advantages of low-rank decomposition: reducing feature dimensions and retaining main information, and the advantages of sparse representation: extracting important feature information to achieve better face recognition performance.
[0106] In some embodiments, performing face recognition based on the low-dimensional face features includes: matching the low-dimensional face features with the face features of a stored third face image to obtain an identity authentication result; performing a face authenticity check on the first face image based on spectral information of a transparency image collected for the first face image to obtain a face authenticity result; obtaining a recognition result of the first face image based on the identity authentication result and the face authenticity result, and storing the recognition result in a blockchain.
[0107] It is worth noting that the third facial image is a pre-stored facial image.
[0108] In some embodiments, based on the spectral information of the transparency picture collected for the first facial image, a face authenticity check is performed on the first facial image to obtain a face authenticity result, including: based on the infrared spectrum of the transparency picture collected for the first facial image, determining whether there is a mask material in the first facial image that reflects or absorbs infrared radiation differently from real skin; or, based on the ultraviolet spectrum of the transparency picture collected for the first facial image, determining whether there is a mask material with abnormal reflection or absorption of ultraviolet light in the first facial image; or, based on a fused spectrum of multi-wavelength fusion of the transparency picture collected for the first facial image, determining whether there is a mask material with abnormal reflection or absorption of fused light in the first facial image; if the mask material exists in the first facial image, the face authenticity result is false; if the mask material does not exist in the first facial image, the face authenticity result is true; wherein the spectral information includes: the infrared spectrum, the ultraviolet spectrum and the fused spectrum.
[0109] It is worth noting that spectral analysis utilizes spectral information of different wavelengths and ensures the security and non-tamperability of facial images and recognition results, and blockchain technology ensures the security and non-tamperability of facial images and recognition results, thereby realizing the reflection characteristics under different spectra to distinguish the recognition of real faces and forgeries, and at the same time stores facial data and recognition records on the blockchain to improve the credibility and privacy protection of the data. This algorithm is used to avoid deception of facial recognition algorithms and forgery using masks, photos or videos to obtain illegal access or pass identity authentication.
[0110] In some embodiments, spectral analysis requires the use of special sensors to capture spectral information at different wavelengths, and calibration and analysis for different spectra and wavelengths, including: infrared spectrum, ultraviolet spectrum, multi-wavelength fusion and spectral feature analysis.
[0111] In some embodiments, the infrared spectrum includes: The infrared spectrum is often used to detect masks because the reflection or absorption characteristics of most mask materials to infrared radiation are different from real skin, thereby distinguishing between a mask and a real human face.
[0112] In some embodiments, UV spectroscopy includes: UV spectroscopy is used to detect specific mask materials because some mask materials react differently to UV light. If a mask material exhibits unusual reflection or absorption properties under UV light, then this is a sign of counterfeiting.
[0113] In some embodiments, the spectral feature analysis includes: performing spectral analysis on the face area at different wavelengths to detect masks or other forgeries, and issuing a warning message if the spectral feature of a specific wavelength does not match the real face.
[0114] In some embodiments, multi-wavelength fusion includes: combining spectral information of different wavelengths to improve the detection ability of spoofing attempts so as to more accurately distinguish between real faces and forgeries.
[0115] In some embodiments, blockchain technology is used to ensure the security and immutability of facial images and recognition results, mainly through the following means: distributed storage; encryption; smart contracts; timestamps; immutability; auditing and transparency; and decentralization.
[0116] In some embodiments, collecting spectral information of images of three different channels, namely, color image, grayscale image and transparency image, includes: Steps S211 to S214, specifically:
[0117] Step S211, selecting a special sensor to ensure that the device covers the required wavelength range and has high resolution and dynamic range;
[0118] Step S212, calibrating the equipment, including: before spectrum acquisition, the equipment needs to be calibrated to ensure the accuracy and consistency of the data;
[0119] Step S213, collecting spectral data, including: using different collection methods for different types of images; for color images, directly photographing them or collecting them through a spectral camera; for grayscale images, converting them into black and white images, and then collecting them through a spectral camera; for transparency images, scanning the images at different wavelengths through a spectral scanner, and recording the transmittance or reflectance at each wavelength;
[0120] Step S214, analyzing the results, including: further analyzing the spectral characteristics and differences of different image types based on the processed data, comparing the intensity distribution of different color channels, analyzing the brightness distribution of grayscale images, and evaluating the transmittance of transparent images.
[0121] Compared with the existing related technologies, the beneficial effects of the embodiments of the present application include:
[0122] The embodiment of the present application uses multiple training samples to extract local features of the collected facial images, and then fuses multiple sample data, so that more samples can help the model better learn the changes in the face and the manifestation of local features, thereby improving the accuracy of face recognition.
[0123] The embodiment of the present application uses the InsightFace face recognition algorithm of the MobileNetV2 network structure to embed the residual face of the CBAM-MobileNet network structure with a convolutional attention module into the network to improve the quality of the face image. At the same time, the LIS color space and the improved Adaboost face detection algorithm are used to improve the face detection effect under complex backgrounds, so that the face is clearer when embedded and will not be disturbed by the external background, thereby improving the accuracy of face recognition.
[0124] The embodiment of the present application uses a facial recognition algorithm based on discriminative low-rank decomposition and weighted sparse representation to break through the problem of inaccurate facial recognition caused by factors such as lighting changes, occlusion, and facial dirt, thereby improving the reliability and practicality of the face recognition algorithm.
[0125] The embodiments of the present application use spectral analysis and blockchain technology to prevent facial recognition algorithms from being forged by deceptive means such as masks, photos or videos to obtain illegal access or pass identity authentication, thereby ensuring the security and non-tamperability of facial images and recognition results, and improving the accuracy and reliability of facial recognition.
[0126] Example 2
[0127] See also Figure 2, is a complete flow chart of a face recognition method based on InsightFace and LIS file management provided in an embodiment of the present application, including steps S201 to S207, specifically:
[0128] Step S201: First, the terminal needs to be configured with a camera to collect facial images;
[0129] Step S202, performing image processing on the collected face image, and then extracting feature values from the processed image and binding them to the seat account in the data control, ensuring that each face has a unique identification account, thereby improving the security of the face algorithm; wherein, performing image processing on the collected face image includes: preprocessing the face image; the preprocessing includes: denoising, image size standardization and contrast enhancement; performing image processing on the collected face image also includes: extracting local features from training samples during training;
[0130] Step S203, face embedding is used to improve the quality of face images. When a face is embedded, the residual face embedding network of the CBAM-MobileNet network structure of the convolutional attention module is used to improve the quality of the embedded face image, making it convenient to compare and judge the pre-registered face images;
[0131] Step S204: Face detection detects the embedded face image, and then uses the LIS color space and the improved Adaboost face detection algorithm to improve the detection effect of the face image under complex background;
[0132] Step S205, face recognition uses a facial recognition algorithm based on discriminative low-rank decomposition and weighted sparse representation to break through the problem of inaccurate facial recognition caused by lighting changes, occlusion or facial dirt. Spectral analysis and blockchain technology are then used to prevent someone from using a mask, photo or video to forge and deceive the facial recognition algorithm, thereby improving the accuracy and robustness of the facial recognition algorithm.
[0133] Step S206, identity verification is used to verify whether the identity of the visitor is correct. After face recognition, the embedded face image is compared with the pre-registered face image, and then the visitor's identity is verified to determine whether the identity is correct or wrong. Only when the recognition result and the face authenticity result are both true, the face is recognized to be legal and the identity is correct; otherwise, the identity is wrong.
[0134] Step S207, result output is to display the result of identity authentication, output the result after judgment, and then display the result, and make a displayable response according to whether the identity is correct or wrong.
[0135] Further, in step S206, the extracted facial features are compared with the pre-registered features to verify the identity of the user, so that the facial recognition algorithm can verify the identity of the access control personnel, and then output a corresponding response based on the result of the identity verification. If matching features are found and the face authenticity result is true, the identity of the face is recognized and passed; otherwise, access is denied and the verification failure is displayed.
[0136] The embodiment of the present application uses facial part feature positioning for facial images, which can extract the features of each organ on the face separately, realize the extraction of local features of the facial image, and convert the obtained facial part features into facial embedding vectors, which is convenient for comparing and identifying facial images. It also uses LIS color space to classify facial areas and non-face areas, which is convenient for locating high-dimensional facial embedding vectors in facial images according to the obtained position data, and can ensure that high-dimensional facial embedding vectors in accurate facial areas are obtained, while ignoring interference from non-face areas, thereby improving the accuracy and reliability of image detection; the present invention also extracts low-dimensional facial features from the second high-dimensional facial embedding vector to reduce the dimensionality of facial features, thereby accelerating facial recognition efficiency.
[0137] Example 3
[0138] See also Figure 3 , is a flow chart of face image acquisition provided by an embodiment of the present application. In the figure, face image acquisition includes camera programming interface, parameter setting and image saving. The programming interface uses OpenCV and Python's cv2 library to access the camera and acquire images. The parameter setting is used to adjust the camera resolution, focus, brightness and contrast parameters to obtain higher image quality. The image saving is used to save the acquired face image to the LIS file management.
[0139] First, adjust the resolution of the camera configured on the terminal to 1080p (1920x1080 pixels) and manually focus until the camera brightness is adjusted to 80% and the contrast is 60% to ensure the quality of facial images collected by the camera. Then, use OpenCV and Python's cv2 library to program the camera to read the three image background displays of color, grayscale and transparency of the same image. It is obtained that the three different channels of images can more clearly identify the three different display effects of the image, so as to more accurately judge the authenticity of the facial image. Then, use the programming interface to access the camera to collect facial images, and then save the collected facial images to the LIS file management for subsequent comparison, analysis and verification.
[0140] The specific parameter pairs of the cv2 library include:
[0141] cv2 library, Python binding for OpenCV, use the cv2 library to read, display and save images;
[0142] cv2.imread function, used to read image files;
[0143] The return value is used to return the image represented by the NumPy array; including color images, grayscale images, and transparency images.
[0144] OpenCV and Python's cv2 library analyze the camera and read three displays from color and grayscale to transparency channel images. The specific parameters of the cv2.imread function include: cv2.imread(filename, flags) function; filename is the path and name of the image file to be read, which is a relative path or an absolute path. Flags is an optional parameter used to specify the image reading method.
[0145] In some embodiments, commonly used flags parameter values include: cv2.IMREAD_COLOR, cv2.IMREAD_GRAYSCALE, cv2.IMREAD_UNCHANGED and cv2.imread function; among them, cv2.IMREAD_COLOR: default value, read the image in color mode, ignore the transparency channel of the image; v2.IMREAD_GRAYSCALE: read the image in grayscale mode, convert the image to a single-channel grayscale image; cv2.IMREAD_UNCHANGED: read the image in a way that includes the transparency channel, retaining all channels of the image; cv2.imread function, used to return a NumPy array representing the image. If the image file does not exist or the reading fails, the function will return None.
[0146] The embodiment of the present application acquires images from three different channels, which can more accurately determine the authenticity of the facial image, and then use the programming interface to access the camera to collect the facial image, and then save the collected facial image to the LIS file management for subsequent comparison, analysis and verification.
[0147] Example 4
[0148] See also Figure 2 The face image acquisition process includes image processing, which includes: preprocessing and training samples. The preprocessing is used to perform some processing such as denoising, contrast enhancement and image size standardization on the image after face acquisition to improve the subsequent face image comparison effect; during training or testing, the training samples or test samples use multiple samples to extract local face area features from the image after face acquisition.
[0149] Further, after the image processing is completed, the face image is bound to the mount account so that the face shape, contour and texture information of the face image are bound to the mount account. When the user performs face recognition, in the subsequent recognition process, the collected face image is compared with the stored face image, thereby realizing personalized identity authentication and permission control.
[0150] Example 5
[0151] See also Figure 2 and Figure 3 The extraction of facial features includes: first preprocessing the collected image, performing a series of processing such as denoising, contrast enhancement, and image size standardization, and then extracting the local feature area of the facial image through training samples, see Figure 4 , is a schematic diagram of a process for extracting facial features provided by an embodiment of the present application, including steps S101 to S104, including:
[0152] Step S101, local feature detection and positioning, includes: using a Haar cascade classifier or a face key point detector to detect and locate the local parts of the collected face image, so as to realize the detection and positioning of the local parts.
[0153] Step S102, local feature extraction, including: local feature regions located in the face image, such as eyes, nose, mouth, face shape, chin and ears, for each local feature region, using a feature extraction method to extract local feature descriptions. Figure 5 , is a schematic diagram of facial parts for local feature extraction provided in an embodiment of the present application.
[0154] Step S103, feature matching, includes: using a similarity measurement method to measure the distance between two feature vectors for each local feature using a Euclidean distance similarity measurement method, which is used in face recognition to compare the similarity between feature vectors with corresponding local features in training samples.
[0155] The specific calculation formula of the Euclidean distance similarity measurement method is expressed as:
[0156] ,
[0157] in, Representation characteristics and Features The Euclidean distance between It is a feature The characteristic value of It is a feature The characteristic value of .
[0158] The distance between two feature vectors is calculated repeatedly through the calculation formula of the Euclidean distance similarity measurement method, and the distance is compared after more than three calculations to improve the similarity between the extracted local features and the collected face images. The higher the similarity, the closer the distance between them is, which facilitates the subsequent auxiliary face recognition and improves the reliability and accuracy of face recognition.
[0159] Step S104, increasing the number of training samples at the same time is usually used to improve the performance of face recognition, because more samples help the model better learn the changes and characteristics of the face. Increasing the number of training samples includes: data enhancement, collecting multiple data types, constructing data or at least one of transfer learning.
[0160] Data augmentation includes: In face recognition, data augmentation applies rotation, flipping, scaling, and translation transformations to expand the dataset, which helps the model adapt to different poses, lighting conditions, and expressions.
[0161] Collecting more data includes: collecting more facial image data, which is achieved by taking more photos from different angles, different lighting conditions and different backgrounds in a multi-dimensional and multi-space manner.
[0162] Various data types are collected through data synthesis, including: using computer graphics technology to generate synthetic face images. These images include multiple variations, including: different expressions, ages or genders. The benefit of synthetic data is that the variations can be precisely controlled and a large number of samples can be generated.
[0163] Transfer learning includes: using models that have been trained on other tasks (such as pre-trained convolutional neural networks) to perform transfer learning, effectively expanding the training data, and fine-tuning the pre-trained model to adapt it to face recognition tasks, thereby accelerating the training process and improving performance.
[0164] Further, the feature selection of the face includes: Principal Component Analysis (PCA) is a common dimensionality reduction technique used to extract the main features and reduce the dimension of the data. In face recognition, PCA is used to extract important facial features; Local Binary Pattern (LBP) is a feature extraction method for texture analysis, which is also widely used in face recognition. It captures the texture information on the face; Histogram of Oriented Gradient (HOG) is a feature extraction method for detecting the edges and textures of objects in an image. In face recognition, it is used to capture the contour information of the face; Deep learning features: Use deep learning algorithms such as Convolutional Neural Networks (CNN) to automatically learn discriminative features, and obtain high-quality local feature representations by using pre-trained deep learning models, including: VGG, Residual or FaceNet.
[0165] Similarity measurement methods include: cosine similarity is used to measure the angle between two vectors, usually used in text classification and image retrieval, and it is also used to compare the similarity between feature vectors; histogram-based method: the feature vector is represented as a histogram, and the histogram distance is used to measure the similarity, such as Chi-Square distance, Hellinger distance, etc.; Mahalanobis distance takes into account the covariance structure between features and is used to more accurately measure the similarity between features; the kernel method maps data to a high-dimensional space and performs similarity measurement in this space. Common kernel functions include linear kernel, polynomial kernel and Gaussian kernel.
[0166] The embodiment of the present application improves the similarity between the extracted local features and the collected facial images through the calculation formula of the Euclidean distance similarity measurement method. The local features with higher similarity indicate that they are closer, thereby facilitating subsequent auxiliary face recognition and improving the reliability and accuracy of face recognition.
[0167] Example 6
[0168] See also Figure 6 , is a schematic diagram of a face embedding model provided in an embodiment of the present application. Figure 6 In the process, the InsightFace face recognition algorithm based on the MobileNetV2 network structure is used, combined with the residual face embedding network composed of a convolutional attention module and a depth-level separable convolutional network structure, to convert local features into face embedding vectors. The goal of this step is to encode face information into a high-dimensional vector for comparison and matching, which specifically includes: Steps S301~S302, specifically:
[0169] Step S301, the network structure of MobileNetV2 includes depthwise separable convolution, dilated convolution and residual connection technology to reduce the number of parameters and computational complexity while maintaining model performance, where MobileNetV2 is specifically embodied as follows: lightweight structure; depthwise separable convolution; dilated convolution; and residual connection.
[0170] Step S302, CBAM-MobileNet integrates the CBAM module into the depth-separable convolution of MobileNet to enhance the focus on image features. MobileNetV2 already has depth-separable convolution and lightweight characteristics, which is suitable for face embedding tasks on mobile devices. The CBAM module usually includes channel attention and spatial attention.
[0171] The network structure of the InsightFace face recognition algorithm based on the MobileNetV2 network structure includes: input, convolution layer, CBAM module, global pooling layer, dense layer and CBAM-residual face embedding network connected in sequence; among them, the convolution layer is the depth-separable convolution layer of MobileNetV2; the CBAM module includes: channel attention and spatial attention, which are used to enhance the representation ability of feature maps; the global pooling layer is usually global average pooling, which reduces the dimension of the feature map to a one-dimensional vector; the dense layer is used to generate a face embedding vector; then the CBAM-residual face embedding network is used as input, and finally the face embedding high-dimensional vector is output, which is convenient for comparing and identifying face images.
[0172] The embodiment of the present application adopts a lightweight structure - MobileNetV2 to run efficiently on mobile devices, with a relatively small model size and computational overhead; depthwise separable convolution: depthwise separable convolution decomposes the standard convolution operation into two steps, namely depthwise convolution and pointwise convolution, to reduce computational cost; dilated convolution: dilated convolution introduces an adjustable expansion rate to increase the receptive field, thereby better capturing the global information in the image; residual connection: residual connection promotes smooth propagation of gradients through jump connections, which helps to solve the gradient disappearance problem in deep neural networks.
[0173] Example 7
[0174] See also Figure 7 , is a flow chart of face recognition provided in an embodiment of the present application. Figure 7 In the embodiment, the improved Adaboost algorithm and the method based on the LIS color space are used for face detection, and the specific contents include steps S411 to S414, which are specifically:
[0175] Step S411: Use the improved Adaboost algorithm to train a classifier for distinguishing between face and non-face areas. The improved Adaboost algorithm performs weighting according to the importance of features to improve the performance of the classifier. Specifically, a sliding window detection method with non-maximum suppression is used.
[0176] Step S412: Apply the trained Adaboost classifier to the entire data set. For each image, convert it into the LIS color space. The LIS color space is a color representation method based on brightness, information content, and saturation. It ensures that the contrast and discrimination of the face area are improved, and color features are extracted. The color features include complexion, skin texture, and hair color, which are used to distinguish between face and non-face areas.
[0177] Step S413, classification and detection, includes: inputting the extracted color features into the Adaboost classifier for classification, judging whether it is a face according to the classification result, and further performing face detection when the classification result is frontal.
[0178] Step S414, result output, including: outputting the position data of the face according to the classification and detection results, the position data including: position information and size information.
[0179] The above-mentioned face detection step using the improved Adaboost algorithm and the LIS color space-based method is intended to accurately locate the position of the face in the image. Once the face is detected, it is necessary to align the faces to ensure that they are consistent in size, angle and position, which helps to improve the accuracy and reliability of image detection.
[0180] The embodiment of the present application uses a sliding window on the input image, applies the classifier to image blocks of different positions and scales, and finds the area containing the face through sliding window detection. For overlapping detection frames, a non-maximum suppression algorithm is used to select the best face detection result, which avoids repeated detection of the same face, thereby improving the accuracy of face recognition.
[0181] Example 8
[0182] See also Figure 8 , is a structural diagram of face recognition provided in an embodiment of the present application, specifically, including steps S501~S502.
[0183] Step S501, using a facial recognition algorithm based on discriminative low-rank decomposition and weighted sparse representation, and processing the embedded vector at the same time to achieve recognition of different faces. This algorithm takes into account factors such as illumination changes, occlusion, and facial dirt to improve the accuracy of facial recognition, as shown below: Discriminative low-rank decomposition is to perform low-rank decomposition of the face images in the training data set, represent each image as an approximation of the low-rank matrix, and then introduce a discriminative loss function to ensure that the features after the low-rank decomposition have good discriminability in the face recognition task.
[0184] The discriminative loss function is as follows: Assume there are three samples: A: Anchor sample, that is, the embedded representation of the face image; P: Positive sample, which belongs to the same person as the anchor sample and has a similar embedding; N: Negative sample, which is different from the anchor sample and has a dissimilar embedding.
[0185] Based on three samples, the formula of the discriminative loss function is expressed as:
[0186] ,
[0187] in, It is the anchor sample, that is, the embedded representation of the face image; It is a positive sample, which belongs to the same person as the anchor sample and has a similar embedding; It is a negative sample, which is different from the anchor sample and has a dissimilar embedding; is the loss function; is a non-negative hyperparameter; ( ) represents the embedding function, which maps the input image to the embedding vector; Indicates taking the Euclidean norm (L2 norm) of the vector.
[0188] The weighted sparse representation is a linear combination of a set of basis vectors in which most coefficients are zero. This representation captures important structural information of the image and introduces weights to each basis vector to focus more on features that are meaningful to the face recognition task.
[0189] When training a classifier, features processed by discriminative low-rank decomposition and weighted sparse representation are used as input to train a classifier for face recognition tasks; when testing the classification, for a new test image, the same processing flow (discriminative low-rank decomposition and weighted sparse representation) is used to obtain features, and then the trained classifier is used for recognition; the above algorithm combines the advantages of low-rank decomposition: reducing feature dimensions and retaining main information and the advantages of sparse representation: extracting important feature information to achieve better face recognition performance.
[0190] Step S502, using spectral analysis to utilize spectral information of different wavelengths and ensure the security and non-tamperability of facial images and recognition results and blockchain technology to ensure the security and non-tamperability of facial images and recognition results, thereby realizing the recognition of real faces and forgeries by using reflection characteristics under different spectra, and storing facial data and recognition records on the blockchain to improve the credibility and privacy protection of the data. This algorithm is used to avoid deception of facial recognition algorithms, forgery using masks, photos or videos to obtain illegal access or pass identity authentication.
[0191] Among them, spectral analysis requires the use of special sensors to capture spectral information of different wavelengths, and calibrate and analyze different spectra and wavelengths, including: using infrared spectroscopy to detect masks, because the reflection or absorption characteristics of most mask materials to infrared radiation are different from real skin, thereby distinguishing whether it is a mask or a real face; or, using ultraviolet spectroscopy to detect special mask materials, because some mask materials have different reactions to ultraviolet light. If the mask material exhibits abnormal reflection or absorption characteristics under ultraviolet light, then this is a sign of counterfeiting; or using spectral feature analysis, including spectral analysis of the face area at different wavelengths to detect masks or other counterfeits. If the spectral features of a specific wavelength do not match those of a real face, a warning message is issued; or, using multi-wavelength fusion, including: combining spectral information of different wavelengths to improve the detection ability of deception attempts, so as to more accurately distinguish between real faces and counterfeits.
[0192] The spectral information of images of three different channels, namely, color image, grayscale image and transparency image, is collected by spectral analysis, including steps S211 to S214, specifically:
[0193] Step S211, selecting a special sensor to ensure that the device covers the required wavelength range and has high resolution and dynamic range;
[0194] Step S212, calibrating the equipment, including: before spectrum acquisition, the equipment needs to be calibrated to ensure the accuracy and consistency of the data;
[0195] Step S213, collecting spectral data, including: using different collection methods for different types of images; for color images, directly photographing them or collecting them through a spectral camera; for grayscale images, converting them into black and white images, and then collecting them through a spectral camera; for transparency images, scanning the images at different wavelengths through a spectral scanner, and recording the transmittance or reflectance at each wavelength;
[0196] Step S214, analyzing the results, including: further analyzing the spectral characteristics and differences of different image types based on the processed data, comparing the intensity distribution of different color channels, analyzing the brightness distribution of grayscale images, and evaluating the transmittance of transparent images.
[0197] Blockchain technology is used to ensure the security and immutability of facial images and recognition results, mainly through the following ways: distributed storage: encryption; smart contracts; timestamps; immutability; auditing and transparency; and decentralization.
[0198] Blockchain is used to store face recognition process data (such as collected face images and features generated during the recognition process) and recognition results in a distributed manner. Blockchain is a distributed database, where face images and recognition results are stored in a distributed manner on multiple nodes, which means there is no single central server or database. If an attacker wants to modify or tamper with the data, they need to change the data on multiple nodes at the same time, which makes it very difficult.
[0199] Blockchain is used to encrypt the process data and recognition results of face recognition, including: face images and recognition results are encrypted and stored on the blockchain, and only authorized users with the correct key can access and decrypt these data, which ensures the privacy and security of the data.
[0200] Smart contracts that use blockchain to execute face recognition include: Smart contracts are automatically executed codes on the blockchain that are used to define rules for accessing and modifying data. Only operations that meet the conditions specified in the contract can be executed, which prevents unauthorized access and tampering.
[0201] The blockchain is used to formulate the timestamp of face recognition, including: each transaction on the blockchain has a timestamp to record the creation and modification time of the data, which ensures the chronological order and immutability of the data. If someone tries to tamper with the data, the timestamp will show inconsistency.
[0202] The use of blockchain to make facial recognition data tamper-proof includes: the nature of blockchain makes it almost impossible to modify the data that has been written. Once the data is added to the blockchain, it will be linked to the previous block to form an ever-growing chain. Any attempt to modify the data will result in a mismatch with the previous block, so it can be easily detected.
[0203] The blockchain is used to audit and transparently display the facial recognition process, including: The blockchain is transparent, and all data transactions are audited, which means tracking the source and history of the data to ensure the legitimacy and integrity of the data.
[0204] The use of blockchain to decentralize the facial recognition process includes: The decentralized nature of blockchain means that there is no single control and the data is not controlled by a single entity, which reduces single points of failure and potential risks of abuse.
[0205] The embodiment of the present application adopts spectral analysis to utilize spectral information of different wavelengths and ensure the security and non-tamperability of facial images and recognition results and blockchain technology to ensure the security and non-tamperability of facial images and recognition results, thereby realizing the reflection characteristics under different spectra to distinguish the recognition of real faces and forgeries, and at the same time storing facial data and recognition records on the blockchain to improve the credibility and privacy protection of the data.
[0206] Example 9
[0207] See also Fig. 9 , is a structural diagram of a face recognition device based on InsightFace and LIS file management provided in an embodiment of the present application, including: an embedding module 91, a face area classification module 92 and a recognition module 93.
[0208] The embedding module 91 is used to collect the initial first face image in real time and locate multiple face part features of the first face image. When face embedding is performed based on the multiple face part features, the multiple face part features are respectively converted into multiple first high-dimensional face embedding vectors to obtain the embedded second face image.
[0209] In some embodiments, real-time acquisition of an initial first facial image includes: acquiring multiple mode screens of the facial image, preprocessing the multiple mode screens, and saving the obtained preprocessed images to LIS file management, so that the image can be read from the LIS file management to obtain the first facial image; wherein the multiple mode screens include: color screens, grayscale screens, and transparency screens.
[0210] In some embodiments, when face embedding is performed based on the multiple facial part features, the multiple facial part features are respectively converted into multiple first high-dimensional face embedding vectors to obtain an embedded second face image, including: based on a trained first InsightFace face recognition algorithm and a residual face embedding network with a network structure consisting of a convolutional attention module and a depth-level separable convolution, the local multiple facial part features are converted into a feature-enhanced first high-dimensional face embedding vector to obtain the embedded second face image.
[0211] The face area classification module 92 is used to obtain the color features of the second face image in the LIS color space, and classify the face area and non-face area according to the color features to obtain the position data of the face area on the second face image; wherein the LIS color space includes: brightness, information content and saturation.
[0212] In some embodiments, a color representation of the second facial image in terms of brightness, information content and saturation is obtained, and color features are extracted based on the color representation; wherein the color features include: complexion, skin texture and hair color.
[0213] The recognition module 93 is used to obtain a second high-dimensional face embedding vector corresponding to the position data from the second face image, extract low-dimensional face features from the second high-dimensional face embedding vector, and perform face recognition based on the low-dimensional face features.
[0214] In some embodiments, extracting low-dimensional facial features from the second high-dimensional face embedding vector includes: performing low-rank decomposition and weighted sparse representation on the second high-dimensional face embedding vector, respectively, to obtain low-dimensional facial features with high data content by converting the second high-dimensional face embedding vector.
[0215] In some embodiments, the second high-dimensional face embedding vector is subjected to low-rank decomposition, including: performing low-rank decomposition on the second high-dimensional face embedding vector, using the obtained low-dimensional first low-rank decomposition result as an anchor sample, and obtaining positive samples belonging to the same portrait as the anchor sample and negative samples different from the anchor sample; obtaining a discriminative second low-rank decomposition result based on a ternary loss function established according to the anchor sample, the positive sample and the negative sample, so as to obtain a low-dimensional face feature according to the second low-rank decomposition result.
[0216] In some embodiments, low-dimensional facial features are obtained based on the second low-rank decomposition result, including: introducing weights to enhance facial part features according to the corresponding basis vectors in the second facial image based on the second low-rank decomposition result, so as to obtain low-dimensional facial features with high data content; wherein, the second facial image is represented by a linear combination of a set of basis vectors.
[0217] In some embodiments, performing face recognition based on the low-dimensional face features includes: matching the low-dimensional face features with the face features of a stored third face image to obtain an identity authentication result; performing a face authenticity check on the first face image based on spectral information of a transparency image collected for the first face image to obtain a face authenticity result; obtaining a recognition result of the first face image based on the identity authentication result and the face authenticity result, and storing the recognition result in a blockchain.
[0218] In some embodiments, based on the spectral information of the transparency picture collected for the first facial image, a face authenticity check is performed on the first facial image to obtain a face authenticity result, including: based on the infrared spectrum of the transparency picture collected for the first facial image, determining whether there is a mask material in the first facial image that reflects or absorbs infrared radiation differently from real skin; or, based on the ultraviolet spectrum of the transparency picture collected for the first facial image, determining whether there is a mask material with abnormal reflection or absorption of ultraviolet light in the first facial image; or, based on a fused spectrum of multi-wavelength fusion of the transparency picture collected for the first facial image, determining whether there is a mask material with abnormal reflection or absorption of fused light in the first facial image; if the mask material exists in the first facial image, the face authenticity result is false; if the mask material does not exist in the first facial image, the face authenticity result is true; wherein the spectral information includes: the infrared spectrum, the ultraviolet spectrum and the fused spectrum.
[0219] The embodiment of the present application uses an embedding module 91 to locate facial part features of a facial image, and can extract the features of each organ on the face separately, realize the extraction of local features of the facial image, and convert the obtained facial part features into facial embedding vectors, which is convenient for comparing and identifying facial images. It also uses a facial region classification module 92 to classify facial regions and non-facial regions through the LIS color space, which is convenient for locating the high-dimensional facial embedding vector in the facial image according to the obtained position data, and can ensure that the high-dimensional facial embedding vector in the accurate facial region is obtained, while ignoring the interference of non-facial regions, thereby improving the accuracy and reliability of image detection; the embodiment of the present application also uses a recognition module 93 to extract low-dimensional facial features from the second high-dimensional facial embedding vector to reduce the dimensionality of the facial features, thereby accelerating the efficiency of facial recognition.
[0220] Those skilled in the art will appreciate that the embodiments of the present application may also provide computer program products. Therefore, the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program codes.
[0221] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0222] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0223] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0224] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A face recognition method based on InsightFace and LIS file management, characterized in that: include: Acquire an initial first face image in real time, locate multiple face part features of the first face image, and when performing face embedding according to the multiple face part features, convert the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image; Acquire color features of the second face image in the LIS color space, and classify the face area and the non-face area according to the color features to obtain location data of the face area on the second face image; wherein the LIS color space includes: brightness, information content and saturation; Acquire a second high-dimensional face embedding vector corresponding to the position data from the second face image, extract low-dimensional face features from the second high-dimensional face embedding vector, and perform face recognition based on the low-dimensional face features; The step of extracting low-dimensional facial features from the second high-dimensional facial embedding vector includes: Performing low-rank decomposition and weighted sparse representation on the second high-dimensional face embedding vector respectively, to obtain a low-dimensional face feature that converts the second high-dimensional face embedding vector into a high-data-content low-dimensional face feature; The performing low-rank decomposition on the second high-dimensional face embedding vector comprises: Performing low-rank decomposition on the second high-dimensional face embedding vector, using the obtained low-dimensional first low-rank decomposition result as an anchor sample, and obtaining positive samples belonging to the same portrait as the anchor sample and negative samples different from the anchor sample; According to the ternary loss function established by the anchor sample, the positive sample and the negative sample, a second low-rank decomposition result with discriminativeness is obtained, so that a low-dimensional facial feature is obtained according to the second low-rank decomposition result.
2. The face recognition method based on InsightFace and LIS file management as claimed in claim 1, characterized in that: The obtaining of the color feature of the second face image in the LIS color space includes: Obtain a color representation of the second facial image in terms of brightness, information content and saturation, and extract color features based on the color representation; wherein the color features include: complexion, skin texture and hair color.
3. The face recognition method based on InsightFace and LIS file management as claimed in claim 1, characterized in that: The step of obtaining low-dimensional facial features according to the second low-rank decomposition result includes: According to the basis vectors corresponding to the second low-rank decomposition result in the second face image, weights are introduced to enhance the features of facial parts to obtain low-dimensional facial features with high data content; wherein the second face image is represented by a linear combination of a set of basis vectors.
4. The face recognition method based on InsightFace and LIS file management as claimed in claim 1, characterized in that: The performing face recognition according to the low-dimensional face features comprises: Matching the low-dimensional facial features with facial features of a stored third facial image to obtain an identity verification result; Performing a face authenticity check on the first face image according to the spectrum information of the transparency image collected from the first face image to obtain a face authenticity result; According to the identity verification result and the face authenticity result, a recognition result of the first face image is obtained, and the recognition result is stored in the blockchain.
5. The face recognition method based on InsightFace and LIS file management as claimed in claim 4, characterized in that: The step of performing a face authenticity check on the first face image based on the spectral information of the transparency image collected from the first face image to obtain a face authenticity result includes: According to the infrared spectrum of the transparency picture collected from the first facial image, determining whether there is a mask material in the first facial image that has a different reflection or absorption of infrared radiation from real skin; Alternatively, judging whether there is a mask material with abnormal reflection or absorption of ultraviolet light in the first face image according to the ultraviolet spectrum of the transparency image collected from the first face image; Alternatively, judging whether there is a mask material with abnormal reflection or absorption of fused light in the first face image according to a fused spectrum of multi-wavelength fusion of a transparency image collected from the first face image; If the mask material exists in the first face image, the face authenticity result is false; if the mask material does not exist in the first face image, the face authenticity result is true; Wherein, the spectral information includes: the infrared spectrum, the ultraviolet spectrum and the fusion spectrum.
6. The face recognition method based on InsightFace and LIS file management as claimed in claim 1, characterized in that: The real-time acquisition of the initial first face image includes: Collect multiple mode pictures of face images, pre-process the multiple mode pictures, and save the obtained pre-processed images into LIS file management, so that the images can be read from the LIS file management to obtain the first face image; wherein the multiple mode pictures include: color pictures, grayscale pictures and transparency pictures.
7. The face recognition method based on InsightFace and LIS file management as claimed in claim 1, characterized in that: When performing face embedding according to the multiple face part features, converting the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image, including: According to the residual face embedding network based on the trained first InsightFace face recognition algorithm and combined with the network structure composed of a convolutional attention module and a depth-level separable convolution, multiple local face part features are converted into a feature-enhanced first high-dimensional face embedding vector to obtain an embedded second face image.
8. A face recognition device based on InsightFace and LIS file management, based on the face recognition method based on InsightFace and LIS file management as claimed in any one of claims 1 to 7, characterized in that: include: Embedding module, face area classification module and recognition module; among them, The embedding module is used to collect an initial first face image in real time, locate multiple face part features of the first face image, and when performing face embedding according to the multiple face part features, convert the multiple face part features into multiple first high-dimensional face embedding vectors respectively to obtain an embedded second face image; The face region classification module is used to obtain the color features of the second face image in the LIS color space, and classify the face region and the non-face region according to the color features to obtain the position data of the face region on the second face image; The recognition module is used to obtain a second high-dimensional face embedding vector corresponding to the position data from the second face image, extract low-dimensional face features from the second high-dimensional face embedding vector, and perform face recognition based on the low-dimensional face features.
