Face recognition method and device for adaptive scene, storage medium and electronic device
By acquiring image brightness and gain values for adaptive compensation, the problem of low accuracy and detection rate of face recognition under special lighting conditions is solved, and accurate recognition is achieved in backlight, low light and normal lighting scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies have poor accuracy and detection rates for face recognition under special lighting conditions (such as strong outdoor light or dim nighttime light), and existing solutions cannot achieve adaptive recognition.
By acquiring the image brightness and gain values of the face image to be recognized, the system adaptively compensates for the image brightness and gain values under different lighting conditions. Compensation is performed separately for backlight, low light, and normal light conditions to ensure that the image brightness and gain are within a preset range, thereby achieving accurate recognition.
It achieves accurate face recognition in backlight, low light, and normal light conditions, improving recognition accuracy and detection rate, and adapting to different lighting conditions.
Smart Images

Figure CN117133042B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of face recognition, in particular, to a face recognition method in an adaptive scene, a face recognition device in an adaptive scene, a storage medium and an electronic device. BACKGROUND
[0002] There are generally the following problems in face recognition based on two-dimensional plane images: in special light scenes, such as outdoor strong light, dim light at night, and the like extreme cases, the imaging quality of the picture is poor, resulting in poor face recognition detection rate and accuracy.
[0003] Specific problems are as follows: 1. In the case of outdoor strong light directly shining on the lens, the face is away from the light source, forming a backlight scene, the filter cannot completely filter the complex light, the sensor imaging is distorted, the RGB photo brightness is low, the photo is dark, and the face information is lost by more than half, and the algorithm can extract less feature information; 2. Under the irradiation of outdoor strong light, the infrared sensor captures more infrared light, the IR photo (near-infrared image) brightness is higher, and the photo is large area white, with less feature information; 3. At night, the RGB photo brightness is low, and the picture imaging is dark; 4. At night, the IR photo has more noise.
[0004] There are some solutions to the above problems, for example:
[0005] (1) using the similarity weighted method of RGB photo and IR photo to determine the face recognition threshold method; the optimization scheme of using color photo and IR photo to take similarity weight value in this scheme is only to take a compromise similarity to meet the set threshold, when the brightness and noise of the picture are affected by the environment to different degrees, this scheme cannot ensure that all abnormal scenes can be completely processed, and the accuracy will also be affected.
[0006] (2) fuse the visible light image and the near-infrared image, train a CNN classifier, obtain a target feature vector and a standard feature vector by training the classifier, increase the feature vector value, compare the target feature vector and the standard feature vector one by one, and improve the similarity method; this scheme combines color pictures and near-infrared images to increase the extractable feature values in the picture, and then compares the feature values extracted by the convolutional neural network with the standard vector one by one to obtain the similarity value. This scheme optimizes the face detection rate and recognition rate to a great extent, but the algorithm performance will be affected, and the false rejection rate and the false recognition rate cannot be guaranteed.
[0007] (3) Using the method of combining near-infrared images and three-dimensional point cloud data, extracting near-infrared image features and fusing point cloud features; this scheme proposes a combination of near-infrared images and point cloud data. However, point cloud data collection and processing are complex, and special sensors are needed to process point cloud data. This scheme increases the technical complexity and hardware cost.
[0008] (4) The method of directly mapping the face position coordinates in the IR image to the face coordinates in the RGB image and enhancing the brightness of the pixels in the face region of the RGB image. This scheme has the problems of inaccurate mapping area and incomplete face information, and does not solve the problem of overexposure of IR images in strong light scenes.
[0009] In summary, the above solutions overcome the problems caused by abnormal light to some extent, but cannot realize adaptive face recognition under special light conditions. SUMMARY
[0010] The main purpose of the present application is to provide an adaptive scene face recognition method, an adaptive scene face recognition device, a storage medium and an electronic device, which at least solve the problem of not being able to realize adaptive face recognition under special light conditions.
[0011] In order to achieve the above purpose, according to one aspect of the present application, an adaptive scene face recognition method is provided, comprising: acquiring a to-be-recognized face image, and acquiring an image brightness value and an image gain value of the to-be-recognized face image; in the case that the image brightness value of the to-be-recognized face image is greater than a brightness threshold value, determining that the current light scene is a backlight scene; in the case that the image brightness value of the to-be-recognized face image is less than or equal to the brightness threshold value and the image gain value is greater than an upper gain limit value, determining that the current light scene is a dark light scene, and in the case that the image brightness value of the to-be-recognized face image is less than or equal to the brightness threshold value and the image gain value is less than or equal to the upper gain limit value, determining that the current light scene is a normal light scene, wherein the greater the image gain value, the more image noise; respectively for the backlight scene, the dark light scene and the normal light scene, adaptively compensating the image brightness value and the image gain value of the to-be-recognized face image under each light scene, so that the compensated image brightness value is within a preset brightness range, the compensated image gain value is within a preset gain value range, and face recognition is performed on the compensated to-be-recognized face image.
[0012] Optionally, the to-be-identified face image is a to-be-identified RGB face image or a to-be-identified near-infrared face image, and in a case where the image brightness value of the to-be-identified face image is greater than a brightness threshold, the current light scene is determined to be a backlight scene, including: in a case where the image brightness value of the to-be-identified RGB face image is greater than a first brightness threshold, the current light scene is determined to be a backlight scene; and in a case where the image brightness value of the to-be-identified near-infrared face image is greater than a second brightness threshold, the current light scene is determined to be a backlight scene.
[0013] Optionally, in a case where the image brightness value of the to-be-identified face image is less than or equal to the brightness threshold and the image gain value is greater than an upper gain value, the current light scene is determined to be a dark-light scene, and in a case where the image brightness value of the to-be-identified face image is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper gain value, the current light scene is determined to be a normal light scene, including: in a case where the image brightness value of the to-be-identified RGB face image is less than or equal to the first brightness threshold and the image gain value is greater than a first upper gain value, the current light scene is determined to be a dark-light scene, and in a case where the image brightness value of the to-be-identified RGB face image is less than or equal to the first brightness threshold and the image gain value is less than or equal to the first upper gain value, the current light scene is determined to be a normal light scene; and in a case where the image brightness value of the to-be-identified near-infrared face image is less than or equal to the second brightness threshold and the image gain value is greater than a second upper gain value, the current light scene is determined to be a dark-light scene, and in a case where the image brightness value of the to-be-identified near-infrared face image is less than or equal to the second brightness threshold and the image gain value is less than or equal to the second upper gain value, the current light scene is determined to be a normal light scene.
[0014] Optionally, the image brightness value and the image gain value of the to-be-identified face image in each light scene are adaptively compensated to make the compensated image brightness value within a preset brightness range and the compensated image gain value within a preset gain value range, respectively for the back light scene, the dark light scene and the normal light scene, including: for the back light scene, reducing the image brightness value to make the compensated image brightness value within the preset brightness range, and setting the image gain compensation value to zero to make the compensated image gain value within the preset gain value range; for the dark light scene, increasing the image brightness value while reducing the image gain value to make the compensated image brightness value within the preset brightness range and the compensated image gain value within the preset gain value range; for the normal light scene, configuring the image brightness compensation value to be a zero brightness compensation value and configuring the image gain compensation value to be a zero gain compensation value to make the compensated image brightness value within the preset brightness range and the compensated image gain value within the preset gain value range.
[0015] Optionally, for the dark light scene, the image gain value is reduced, including: adjusting a parameter of an image sensor based on the image gain value to reduce the image gain value, wherein the parameter of the image sensor includes a gain value.
[0016] Optionally, the method further includes: determining the to-be-identified face image as a sample image in a case where the to-be-identified face image satisfies at least one of a first preset condition and a second preset condition, wherein the first preset condition represents that the image brightness value of the to-be-identified face image is not within the preset brightness range, and the second preset condition represents that the image gain value of the to-be-identified face image is not within the preset gain value range; performing model training by using a plurality of sample images that only satisfy the first preset condition to obtain a first image recognition model; and performing model training by using a plurality of sample images that simultaneously satisfy the first preset condition and the second preset condition to obtain a second image recognition model.
[0017] Optionally, the to-be-identified face image is a to-be-identified RGB face image or a to-be-identified near-infrared face image, an image sensor for collecting the to-be-identified RGB face image is a color camera, and an image sensor for collecting the to-be-identified near-infrared face image is an infrared camera, and the method further includes: in a case where the image brightness value of the to-be-identified RGB face image is less than a first lower limit of brightness value, controlling a white light fill light to be turned on to fill light; and in a case where the image brightness value of the to-be-identified near-infrared face image is less than a second lower limit of brightness value, controlling an infrared light fill light to be turned on to fill light.
[0018] According to another aspect of the present application, there is provided a face recognition device for adaptive scenes, comprising: an acquisition unit configured to acquire a face image to be recognized and to acquire an image brightness value and an image gain value of the face image to be recognized; a first determination unit configured to determine that a current light scene is a backlight scene if the image brightness value of the face image to be recognized is greater than a brightness threshold; a second determination unit configured to determine that the current light scene is a dark light scene if the image brightness value of the face image to be recognized is less than or equal to the brightness threshold and the image gain value is greater than an upper gain limit value, and to determine that the current light scene is a normal light scene if the image brightness value of the face image to be recognized is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper gain limit value, wherein the greater the image gain value, the more image noise; and a compensation unit configured to adaptively compensate the image brightness value and the image gain value of the face image to be recognized in each light scene for the backlight scene, the dark light scene and the normal light scene respectively, so that the compensated image brightness value is within a preset brightness range, the compensated image gain value is within a preset gain value range, and face recognition is performed on the compensated face image to be recognized.
[0019] According to yet another aspect of the present application, there is provided a computer-readable storage medium comprising a stored program, wherein the program, when executed, controls a device in which the computer-readable storage medium is located to perform any of the face recognition methods for adaptive scenes.
[0020] According to still another aspect of the present application, there is provided an electronic device comprising one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs comprise a program for performing any of the face recognition methods for adaptive scenes.
[0021] By applying the technical solution of this application, an image of a face to be recognized is acquired, along with its image brightness and image gain values. If the image brightness is greater than a brightness threshold, the current lighting scene is determined to be a backlight scene. If the image brightness is less than or equal to the brightness threshold and the image gain is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness is less than or equal to the brightness threshold and the image gain is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal lighting scene. Then, for backlight, dark, and normal lighting scenes, the image brightness and image gain values of the face to be recognized are adaptively compensated for each lighting scene. This achieves accurate differentiation between backlight, dark, and normal lighting scenes. Furthermore, by adaptively compensating for the image brightness and image gain values of the face to be recognized under different lighting scenes, accurate recognition of the face images acquired under various lighting conditions is achieved. Attached Figure Description
[0022] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0023] Figure 1 A hardware structure block diagram of a mobile terminal performing an adaptive scene face recognition method according to an embodiment of this application is shown.
[0024] Figure 2 A flowchart illustrating an adaptive scene face recognition method according to an embodiment of this application is shown.
[0025] Figure 3 A flowchart illustrating a first specific adaptive scene face recognition method according to an embodiment of this application is shown.
[0026] Figure 4 A flowchart illustrating a second specific adaptive scene face recognition method provided according to an embodiment of this application is shown;
[0027] Figure 5 A flowchart illustrating the image model training process according to an embodiment of this application is shown;
[0028] Figure 6 A schematic diagram of an adaptive scene face recognition device provided according to an embodiment of this application is shown. Detailed Implementation
[0029] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, 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 for the embodiments of this application 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.
[0032] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0033] Facial recognition: A biometric technology that identifies individuals by extracting and modeling facial features from two-dimensional images.
[0034] RGB image: This refers to the original color photograph obtained by a regular optical camera. The wavelength is between 0.450 and 0.680. It is usually arranged in RGB16, RGB24, RGB32 and other arrangements.
[0035] An IR image is an image formed by a photosensitive element receiving the near-infrared spectrum of light reflected or emitted by a target object. Its full English name is near-infrared image.
[0036] As described in the background section, the relevant solutions have overcome the problems caused by abnormal lighting to some extent, but they cannot achieve adaptive face recognition under special lighting conditions. In order to solve the problem of not being able to achieve adaptive face recognition under special lighting conditions, the embodiments of this application provide an adaptive scene face recognition method, an adaptive scene face recognition device, a storage medium, and an electronic device.
[0037] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0038] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for an adaptive scene face recognition method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0039] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the adaptive scene face recognition method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0040] This embodiment provides an adaptive face recognition method that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0041] Figure 2 This is a flowchart of an adaptive scene face recognition method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0042] Step S201: Obtain the face image to be recognized, and obtain the image brightness value and image gain value of the face image to be recognized;
[0043] The preferred image brightness value is the average image brightness value.
[0044] For example, the face image to be identified is either an RGB face image or a near-infrared face image; the image sensor for acquiring the RGB face image is a color camera, and the image sensor for acquiring the near-infrared face image is an infrared camera.
[0045] It should be noted that the above-mentioned RGB face images and near-infrared face images to be identified are merely examples. The solution of this application is applicable to other types of face images to be identified besides RGB face images and near-infrared face images to be identified.
[0046] Step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, the current lighting scene is determined to be a backlight scene.
[0047] That is, when the brightness of the image of the face to be identified is abnormally high, it is determined to be a backlit scene;
[0048] Specifically, step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, determine that the current lighting scene is a backlight scene, which specifically includes:
[0049] Step S2021: If the image brightness value of the RGB face image to be identified is greater than the first brightness threshold, determine that the current lighting scene is a backlight scene;
[0050] Step S2022: If the image brightness value of the near-infrared face image to be identified is greater than the second brightness threshold, the current lighting scene is determined to be a backlight scene.
[0051] The first brightness threshold corresponding to the RGB face image to be identified and the second brightness threshold corresponding to the near-infrared face image to be identified are different brightness thresholds. Setting different thresholds for different types of face images to be identified can achieve targeted and personalized design, ensuring the accuracy of face recognition.
[0052] Step S203: If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal light scene. The larger the image gain value, the more image noise there is.
[0053] As mentioned above, when the brightness value of the face image to be identified is low and the image gain value is high, i.e., there is a lot of noise, the current lighting scene is determined to be a low-light scene.
[0054] As mentioned above, when the brightness value and image gain value of the face image to be identified are small, i.e., the noise is small, the current lighting scene is determined to be a normal lighting scene, i.e., it is not a backlighting scene or a dark light scene or other abnormal lighting scene.
[0055] Step S204: For backlighting, low-light and normal lighting scenarios, adaptively compensate the image brightness and image gain values of the face image to be recognized under each lighting scenario, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and perform face recognition on the compensated face image to be recognized.
[0056] The above describes the different compensation methods set for different lighting scenarios, that is, adaptively compensating the image brightness value and image gain value of the face image to be identified under each lighting scenario, which can achieve accurate recognition of the face image to be identified obtained under different lighting scenarios.
[0057] The adaptive scene-based face recognition method of this application acquires an image of the face to be recognized, and obtains its image brightness and image gain values. If the image brightness value of the face to be recognized is greater than a brightness threshold, the current lighting scene is determined to be a backlight scene. If the image brightness value is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a low-light scene. If the image brightness value is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal lighting scene. Then, for backlight, low-light, and normal lighting scenes respectively, the method adaptively compensates for the image brightness and image gain values of the face to be recognized under each lighting scene. This achieves accurate differentiation between backlight, low-light, and normal lighting scenes. Furthermore, while achieving scene differentiation, the method adaptively compensates for the image brightness and image gain values of the face to be recognized under different lighting scenes, enabling accurate recognition of face images acquired under various lighting conditions.
[0058] Specifically, if the image brightness value of the face image to be identified is less than or equal to a brightness threshold and the image gain value is greater than a gain upper limit, the current lighting scene is determined to be a low-light scene. If the image brightness value of the face image to be identified is less than or equal to a brightness threshold and the image gain value is less than or equal to a gain upper limit, the current lighting scene is determined to be a normal lighting scene, including:
[0059] If the image brightness value of the RGB face image to be identified is less than or equal to the first brightness threshold and the image gain value is greater than the first gain upper limit, the current lighting scene is determined to be a dark light scene. If the image brightness value of the RGB face image to be identified is less than or equal to the first brightness threshold and the image gain value is less than or equal to the first gain upper limit, the current lighting scene is determined to be a normal light scene.
[0060] If the image brightness value of the near-infrared face image to be identified is less than or equal to the second brightness threshold and the image gain value is greater than the second gain upper limit, the current lighting scene is determined to be a dark light scene. If the image brightness value of the near-infrared face image to be identified is less than or equal to the second brightness threshold and the image gain value is less than or equal to the second gain upper limit, the current lighting scene is determined to be a normal light scene.
[0061] The above refers to low-light scenes, such as nighttime or dark indoor environments;
[0062] The above-mentioned RGB face images and near-infrared face images to be identified are also exemplary, and the solution of this application can be applied to other types of face images to be identified;
[0063] The first upper limit of gain corresponding to the RGB face image to be identified and the second upper limit of gain corresponding to the near-infrared face image to be identified are different. That is to say, different upper limit of gain are set for different face images to be identified in order to achieve accurate recognition of face images to be identified under different lighting conditions.
[0064] Furthermore, for backlit scenes, low-light scenes, and normal lighting scenes, the image brightness and image gain values of the face image to be recognized are adaptively compensated for each lighting scene, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, including:
[0065] For backlit scenes, reduce the image brightness value so that the compensated image brightness value is within the preset brightness range, and set the image gain compensation value to zero so that the compensated image gain value is within the preset gain value range.
[0066] Here, an image gain compensation value of zero means that the image gain value before compensation is the same as the image gain value after compensation. In other words, for backlit scenes, compensation can be achieved simply by reducing the image brightness value.
[0067] Of course, under normal circumstances, the image gain value in backlit scenes is within the preset gain value range, so there is no need to adaptively compensate the image gain. When determining whether it is a backlit scene, there is no need to judge the magnitude of the image gain value. The determination of whether it is a backlit scene is achieved solely through the image brightness value.
[0068] For low-light scenes, increase the image brightness value while decreasing the image gain value, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range.
[0069] One way to increase image brightness is by looking up a table. Specifically, you can adjust the image brightness by consulting the brightness table provided by the camera manufacturer.
[0070] The image exhibits low brightness and high noise (gain value). While increasing the image brightness, the image gain value is simultaneously read. A higher gain value corresponds to more noise, and vice versa. When the image gain value exceeds a set threshold, the gain value is reduced by passing parameters to the sensor, thus reducing noise.
[0071] In low-light scenes, not only is the image brightness low, but the image also has a lot of noise. Therefore, by increasing the image brightness while decreasing the image gain, that is, by brightening and denoising simultaneously, the image quality can be improved. This can ensure that the compensated image brightness is within a preset brightness range and the compensated image gain is within a preset gain range, which facilitates the implementation of subsequent image recognition steps.
[0072] For normal lighting scenarios, the image brightness compensation value is configured to be zero and the image gain compensation value is configured to be zero, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range.
[0073] In other words, in a normal lighting scene, it can be achieved through zero compensation, meaning that the values before and after compensation are the same, which is equivalent to not going through a compensation step. This is because the face image to be recognized obtained under normal lighting conditions can generally achieve accurate face recognition after processing.
[0074] Specifically, for low-light scenes, the image gain value is reduced, including:
[0075] Image sensor parameters are adjusted based on image gain values to reduce the image gain value. These parameters include the gain value. In other words, reducing image gain, or noise, can be achieved by transferring parameters from the image sensor. The image sensor gain value includes both digital and analog gain values.
[0076] Furthermore, the method also includes:
[0077] If the face image to be identified satisfies at least one of the first preset condition and the second preset condition, the face image to be identified is determined as a sample image. The first preset condition indicates that the image brightness value of the face image to be identified is not within a preset brightness range, and the second preset condition indicates that the image gain value of the face image to be identified is not within a preset gain value range.
[0078] A first image recognition model is obtained by training a model using multiple sample images that only meet the first preset condition.
[0079] Among them, multiple sample images that only meet the first preset condition correspond to the backlight scene mentioned above;
[0080] A second image recognition model is obtained by training a model using multiple sample images that simultaneously meet the first and second preset conditions.
[0081] Among them, multiple sample images that simultaneously satisfy the first preset condition and the second preset condition correspond to the above-mentioned dark light scene.
[0082] In other words, the model is trained separately for backlit and low-light scenes to obtain a first image recognition model and a second image recognition model, which are then used for subsequent face recognition. This achieves adaptive face image recognition in various scenes.
[0083] When it is determined that the current face image belongs to a special lighting environment, the image is automatically collected as a sample image for algorithm training. The algorithm is periodically trained with samples to improve the model accuracy.
[0084] Furthermore, once a certain number of sample images are collected, the algorithm reads these sample images for training. The training results of such samples can greatly improve the accuracy and detection rate of the algorithm in special use cases, thereby enhancing the algorithm's adaptability.
[0085] Of course, there are also image recognition models for normal lighting scenarios that differ from the first and second image recognition models.
[0086] Furthermore, the method also includes:
[0087] If the brightness value of the RGB face image to be recognized is less than the first brightness lower limit, control the white light fill light to turn on to fill the light;
[0088] If the brightness value of the near-infrared face image to be identified is less than the second lower limit of brightness, the infrared fill light is turned on to provide supplementary illumination.
[0089] In other words, when the brightness of the face image to be recognized is too low, the fill light is turned on to provide supplementary lighting. Specifically, white light fill light is turned on for RGB face images to be recognized, and infrared light fill light is turned on for near-infrared face images to be recognized.
[0090] Specifically, adjust the fill light to the corresponding level based on different brightness values to achieve targeted fill lighting.
[0091] Furthermore, the method also includes comparing the similarity of the identified faces with a similarity threshold. If the similarity is greater than the threshold, the recognition is considered successful; otherwise, the recognition fails and the result is discarded. To improve the accuracy of the algorithm, it can be set to record 5 consecutive recognition results, and the recognition action is considered complete when 3 of them are successful.
[0092] In this scheme, the current lighting environment is determined by reading the image brightness and gain values. On one hand, the image quality is adjusted to make more usable information in the image; on the other hand, images of backlit scenes and low-light night scenes are automatically collected as training samples for the algorithm to improve the recognition accuracy of the algorithm under different lighting conditions.
[0093] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the adaptive scene face recognition method of this application will be described in detail below with reference to specific embodiments.
[0094] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0095] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the adaptive scene face recognition method of this application will be described in detail below with reference to specific embodiments.
[0096] This embodiment relates to a specific adaptive scene face recognition method applicable to RGB face images to be recognized, such as... Figure 3 As shown, it includes:
[0097] Step S1: Obtain the RGB face image to be recognized;
[0098] Step S2: Obtain the image brightness value and image gain value of the RGB face image to be recognized;
[0099] Step S3: Determine whether the image brightness value is greater than the first brightness threshold. If yes, proceed to step S41; otherwise, proceed to step S42.
[0100] Step S41: Determine that it is a backlit scene and reduce the image brightness value;
[0101] Step S42: Determine whether the image gain value is greater than the first upper limit of gain. If yes, confirm it as a low-light scene and simultaneously reduce the image gain value; if no, confirm it as a normal lighting scene.
[0102] Step S5: The algorithm extracts facial information and obtains the facial recognition result.
[0103] A method for determining lighting conditions based on image brightness and noise was implemented, which can automatically adjust the algorithm to different modes to improve face detection and recognition rates. This addresses the issue of reduced algorithm accuracy caused by interference from various special lighting conditions.
[0104] This embodiment relates to a specific adaptive scene face recognition method, such as... Figure 4 As shown, it includes the following steps:
[0105] Step S1: Acquire the near-infrared face image to be identified;
[0106] Step S2: Obtain the image brightness value and image gain value of the near-infrared face image to be identified;
[0107] Step S3: Determine whether the image brightness value is greater than the second brightness threshold. If yes, proceed to step S41; otherwise, proceed to step S42.
[0108] Step S41: Determine that it is a backlit scene and reduce the image brightness value;
[0109] Step S42: Determine whether the image gain value is greater than the second upper limit value. If yes, confirm it as a low-light scene and simultaneously reduce the image gain value; if no, confirm it as a normal lighting scene.
[0110] Step S5: The algorithm extracts facial information and obtains the facial recognition result.
[0111] A method for determining lighting conditions based on image brightness and noise was implemented, which can automatically adjust the algorithm to different modes to improve face detection and recognition rates. This addresses the issue of reduced algorithm accuracy caused by interference from various special lighting conditions.
[0112] This embodiment relates to a method for training a face recognition model, such as... Figure 5 As shown, it includes the following steps:
[0113] Step S1: Acquire the near-infrared face image to be identified / the RGB face image to be identified;
[0114] Step S2: Obtain the image brightness value and image gain value of the image to be identified;
[0115] Step S3: Determine whether the image brightness value is within the preset brightness range. If not, obtain the sample image. Alternatively, continue to determine whether the image gain value is within the preset gain value range. If not, obtain the sample image.
[0116] Step S4: Use sample images for training to obtain a new image recognition model and a threshold for the face recognition algorithm.
[0117] Specifically, when the core algorithm is fixed, the thresholds for the image recognition model and face recognition algorithm trained on different sample sets will vary. Increasing sample diversity allows the algorithm to use corresponding models and thresholds in different scenarios, resulting in higher recognition accuracy. Therefore, the algorithm can derive three thresholds for face recognition algorithms in backlight, low light, and normal lighting scenarios: 0.65, 0.7, and 0.8, respectively, to adapt to different scenarios. When the Y-value and gain value indicate a backlight environment, the corresponding image recognition model and face recognition algorithm threshold of 0.65 is used for recognition; when the Y-value and gain value indicate a low light scene, the corresponding image recognition model and face recognition algorithm threshold of 0.7 is used; and under normal lighting conditions, the image recognition model and face recognition algorithm trained on the corresponding normal lighting sample set with a threshold of 0.8 is used. The choice of model and threshold directly depends on the judgment of the image's Y-value and gain value. The model and threshold switch according to the determined lighting environment to achieve more accurate recognition.
[0118] To ensure the accuracy of the algorithm in extreme lighting conditions, this invention automatically collects images under special lighting environments as samples and automatically retrains the algorithm model. Images from backlighting, nighttime, and bright lighting scenarios are used as the sample set, which strengthens the algorithm's resistance to light interference and improves its accuracy.
[0119] This application also provides an adaptive scene face recognition device. It should be noted that the adaptive scene face recognition device of this application can be used to execute the adaptive scene face recognition method provided in this application. This device is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0120] The following describes the adaptive scene face recognition device provided in the embodiments of this application.
[0121] Figure 6 This is a schematic diagram of an adaptive scene face recognition device according to an embodiment of this application. Figure 6 As shown, the device includes:
[0122] The acquisition unit 61 is used to acquire the face image to be recognized, and to acquire the image brightness value and image gain value of the face image to be recognized;
[0123] The first determining unit 62 is used to determine that the current lighting scene is a backlight scene when the image brightness value of the face image to be identified is greater than the brightness threshold.
[0124] The second determining unit 63 is used to determine the current lighting scene as a dark light scene when the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, and to determine the current lighting scene as a normal light scene when the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, wherein the larger the image gain value, the more image noise there is.
[0125] The compensation unit 64 is used to adaptively compensate the image brightness value and image gain value of the face image to be recognized under each lighting scene, such as backlight scene, low light scene and normal light scene, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and to perform face recognition on the compensated face image to be recognized.
[0126] The adaptive scene face recognition device of this application includes an acquisition unit that acquires an image of a face to be recognized, and acquires the image brightness value and image gain value of the image of the face to be recognized. A first determining unit determines the current lighting scene as a backlight scene when the image brightness value of the image of the face to be recognized is greater than a brightness threshold. A second determining unit determines the current lighting scene as a low-light scene when the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value. A third determining unit determines the current lighting scene as a normal lighting scene when the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value. A compensation unit adaptively compensates the image brightness value and image gain value of the image of the face to be recognized under each lighting scene. This achieves accurate differentiation between backlight, low-light, and normal lighting scenes. Furthermore, while achieving differentiation of lighting scenes, it adaptively compensates the image brightness value and image gain value of the image of the face to be recognized under different lighting scenes, thus achieving accurate recognition of the image of the face to be recognized acquired under different lighting scenes.
[0127] In this embodiment, the face image to be identified is either an RGB face image or a near-infrared face image. The first determining unit includes a first determining module and a second determining module. The first determining module is used to determine that the current lighting scene is a backlight scene when the image brightness value of the RGB face image to be identified is greater than a first brightness threshold. The second determining module is used to determine that the current lighting scene is a backlight scene when the image brightness value of the near-infrared face image to be identified is greater than a second brightness threshold. The first brightness threshold corresponding to the RGB face image to be identified and the second brightness threshold corresponding to the near-infrared face image to be identified are different brightness thresholds. Setting different thresholds for different types of face images to be identified allows for targeted and personalized design, ensuring the accuracy of face recognition.
[0128] In this embodiment, the second determining unit includes a third determining module and a fourth determining module. The third determining module is used to determine the current lighting scene as a dark light scene when the image brightness value of the RGB face image to be identified is less than or equal to a first brightness threshold and the image gain value is greater than a first gain upper limit value; and to determine the current lighting scene as a normal light scene when the image brightness value of the RGB face image to be identified is less than or equal to the first brightness threshold and the image gain value is less than or equal to the first gain upper limit value. The fourth determining module is used to determine the current lighting scene as a dark light scene when the image brightness value of the near-infrared face image to be identified is less than or equal to a second brightness threshold and the image gain value is greater than a second gain upper limit value; and to determine the current lighting scene as a normal light scene when the image brightness value of the near-infrared face image to be identified is less than or equal to the second brightness threshold and the image gain value is less than or equal to the second gain upper limit value. The first gain upper limit value corresponding to the RGB face image to be identified and the second gain upper limit value corresponding to the near-infrared face image to be identified are different. That is, different gain upper limits are set for different face images to be identified, so as to achieve accurate identification of face images acquired under different lighting scenes.
[0129] In this embodiment, the compensation unit includes a first compensation module, a second compensation module, and a third compensation module. The first compensation module is used for backlighting scenes to reduce the image brightness value so that the compensated image brightness value is within a preset brightness range, and to set the image gain compensation value to zero so that the compensated image gain value is within a preset gain value range. The second compensation module is used for low-light scenes to increase the image brightness value while decreasing the image gain value so that the compensated image brightness value and the compensated image gain value are both within a preset brightness range. The third compensation module is used for normal lighting scenes to configure the image brightness compensation value to zero and the image gain compensation value to zero, so that the compensated image brightness value and the compensated image gain value are both within a preset brightness range. Here, zero image gain compensation value means that the image gain value before compensation and the image gain value after compensation are the same. In other words, for backlit scenes, compensation can be achieved simply by reducing the image brightness value. In low-light scenes, not only is the image brightness value low, but there is also a lot of noise in the image. Therefore, by increasing the image brightness value while reducing the image gain value, the compensated image brightness value can be within a preset brightness range, and the compensated image gain value can be within a preset gain value range. This facilitates the implementation of subsequent image recognition steps. In normal lighting scenes, zero compensation can be achieved, that is, the values before and after compensation are the same, which can be equivalent to a step without compensation. This is because the face image to be recognized obtained in normal lighting scenes can generally achieve accurate face recognition after processing.
[0130] In this embodiment, the second compensation module is further configured to adjust the parameters of the image sensor based on the image gain value to reduce the image gain value. The parameters of the image sensor include a gain value. That is, the image gain value can be reduced by passing parameters to the image sensor, thereby reducing noise. The gain value of the image sensor includes both digital gain and analog gain values.
[0131] In this embodiment, the device further includes a third determining unit, a first training unit, and a second training unit. The third determining unit is used to determine the face image to be recognized as a sample image when the face image to be recognized meets at least one of a first preset condition and a second preset condition. The first preset condition indicates that the image brightness value of the face image to be recognized is not within a preset brightness range, and the second preset condition indicates that the image gain value of the face image to be recognized is not within a preset gain value range. The first training unit is used to train a model using multiple sample images that only meet the first preset condition to obtain a first image recognition model. The second training unit is used to train a model using multiple sample images that simultaneously meet the first and second preset conditions to obtain a second image recognition model. The multiple sample images that only meet the first preset condition correspond to the aforementioned backlight scene; the multiple sample images that simultaneously meet the first and second preset conditions correspond to the aforementioned dark light scene. That is, the model is trained separately for backlight and dark light scenes to obtain the first image recognition model and the second image recognition model, respectively, for subsequent face recognition. This achieves adaptive face image recognition in various scenes.
[0132] In this embodiment, the face image to be recognized is either an RGB face image or a near-infrared face image. The image sensor for acquiring the RGB face image is a color camera, and the image sensor for acquiring the near-infrared face image is an infrared camera. The device also includes a first supplementary lighting unit and a second supplementary lighting unit. The first supplementary lighting unit controls a white light supplementary light to be turned on to provide supplementary lighting when the brightness value of the RGB face image to be recognized is less than a first lower brightness limit. The second supplementary lighting unit controls an infrared light supplementary light to be turned on to provide supplementary lighting when the brightness value of the near-infrared face image to be recognized is less than a second lower brightness limit. In other words, when the brightness of the face image to be recognized is too low, supplementary lighting is turned on. Specifically, a white light supplementary light is turned on for the RGB face image to be recognized, and an infrared light supplementary light is turned on for the near-infrared face image to be recognized.
[0133] The adaptive scene face recognition device includes a processor and a memory. The aforementioned acquisition unit, first determination unit, second determination unit, and compensation unit are all stored as program units in the memory. The processor executes the aforementioned program units stored in the memory to achieve the corresponding functions. All of the above modules are located in the same processor; alternatively, the above modules are located in different processors in any combination.
[0134] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and adaptive face recognition can be achieved by adjusting kernel parameters.
[0135] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0136] This invention provides an electronic device, including: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a face recognition method for performing any of the adaptive scenarios.
[0137] This invention provides a computer-readable storage medium including a stored program, wherein the program controls the device where the computer-readable storage medium is located to execute an adaptive scene face recognition method when it is running.
[0138] Specifically, adaptive scene face recognition methods include:
[0139] Step S201: Obtain the face image to be recognized, and obtain the image brightness value and image gain value of the face image to be recognized;
[0140] Step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, the current lighting scene is determined to be a backlight scene.
[0141] Step S203: If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal light scene. The larger the image gain value, the more image noise there is.
[0142] Step S204: For backlighting, low-light and normal lighting scenarios, adaptively compensate the image brightness and image gain values of the face image to be recognized under each lighting scenario, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and perform face recognition on the compensated face image to be recognized.
[0143] This invention provides a processor for running a program, wherein the program executes an adaptive scene face recognition method during runtime.
[0144] Specifically, adaptive scene face recognition methods include:
[0145] Step S201: Obtain the face image to be recognized, and obtain the image brightness value and image gain value of the face image to be recognized;
[0146] Step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, the current lighting scene is determined to be a backlight scene.
[0147] Step S203: If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal light scene. The larger the image gain value, the more image noise there is.
[0148] Step S204: For backlighting, low-light and normal lighting scenarios, adaptively compensate the image brightness and image gain values of the face image to be recognized under each lighting scenario, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and perform face recognition on the compensated face image to be recognized.
[0149] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps. The device described herein may be a server, PC, PAD, mobile phone, etc.
[0150] Step S201: Obtain the face image to be recognized, and obtain the image brightness value and image gain value of the face image to be recognized;
[0151] Step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, the current lighting scene is determined to be a backlight scene.
[0152] Step S203: If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal light scene. The larger the image gain value, the more image noise there is.
[0153] Step S204: For backlighting, low-light and normal lighting scenarios, adaptively compensate the image brightness and image gain values of the face image to be recognized under each lighting scenario, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and perform face recognition on the compensated face image to be recognized.
[0154] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0155] Step S201: Obtain the face image to be recognized, and obtain the image brightness value and image gain value of the face image to be recognized;
[0156] Step S202: If the image brightness value of the face image to be identified is greater than the brightness threshold, the current lighting scene is determined to be a backlight scene.
[0157] Step S203: If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal light scene. The larger the image gain value, the more image noise there is.
[0158] Step S204: For backlighting, low-light and normal lighting scenarios, adaptively compensate the image brightness and image gain values of the face image to be recognized under each lighting scenario, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and perform face recognition on the compensated face image to be recognized.
[0159] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0160] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0161] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0162] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0163] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0164] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0165] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0166] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0167] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0168] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0169] 1) The adaptive scene face recognition method of this application acquires an image of the face to be recognized, and obtains the image brightness value and image gain value of the image of the face to be recognized. If the image brightness value of the image of the face to be recognized is greater than a brightness threshold, the current lighting scene is determined to be a backlight scene. If the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value, the current lighting scene is determined to be a dark light scene. If the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value, the current lighting scene is determined to be a normal lighting scene. Then, for backlight scenes, dark light scenes, and normal lighting scenes respectively, the image brightness value and image gain value of the face to be recognized are adaptively compensated for each lighting scene. This achieves accurate differentiation between backlight scenes, dark light scenes, and normal lighting scenes. Furthermore, under the premise of achieving differentiation of lighting scenes, the method adaptively compensates for the image brightness value and image gain value of the face to be recognized for different lighting scenes, thus achieving accurate recognition of the face images acquired under different lighting scenes.
[0170] 2) The adaptive scene face recognition device of this application includes an acquisition unit that acquires an image of a face to be recognized, and acquires the image brightness value and image gain value of the image of the face to be recognized. A first determining unit determines the current lighting scene as a backlight scene when the image brightness value of the image of the face to be recognized is greater than a brightness threshold. A second determining unit determines the current lighting scene as a dark light scene when the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of the gain value. Conversely, it determines the current lighting scene as a normal light scene when the image brightness value of the image of the face to be recognized is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of the gain value. A compensation unit adaptively compensates for the image brightness value and image gain value of the image of the face to be recognized under each lighting scene (backlight, dark, and normal). This achieves accurate differentiation between backlight, dark, and normal lighting scenes. Furthermore, while achieving differentiation of lighting scenes, it adaptively compensates for the image brightness value and image gain value of the image of the face to be recognized under different lighting scenes, thus achieving accurate recognition of the face images acquired under different lighting scenes.
[0171] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An adaptive scene face recognition method, characterized in that, include: Acquire the image of the face to be identified, and obtain the image brightness value and image gain value of the image of the face to be identified; If the image brightness value of the face image to be identified is greater than a brightness threshold, the current lighting scene is determined to be a backlight scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of gain, the current lighting scene is determined to be a dark lighting scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of gain, the current lighting scene is determined to be a normal lighting scene. The larger the image gain value, the more image noise there is. For the backlit scene, the low-light scene, and the normal lighting scene, the image brightness value and the image gain value of the face image to be identified are adaptively compensated for each lighting scene, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and face recognition is performed on the compensated face image to be identified. For the backlit scene, the low-light scene, and the normal lighting scene, respectively, the image brightness value and the image gain value of the face image to be identified are adaptively compensated for each lighting scene, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, including: For the backlight scene, the image brightness value is reduced so that the compensated image brightness value is within the preset brightness range, and the image gain compensation value is set to zero so that the compensated image gain value is within the preset gain value range. For the low-light scene, the image brightness value is increased while the image gain value is decreased, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range. For the normal lighting scene, the image brightness compensation value is configured to be zero and the image gain compensation value is configured to be zero, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range.
2. The method according to claim 1, characterized in that, The face image to be identified is either an RGB face image or a near-infrared face image. If the brightness value of the face image to be identified is greater than a brightness threshold, the current lighting scene is determined to be a backlight scene, including: If the image brightness value of the RGB face image to be identified is greater than a first brightness threshold, the current lighting scene is determined to be a backlight scene. If the image brightness value of the near-infrared face image to be identified is greater than the second brightness threshold, the current lighting scene is determined to be a backlight scene.
3. The method according to claim 2, characterized in that, If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper gain limit, the current lighting scene is determined to be a low-light scene. If the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper gain limit, the current lighting scene is determined to be a normal lighting scene, including: If the image brightness value of the RGB face image to be identified is less than or equal to the first brightness threshold and the image gain value is greater than the first gain upper limit, the current lighting scene is determined to be a dark lighting scene; if the image brightness value of the RGB face image to be identified is less than or equal to the first brightness threshold and the image gain value is less than or equal to the first gain upper limit, the current lighting scene is determined to be a normal lighting scene. If the image brightness value of the near-infrared face image to be identified is less than or equal to the second brightness threshold and the image gain value is greater than the second gain upper limit, the current lighting scene is determined to be a dark light scene. If the image brightness value of the near-infrared face image to be identified is less than or equal to the second brightness threshold and the image gain value is less than or equal to the second gain upper limit, the current lighting scene is determined to be a normal light scene.
4. The method according to claim 1, characterized in that, For the low-light scene, reducing the image gain value includes: The parameters of the image sensor are adjusted based on the image gain value to reduce the image gain value, wherein the parameters of the image sensor include: gain value.
5. The method according to claim 1, characterized in that, The method further includes: If the face image to be identified satisfies at least one of the first preset condition and the second preset condition, the face image to be identified is determined as a sample image, wherein the first preset condition indicates that the image brightness value of the face image to be identified is not within the preset brightness range, and the second preset condition indicates that the image gain value of the face image to be identified is not within the preset gain value range. A first image recognition model is obtained by training a model using multiple sample images that only satisfy the first preset condition; A second image recognition model is obtained by training a model using multiple sample images that simultaneously satisfy the first preset condition and the second preset condition.
6. The method according to claim 1, characterized in that, The face image to be identified is either an RGB face image or a near-infrared face image. The image sensor for acquiring the RGB face image is a color camera, and the image sensor for acquiring the near-infrared face image is an infrared camera. The method further includes: If the image brightness value of the RGB face image to be identified is less than the first brightness lower limit, the white light fill light is turned on to fill the light. If the image brightness value of the near-infrared face image to be identified is less than the second lower limit value, the infrared fill light is turned on to provide supplementary illumination.
7. A face recognition device that adapts to different scenarios, characterized in that, include: The acquisition unit is used to acquire a face image to be identified, and to acquire the image brightness value and image gain value of the face image to be identified; The first determining unit is configured to determine that the current lighting scene is a backlighting scene when the image brightness value of the face image to be identified is greater than a brightness threshold. The second determining unit is configured to determine that the current lighting scene is a dark light scene when the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is greater than the upper limit of gain; and to determine that the current lighting scene is a normal light scene when the image brightness value of the face image to be identified is less than or equal to the brightness threshold and the image gain value is less than or equal to the upper limit of gain, wherein the larger the image gain value, the more image noise there is. The compensation unit is used to adaptively compensate the image brightness value and image gain value of the face image to be recognized under the backlight scene, the low light scene, and the normal light scene, respectively, so that the compensated image brightness value is within a preset brightness range and the compensated image gain value is within a preset gain value range, and then perform face recognition on the compensated face image to be recognized. The compensation unit includes a first compensation module, a second compensation module, and a third compensation module, comprising: The first compensation module is used to reduce the image brightness value for the backlight scene so that the compensated image brightness value is within the preset brightness range, and set the image gain compensation value to zero so that the compensated image gain value is within the preset gain value range. For the low-light scene, the second compensation module increases the image brightness value while decreasing the image gain value, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range. The third compensation module configures the image brightness compensation value to be zero and the image gain compensation value to be zero for the normal lighting scene, so that the compensated image brightness value is within the preset brightness range and the compensated image gain value is within the preset gain value range.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the adaptive scene face recognition method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a face recognition method for performing an adaptive scene as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Infrared image face exposure method and device, equipment and storage medium
CN112819722A
Camera automatic exposure compensation method and device and electronic equipment
CN112866581A