Face image recognition method and device, electronic equipment and storage medium
By preprocessing and quantizing sample face images, a target recognition model is constructed, which solves the problem that quantization processing algorithms cannot completely remove outliers, thus improving the accuracy and efficiency of face image recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN WEIXUN TECH CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-06-05
Smart Images

Figure CN122157320A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a face image recognition method and apparatus, electronic device and storage medium. Background Technology
[0002] Face image recognition methods refer to the use of digital technology to analyze and process face images, and to achieve target recognition of face images based on the features extracted by image processing.
[0003] Currently, in the process of target recognition in images, it is usually necessary to quantize the model to reduce memory usage and computational load, and improve data processing efficiency and model performance. However, in practical applications, although quantization algorithms can alleviate the impact of outliers to some extent, they still cannot completely remove these outliers, leading to a decline in the performance of the quantized model and affecting the efficiency and accuracy of face image recognition.
[0004] Therefore, improving the efficiency and accuracy of facial image recognition has become an urgent technical problem to be solved. Summary of the Invention
[0005] The main objective of this application is to provide a face image recognition method, apparatus, electronic device, and storage medium, which aims to improve the efficiency and accuracy of face image recognition.
[0006] To achieve the above objectives, a first aspect of this application proposes a face image recognition method, the method comprising:
[0007] Acquire sample face images; wherein, the sample face images include sample label data; The sample face images are preprocessed to obtain sample image data; The sample image data is quantized to obtain quantized image data; The preset original recognition model is trained based on the quantized image data and the sample label data to obtain the target recognition model; Based on the target recognition model, the pre-acquired original face image is recognized to obtain the image recognition data of the original face image.
[0008] In some embodiments, the step of quantizing the sample image data to obtain quantized image data includes: The sample image data is digitized to obtain initial image values; The initial image values are grouped to obtain grouped image data; The grouped image data is filtered to obtain the target image data; The target image data is quantized to obtain the quantized image data.
[0009] In some embodiments, filtering the grouped image data to obtain target image data includes: Numerical filtering is performed on the grouped image data to obtain a maximum value sequence and a minimum value sequence; Numerical calculations are performed based on the maximum value sequence and the minimum value sequence to obtain initial filtering parameters; wherein, the initial filtering parameters include: the mean of the maximum value, the mean of the minimum value, the variance of the maximum value, and the variance of the minimum value; A maximum value filtering interval is constructed based on the mean of the maximum value, the variance of the maximum value, and the preset redundant parameters; A minimum value filtering interval is constructed based on the minimum value mean, the minimum value variance, and the redundant parameter; The target image data is obtained by filtering each initial image value in the grouped image data based on the maximum value filtering interval and the minimum value filtering interval.
[0010] In some embodiments, the step of filtering each initial image value in the grouped image data based on the maximum value filtering interval and the minimum value filtering interval to obtain the target image data includes: Obtain the original maximum and minimum values of the grouped image data; If the original maximum value is within the maximum value filtering interval and the original minimum value is within the minimum value filtering interval, then the grouped image data is used as the target image data.
[0011] In some embodiments, the step of performing numerical calculations based on the maximum value sequence and the minimum value sequence to obtain initial filtering parameters includes: The mean of the maximum value sequence is calculated to obtain the mean of the maximum values; The mean of the minimum value sequence is calculated to obtain the mean of the minimum values; The variance of the maximum value sequence is calculated to obtain the variance of the maximum value; The variance of the minimum value sequence is calculated to obtain the minimum value variance.
[0012] In some embodiments, the step of recognizing the pre-acquired original face image based on the target recognition model to obtain image recognition data of the original face image includes: The original face image is preprocessed to obtain the target face image; The target face image is quantized to obtain a quantized face image; The gender of the quantized face image is identified by the target recognition model to obtain gender probability data. The person's gender is determined based on the gender probability data, and the person's gender is confirmed as the image recognition data of the original face image.
[0013] In some embodiments, the image preprocessing of the sample face image to obtain sample image data includes: The sample face images are converted to obtain baseline image data; The reference image data is resized to obtain standard image data; The standard image data is normalized to obtain the sample image data.
[0014] To achieve the above objectives, a second aspect of this application provides a face image recognition device, the device comprising: A sample data acquisition module is used to acquire sample face images; wherein, the sample face images include sample label data; The image processing module is used to perform image preprocessing on the sample face image to obtain sample image data; The image quantization module is used to quantize the sample image data to obtain quantized image data; The recognition model training module is used to train a preset original recognition model based on the quantized image data and the sample label data to obtain a target recognition model; The recognition module is used to recognize the pre-acquired original face image based on the target recognition model to obtain the image recognition data of the original face image.
[0015] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.
[0016] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.
[0017] The face image recognition method, apparatus, electronic device, and storage medium proposed in this application acquire sample face images, including sample label data, and perform image preprocessing on the sample face images to eliminate noise, standardize data size, and improve data quality, making subsequent processing more accurate. Next, the sample image data is quantized to obtain quantized image data, which helps reduce computational complexity and improve processing efficiency. Furthermore, a pre-set original recognition model is trained based on the quantized image data to obtain a target recognition model that better meets practical needs and has stronger recognition capabilities. Finally, the trained target recognition model is used to recognize the pre-acquired original face images to obtain image recognition data of the original face images. The overall process improves the accuracy, efficiency, and practicality of face image recognition. Attached Figure Description
[0018] Figure 1 This is a flowchart of the face image recognition method provided in the embodiments of this application; Figure 2 yes Figure 1 The flowchart of step S102 in the document; Figure 3 yes Figure 1 The flowchart of step S103 in the process; Figure 4 yes Figure 3 The flowchart of step S303 in the process; Figure 5 yes Figure 1 The flowchart of step S105 in the process; Figure 6 This is a schematic diagram of the structure of the face image recognition device provided in the embodiments of this application; Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0020] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0022] First, let's analyze some of the terms used in this application: Facial image recognition methods refer to the use of digital technology to analyze and process facial images, and to achieve target recognition of facial images based on features extracted during image processing. Facial image recognition methods are widely used in security, payment, and social networking fields, and are characterized by being contactless and convenient.
[0023] In computer science, quantization algorithms improve computational efficiency and resource utilization by reducing the precision of numerical representations. Common quantization algorithms include the Kernighan-Lin (KL) algorithm and the Kullback-Leibler Divergence Sampling (KLD) algorithm. The KL algorithm is a graph partitioning algorithm that uses a greedy strategy to divide a network into two communities. It maximizes the difference between the number of internal edges and the number of cross-community edges (the gain function Q) by exchanging node pairs. It is often used in electronic circuit layout or community discovery in social networks. The KLD algorithm, based on the KL divergence from information theory, measures the difference in probability distributions. It balances sampling precision and computational cost by dynamically adjusting the number of particles and is widely used in robot localization, particle filtering, and other scenarios to adaptively optimize state estimation efficiency.
[0024] Currently, in image target recognition, to reduce computational resource consumption and improve inference speed, model quantization is typically performed, converting floating-point representations into low-bit integer representations. This significantly reduces memory usage and computational load, improving data processing efficiency and model performance. However, in practical applications, certain inputs in the dataset may lead to a large number of outliers in the sampled data of some nodes. These outliers severely affect the accuracy of the quantization results. While quantization algorithms can mitigate the impact of outliers to some extent, they cannot completely remove these anomalies, resulting in a decrease in the performance of the quantized model and affecting the efficiency and accuracy of face image recognition.
[0025] Based on this, embodiments of this application provide a face image recognition method and apparatus, electronic device and storage medium, aiming to improve the efficiency and accuracy of face image recognition.
[0026] The face image recognition method, apparatus, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the face image recognition method in this application is described.
[0027] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0028] Figure 1 This is an optional flowchart of the face image recognition method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.
[0029] Step S101: Obtain sample face images; wherein, the sample face images include sample label data; Step S102: Perform image preprocessing on the sample face images to obtain sample image data; Step S103: Quantize the sample image data to obtain quantized image data; Step S104: Train the preset original recognition model based on quantized image data and sample label data to obtain the target recognition model; Step S105: Based on the target recognition model, the pre-acquired original face image is recognized to obtain image recognition data of the original face image.
[0030] Steps S101 to S105, as illustrated in this embodiment, involve acquiring sample face images, including sample label data, and preprocessing these images to eliminate noise, standardize dimensions, and improve data quality, making subsequent processing more accurate. Next, the sample image data is quantized to obtain quantized image data, which helps reduce computational complexity and improve processing efficiency. Furthermore, a pre-set original recognition model is trained based on the quantized image data to obtain a target recognition model that better meets practical needs and has stronger recognition capabilities. Finally, the trained target recognition model is used to recognize the pre-acquired original face images, obtaining image recognition data of the original face images. The overall process improves the accuracy, efficiency, and practicality of face image recognition.
[0031] In step S101 of some embodiments, the sample face images are a representative set of face images used to train the face recognition model, including various types of face pictures. The sample face images include corresponding sample label data, which is a reference description of the content of each image provided manually.
[0032] It should be noted that the type of sample label data needs to be determined according to the actual task of facial image recognition, such as distinguishing gender, expression, adult / child, identity verification, etc., but is not limited to this.
[0033] In some embodiments, the method for acquiring sample face images may be to obtain them from a data company, from a public dataset, or by independently collecting and labeling a dataset, and is not limited thereto.
[0034] Please see Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S203: Step S201: Convert the format of the sample face image to obtain the baseline image data; Step S202: Perform size transformation on the reference image data to obtain standard image data; Step S203: Normalize the standard image data to obtain sample image data.
[0035] Steps S201 to S203, as illustrated in this embodiment, involve converting the format of the sample face images to obtain baseline image data, thus unifying the format for easier subsequent processing. Next, the baseline image data is resized to obtain standard image data, ensuring consistent image sizes. Finally, the standard image data is normalized to obtain sample image data, eliminating data discrepancies. Through format conversion, resizing, and normalization, the images are gradually standardized, facilitating accurate analysis and processing of face images in the future.
[0036] In step S201 of some embodiments, the sample face image refers to a representative set of face images used to train the face recognition model. These images may come from different devices and scenes and have various formats. It is necessary to convert the sample face images into a unified file format to eliminate the processing obstacles caused by format differences and provide a consistent basis for subsequent processing.
[0037] Specifically, the format information of the original sample face image can be read using specific image processing software or programming algorithms, and then the image data can be re-encoded according to the requirements of the target format to generate a new image file, which is the reference image data.
[0038] For example, suppose we have a batch of sample face images, some in JPEG format and some in PNG format. Using Python's Pillow library, we can read the images using the Image.open() function, and then use the save() function to save all the images uniformly in YUV format, thus obtaining the baseline image data.
[0039] In step S202 of some embodiments, since the original sizes of different sample face images may be different, it is necessary to use an image scaling algorithm to resample and rearrange the pixels of the reference image according to the set target size, thereby changing the width and height of the image to form a uniform size. This allows the image to have the same feature dimensions in subsequent processing, facilitating processing. Specifically, common scaling algorithms include nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation, etc., and are not limited to these.
[0040] In step S203 of some embodiments, for each pixel value in the standard image data, the normalization method is used to calculate the pixel values of all images within the same numerical range, thereby eliminating numerical differences and avoiding numerical calculation problems caused by excessively large or small values, such as overflow or underflow, thus improving the stability and reliability of the trained model.
[0041] Specifically, normalization can be performed using methods such as mean normalization and variance normalization, and is not limited to these.
[0042] In some embodiments, in addition to format conversion, size transformation, and normalization of the sample face images, channel flipping, layout transformation, and filling can also be performed. The specific method to be selected depends on the actual scenario requirements and is not limited to these.
[0043] Please see Figure 3 In some embodiments, step S103 may include, but is not limited to, steps S301 to S304: Step S301: Digitize the sample image data to obtain initial image values; Step S302: Group the initial image values to obtain grouped image data; Step S303: Filter the grouped image data to obtain the target image data; Step S304: Quantize the target image data to obtain quantized image data.
[0044] Steps S301 to S304, as illustrated in the embodiments of this application, firstly digitize the sample images to obtain initial image values, providing basic data for subsequent operations; then group the images to facilitate processing of different parts, improving the targeting of the processing; next, filtering the grouped image data can remove noise and other useless information, improving data quality; finally, quantizing the target image data can reduce data storage space and transmission bandwidth usage, while facilitating subsequent analysis and processing. The overall process improves the efficiency and quality of image data processing.
[0045] In step S301 of some embodiments, continuous analog image signals are converted into discrete digital signals to form tensor data, i.e., initial image values. The initial image values can reflect the characteristics of each pixel in the image, such as brightness and color components. The image data exists in digital form, which facilitates subsequent operations such as image processing and feature extraction using various digital signal processing algorithms and computer technologies.
[0046] In step S302 of some embodiments, it can be understood that during model training, data is acquired in batches for corresponding training. The large-scale dataset is divided into multiple small batches, each containing a fixed number of samples, which are then input into the model sequentially for training or inference. Therefore, the initial image data is grouped according to a preset batch size in a specific order (such as random shuffling or sorting by category) to obtain multiple grouped image data.
[0047] It should be noted that each group of image data contains initial image values corresponding to multiple sample image data.
[0048] Please see Figure 4 In some embodiments, step S303 may include, but is not limited to, steps S401 to S405: Step S401: Perform numerical filtering on the grouped image data to obtain the maximum value sequence and the minimum value sequence; Step S402: Perform numerical calculations based on the maximum value sequence and the minimum value sequence to obtain the initial filtering parameters; wherein, the initial filtering parameters include: the mean of the maximum value, the mean of the minimum value, the variance of the maximum value, and the variance of the minimum value; Step S403: Construct a maximum value filtering interval based on the maximum value mean, maximum value variance, and preset redundant parameters; Step S404: Construct a minimum value filtering interval based on the minimum mean, minimum variance, and redundant parameters; Step S405: Filter each initial image value in the grouped image data based on the maximum value filtering interval and the minimum value filtering interval to obtain the target image data.
[0049] Steps S401 to S405, as illustrated in this embodiment, involve numerically filtering each group of image data to obtain a maximum value sequence and a minimum value sequence. This accurately locates extreme value features in the data, providing crucial information for subsequent analysis. Next, numerical calculations are performed on the maximum and minimum value sequences to obtain initial filtering parameters. These initial filtering parameters include the mean of the maximum value, the mean of the minimum value, the variance of the maximum value, and the variance of the minimum value. This allows for a comprehensive understanding of the central tendency and dispersion of the data, grasping the overall distribution pattern. Then, a maximum value filtering interval is constructed based on the mean of the maximum value, the variance of the maximum value, and a minimum value filtering interval is constructed based on the mean of the minimum value, the variance of the minimum value, and the redundant parameters. This reasonably defines the effective data range, enhancing the flexibility and adaptability of the filtering process. Finally, each initial image value in the grouped image data is filtered based on the maximum and minimum value filtering intervals. This effectively removes abnormal data, retains the target image data that meets the requirements, improves image data quality, reduces interference information, and provides a more accurate and reliable data foundation for subsequent image processing and analysis, improving overall processing effectiveness and efficiency.
[0050] In step S401 of some embodiments, each group of image data is traversed, the maximum and minimum values within the group are found, and all the maximum values are combined into a maximum value sequence and all the minimum values are combined into a minimum value sequence.
[0051] In step S402 of some embodiments, the mean of the maximum value sequence is calculated to obtain the maximum mean; the mean of the minimum value sequence is calculated to obtain the minimum mean; the variance of the maximum value sequence is calculated to obtain the maximum variance; and the variance of the minimum value sequence is calculated to obtain the minimum variance.
[0052] It should be noted that the preset redundancy parameters are pre-set according to the actual application scenario.
[0053] In some embodiments, the maximum value filtering interval can be set as follows: [max_mean-max_std×ignore_range, max_mean+max_std×ignore_range]; Where max_mean is the maximum mean, max_std is the maximum variance, and ignore_range is a preset redundancy parameter.
[0054] The minimum value filtering interval can be set as: [min_mean-min_std×ignore_range, min_mean+min_std×ignore_range]; Wherein, min_mean is the minimum mean, min_std is the minimum variance, and ignore_range is a preset redundancy parameter.
[0055] In step S405 of some embodiments, for each group of image data, the original maximum value and the original minimum value of the group of image data are obtained; if the original maximum value is in the maximum value filtering interval and the original minimum value is in the minimum value filtering interval, then the group of image data is retained and the group of image data is identified as one of the target image data. If the original maximum value is not in the maximum value filtering range and the original minimum value is in the minimum value filtering range, or the original maximum value is in the maximum value filtering range and the original minimum value is not in the minimum value filtering range, or the original maximum value is not in the maximum value filtering range and the original minimum value is not in the minimum value filtering range, then the group of image data is filtered out.
[0056] Understandably, by using dual filtering (where both the maximum and minimum values are within a reasonable range), it is possible to accurately select image data that meets the requirements, effectively remove abnormal data, improve the accuracy and reliability of image data, and provide a high-quality data foundation for subsequent image target recognition.
[0057] In step S304 of some embodiments, after obtaining the target image data, the target image data is subjected to the KLD algorithm interface for KLD quantization to obtain quantized image data, and the quantization parameters are saved.
[0058] In step S104 of some embodiments, the original recognition model is a model framework pre-defined according to the actual task of face image recognition, which includes certain initial parameters. For example, if the task is to distinguish gender, the original recognition model can be a gender recognition model; if the task is to distinguish facial expressions, the original recognition model can be an facial expression recognition model; if the task is to verify identity, the original recognition model can be an identity recognition model, etc., and is not limited to these.
[0059] After obtaining quantized image data, the original recognition model is trained based on the quantized image data. By continuously adjusting the model parameters, the error between the model's output and the real label is gradually reduced until the preset stopping condition is met, thus completing the model training. The trained target recognition model has better face recognition performance (recognition accuracy and robustness) and can accurately recognize targets in complex scenes.
[0060] For example: A convolutional neural network (CNN) is built using a deep learning framework as the original recognition model. The quantized sample face image data is divided into a training set and a validation set. The training set is input into the model for training. The weight parameters of the model are continuously adjusted through the backpropagation algorithm. At the same time, the performance of the model is monitored using the validation set. When the accuracy of the model on the validation set reaches more than 95%, training is stopped, and the target recognition model is obtained.
[0061] Please see Figure 5 In some embodiments, step S105 includes, but is not limited to, steps S501 to S504: Step S501: Perform image preprocessing on the original face image to obtain the target face image; Step S502: Quantize the target face image to obtain a quantized face image; Step S503: Perform gender recognition on the quantized face image using the target recognition model to obtain gender probability data; Step S504: Determine the person's gender based on the gender probability data, and confirm the person's gender as image recognition data of the original face image.
[0062] Steps S501 to S504, as illustrated in this embodiment, involve preprocessing the original face image to obtain the target face image. This preprocessing eliminates noise, adjusts size, and improves image quality, providing a good foundation for subsequent processing. Next, the target face image is quantized to obtain a quantized face image, reducing data volume, computational complexity, and processing efficiency. Finally, a target recognition model is used to perform gender recognition on the quantized face image, obtaining gender probability data. Based on this probability data, the person's gender is determined and incorporated into the image recognition data of the original face image, thus achieving fast and accurate gender recognition of the face image.
[0063] In step S501 of some embodiments, since the original face image is an image containing a face directly acquired from the acquisition device (such as a camera) without any processing, it may have problems such as noise, blurring, uneven lighting, and inconsistent size. Therefore, it is necessary to perform operations such as format conversion, size transformation, and normalization on the original face image to improve the image quality and obtain the target face image. The specific implementation is basically the same as that shown in steps S201 to S203 above, and will not be described again.
[0064] In step S502 of some embodiments, the target face image is quantized based on the quantization parameters obtained in step S304 above to obtain a quantized face image. This can reduce the amount of image data, improve the running efficiency of the model, and thus help improve the accuracy of target recognition.
[0065] In step S503 of some embodiments, if the target recognition model is used for gender recognition, then gender recognition is performed on the quantized face image based on the trained target recognition model. By analyzing the facial features in the image (such as facial contours, facial features, texture, etc.), the trained parameters are used to calculate and judge, and the probability of the face belonging to male or female is output, which is the gender probability data.
[0066] After obtaining the gender probability data, the gender probability data is compared based on a preset gender recognition threshold (such as 0.5). When the gender probability data is greater than or equal to the gender recognition threshold, the person's gender is determined to be male; when the gender probability data is less than the gender recognition threshold, the person's gender is determined to be female.
[0067] After obtaining the person's gender, the person's gender is confirmed as image recognition data of the original face image.
[0068] In step S503 of some other embodiments, if the target recognition model is used for identity recognition, then the quantized face image is identified based on the trained target recognition model. By analyzing the facial features in the image (such as facial contours, facial features, textures, etc.), the trained parameters are used to calculate and judge, the face is matched with a preset face database, similar faces are found, and the similarity between the face and the similar faces is calculated, which is the identity probability data.
[0069] After obtaining the identity probability data, the identity probability data is compared with a preset identity recognition threshold (such as 0.9). When the identity probability data is greater than or equal to the identity recognition threshold, the person's identity is determined to be the identity corresponding to the similar face; when the identity probability data is less than the identity recognition threshold, the person's identity is determined not to be the identity corresponding to the similar face, and the face recognition fails.
[0070] After obtaining the person's identity, the identity is confirmed as image recognition data of the original facial image.
[0071] In step S503 of some other embodiments, if the target recognition model is used for expression recognition, then expression recognition is performed on the quantized face image based on the trained target recognition model. By analyzing the facial features in the image, the trained parameters are used to calculate and judge, and the probability that the face belongs to a preset expression category is output, which is the expression probability data.
[0072] After obtaining the expression probability data, the corresponding expression type (such as smiling face, crying face, etc.) is determined based on the expression probability data, the human expression is obtained, and the human expression is confirmed as the image recognition data of the original human face image.
[0073] It should be noted that the target recognition task performed in step S105 needs to be determined according to the actual task of face image recognition, such as distinguishing gender, expression, adult / child, identity verification, etc., and is not limited to these.
[0074] Please see Figure 6 This application also provides a face image recognition device that can implement the above-described face image recognition method. The device includes: The sample data acquisition module 601 is used to acquire sample face images; wherein, the sample face images include sample label data; Image processing module 602 is used to preprocess the sample face image to obtain sample image data; The image quantization module 603 is used to quantize sample image data to obtain quantized image data. The recognition model training module 604 is used to train the preset original recognition model based on quantized image data and sample label data to obtain the target recognition model. The recognition module 605 is used to recognize the pre-acquired original face image based on the target recognition model to obtain the image recognition data of the original face image.
[0075] The specific implementation of this face image recognition device is basically the same as the specific implementation of the face image recognition method described above, and will not be repeated here.
[0076] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described face image recognition method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0077] Please see Figure 7 , Figure 7 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 701 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 702 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 702 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 702 and is called and executed by the processor 701 to execute the face image recognition method of the embodiments of this application. The input / output interface 703 is used to implement information input and output; The communication interface 704 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 705 transmits information between various components of the device (e.g., processor 701, memory 702, input / output interface 703, and communication interface 704); The processor 701, memory 702, input / output interface 703, and communication interface 704 are connected to each other within the device via bus 705.
[0078] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described face image recognition method.
[0079] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0080] The facial image recognition method, apparatus, electronic device, and storage medium provided in this application acquire sample facial images, including sample label data, and perform image preprocessing on the sample facial images to eliminate noise, standardize specifications, and improve data quality, making subsequent processing more accurate. Next, the sample image data is quantized to obtain quantized image data, which helps reduce computational complexity and improve processing efficiency. Furthermore, a preset original recognition model is trained based on the quantized image data to obtain a target recognition model that better meets actual needs and has stronger recognition capabilities. Finally, the trained target recognition model is used to recognize the pre-acquired original facial images to obtain image recognition data of the original facial images. The overall process improves the accuracy, efficiency, and practicality of facial image recognition.
[0081] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0082] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0083] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0084] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0085] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0086] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0087] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0088] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0089] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0090] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0091] The software tools or components not belonging to our company that appear in the embodiments of this application are for illustrative purposes only and do not represent actual use.
[0092] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A face image recognition method, characterized in that, The method includes: Acquire sample face images; wherein, the sample face images include sample label data; The sample face images are preprocessed to obtain sample image data; The sample image data is quantized to obtain quantized image data; The preset original recognition model is trained based on the quantized image data and the sample label data to obtain the target recognition model; Based on the target recognition model, the pre-acquired original face image is recognized to obtain the image recognition data of the original face image.
2. The method according to claim 1, characterized in that, The step of quantizing the sample image data to obtain quantized image data includes: The sample image data is digitized to obtain initial image values; The initial image values are grouped to obtain grouped image data; The grouped image data is filtered to obtain the target image data; The target image data is quantized to obtain the quantized image data.
3. The method according to claim 2, characterized in that, The step of filtering the grouped image data to obtain the target image data includes: Numerical filtering is performed on the grouped image data to obtain a maximum value sequence and a minimum value sequence; Numerical calculations are performed based on the maximum value sequence and the minimum value sequence to obtain initial filtering parameters; wherein, the initial filtering parameters include: the mean of the maximum value, the mean of the minimum value, the variance of the maximum value, and the variance of the minimum value; A maximum value filtering interval is constructed based on the mean of the maximum value, the variance of the maximum value, and the preset redundant parameters; A minimum value filtering interval is constructed based on the minimum value mean, the minimum value variance, and the redundant parameter; The target image data is obtained by filtering each initial image value in the grouped image data based on the maximum value filtering interval and the minimum value filtering interval.
4. The method according to claim 3, characterized in that, The step of filtering each initial image value in the grouped image data based on the maximum value filtering interval and the minimum value filtering interval to obtain the target image data includes: Obtain the original maximum and minimum values of the grouped image data; If the original maximum value is within the maximum value filtering interval and the original minimum value is within the minimum value filtering interval, then the grouped image data is used as the target image data.
5. The method according to claim 3, characterized in that, The initial filtering parameters are obtained by numerical calculation based on the maximum value sequence and the minimum value sequence, including: The mean of the maximum value sequence is calculated to obtain the mean of the maximum values; The mean of the minimum value sequence is calculated to obtain the mean of the minimum values; The variance of the maximum value sequence is calculated to obtain the variance of the maximum value; The variance of the minimum value sequence is calculated to obtain the minimum value variance.
6. The method according to any one of claims 1 to 5, characterized in that, The step of recognizing the pre-acquired original face image based on the target recognition model to obtain image recognition data of the original face image includes: The original face image is preprocessed to obtain the target face image; The target face image is quantized to obtain a quantized face image; The gender of the quantized face image is identified by the target recognition model to obtain gender probability data. The person's gender is determined based on the gender probability data, and the person's gender is confirmed as the image recognition data of the original face image.
7. The method according to any one of claims 1 to 5, characterized in that, The step of preprocessing the sample face images to obtain sample image data includes: The sample face images are converted to obtain baseline image data; The reference image data is resized to obtain standard image data; The standard image data is normalized to obtain the sample image data.
8. A face image recognition device, characterized in that, The device includes: A sample data acquisition module is used to acquire sample face images; wherein, the sample face images include sample label data; The image processing module is used to perform image preprocessing on the sample face image to obtain sample image data; The image quantization module is used to quantize the sample image data to obtain quantized image data; The recognition model training module is used to train a preset original recognition model based on the quantized image data and the sample label data to obtain a target recognition model; The recognition module is used to recognize the pre-acquired original face image based on the target recognition model to obtain the image recognition data of the original face image.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.