Skin color recognition method and device, equipment and medium
By identifying the light compensation area in the image and converting it to a multi-color space, combining the attention network and support vector machine model, the problem of skin color recognition being sensitive to light changes is solved, and the accuracy and accuracy of skin color recognition are improved.
Patent Information
- Application Number
- CN202510546758.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-12
Smart Images

Figure CN120472513A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a skin color recognition method, device, equipment, and medium. Background Art
[0002] Facial skin color recognition has important applications in computer vision and image processing, such as face recognition, image beautification, video surveillance, etc. Therefore, the accuracy of skin color recognition has attracted more and more attention.
[0003] In related art, when performing skin color recognition, the image is converted into the HSV color space, skin color and non-skin color areas are distinguished based on the hue and saturation in the HSV space, and skin color recognition is performed on the skin color areas.
[0004] However, the above-mentioned method of recognizing skin color based on color space conversion is very sensitive to changes in lighting and may cause skin color recognition errors under different ambient lighting conditions, resulting in low accuracy of skin color recognition. Summary of the Invention
[0005] Based on this, it is necessary to provide a skin color recognition method, device, equipment and medium that can improve the accuracy of skin color recognition in order to address the above technical problems.
[0006] An embodiment of the present disclosure provides a skin color recognition method, which includes: identifying an illumination compensation area in a first image; calculating the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel; replacing the pixel value of each pixel in the illumination compensation area in the first image with the corresponding compensated pixel value to obtain a second image; converting the second image from a first color space to a second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space; and identifying skin color information in the first image based on all the color image features of all color channels in the first color space and the second color space.
[0007] In one embodiment, the preset calculation formula includes:
[0008]
[0009] Wherein, I' is the compensation pixel value, μ L is the illumination mean of the first image, σ L is the brightness standard deviation of the first image, μ T is the illumination mean of the first image under the preset target illumination, σ T is the brightness standard deviation of the first image under the preset target illumination.
[0010] In one embodiment, the first color space is an RGB color space, and the second color space is a YCbCr color space.
[0011] In one embodiment, the identifying of skin color information in the first image based on all the color image features of all color channels in the first color space and the second color space includes: fusing all the color image features to obtain a fused color image feature; inputting the fused color image feature into a pre-trained attention network to obtain an attention feature map output by the attention network; and inputting the attention feature map into a pre-trained support vector machine model to obtain the skin color information output by the support vector machine model.
[0012] In one embodiment, the attention network includes a pooling layer, a first fully connected layer, a second fully connected layer and an output layer, wherein the pooling layer is used to extract the color description features of each color channel in the fused color image feature, the first fully connected layer is used to reduce the dimension of the color description features of the first feature dimension output by the pooling layer to the second feature dimension, the second fully connected layer is used to upgrade the color description features of the second feature dimension output by the first fully connected layer to the first feature dimension, and calculate the weight coefficients of each color channel according to the color description features upgraded to the first feature dimension through an activation function, and the output layer is used to multiply the weight coefficient of each color channel with the color description features of the corresponding color channel in the fused color image feature to obtain the attention feature map.
[0013] In one embodiment, identifying the illumination compensation area in the first image includes: identifying whether the pixel value of each pixel point in the first image is greater than a preset pixel threshold; and determining that the area composed of pixel points whose pixel values are not greater than the preset pixel threshold is the illumination compensation area.
[0014] In one embodiment, identifying the illumination compensation area in the first image includes: inputting the first image into a pre-trained convolutional neural network; and obtaining the illumination compensation area output by the convolutional neural network.
[0015] An embodiment of the present disclosure provides a skin color recognition device, which includes: a compensation area recognition module for identifying an illumination compensation area in a first image; a calculation processing module for calculating the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain the compensated pixel value of each pixel; a compensation processing module for replacing the pixel value of each pixel in the illumination compensation area in the first image with the corresponding compensated pixel value to obtain a second image; a multi-channel color feature acquisition module for converting the second image from a first color space to a second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space; and a skin color recognition module for identifying skin color information in the first image based on all the color image features of all color channels in the first color space and the second color space.
[0016] An embodiment of the present disclosure provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the skin color recognition method provided by any embodiment of the present disclosure are implemented.
[0017] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the skin color recognition method provided by any embodiment of the present disclosure are implemented.
[0018] The skin color recognition method, apparatus, device, and medium provided in the embodiments of the present disclosure identify an illumination compensation area in a first image, calculate the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value for each pixel, and then replace the pixel value of each pixel in the illumination compensation area in the first image with the corresponding compensated pixel value to obtain a second image. The second image is converted from a first color space to a second color space, and the color image features of each color channel of the second image in the first color space and the second color space are extracted. Based on all color image features of all color channels in the first color space and the second color space, skin color information in the first image is identified. In this technical solution, illumination compensation and color image features of multiple color spaces and multiple color channels are combined to identify skin color information, thereby improving the accuracy of skin color information identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a diagram of an application scenario of a skin color recognition method in one embodiment;
[0020] Figure 2 is a flowchart of a skin color recognition method according to another embodiment;
[0021] Figure 3Schematic diagram of the structure of an attention network in one embodiment;
[0022] Figure 4 is a structural block diagram of a skin color recognition device in one embodiment;
[0023] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not intended to limit the present disclosure.
[0025] In one embodiment, Figure 1 As shown, a skin color recognition method is provided. This embodiment primarily illustrates the application of this method to a terminal device. The terminal device disclosed herein may include, but is not limited to, a mobile phone, a tablet computer, and the like. In the skin color recognition method applied to a terminal device, the terminal device may be configured with a high-resolution camera that captures images via an image acquisition module. Skin color recognition is performed on the captured image using the method of this embodiment, and the recognized skin color result can then be applied to the corresponding application scenario.
[0026] like Figure 1 As shown, the skin color recognition method includes:
[0027] Step 101: Identify an illumination compensation area in a first image.
[0028] The first image may be an image of the skin color to be recognized. The method of obtaining the first image is related to the application scenario of skin color recognition. For example, when the application scenario of skin color recognition is skin color recognition in video surveillance, the first image is a video frame extracted from a video stream captured by a surveillance camera.
[0029] In one embodiment of the present disclosure, considering that illumination change is an important factor affecting skin color recognition performance, in this embodiment, brightness compensation processing is first performed on the illumination to eliminate the interference of illumination on the skin color recognition result.
[0030] In this embodiment, an illumination compensation area is identified in the first image. The illumination compensation area can be understood as a darker area, such as a shadow area. The skin color in the illumination compensation area is affected by the lower brightness, which may result in low skin color recognition accuracy. Therefore, it is necessary to further perform brightness compensation on the illumination compensation area.
[0031] The method of identifying the illumination compensation area in the first image varies in different application scenarios, as shown in the following examples:
[0032] In some possible examples, a preset pixel threshold is set in advance, wherein the preset pixel threshold can be set according to the scene requirements. For example, the current ambient light intensity can be obtained and the preset pixel threshold can be determined according to the ambient light intensity, wherein the ambient light intensity and the preset pixel threshold are in direct proportion.
[0033] In this example, it is identified whether the pixel value of each pixel point in the first image is greater than a preset pixel threshold, and the area consisting of pixel points whose pixel values are not greater than the preset pixel threshold is determined as the illumination compensation area.
[0034] In some possible examples, a convolutional neural network is pre-selected for training, wherein the convolutional neural network pre-learns to obtain a lighting compensation area based on the input first image recognition, and the convolutional neural network includes but is not limited to convolutional neural networks (CNN) and the like.
[0035] In this example, the first image is input into a pre-trained convolutional neural network to obtain the illumination compensation area output by the convolutional neural network. In this example, the illumination compensation area is determined without relying on a preset pixel threshold. Instead, the illumination compensation area is adaptively determined by relying on the convolutional neural network, which reduces the sensitivity to illumination changes and improves the accuracy of determining the illumination compensation area.
[0036] Step 102 : Calculate the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel.
[0037] Step 103 : Replace the pixel value of each pixel in the illumination compensation area of the first image with the corresponding compensation pixel value to obtain a second image.
[0038] In an embodiment of the present disclosure, after determining the illumination compensation area, the pixel value of each pixel in the illumination compensation area is calculated according to a preset calculation formula to obtain the compensated pixel value of each pixel, and the pixel value of each pixel in the illumination compensation area in the first image is replaced with the corresponding compensated pixel value to obtain a second image. Thus, the illumination compensation area in the second image is brightness compensated, and when skin color recognition is subsequently performed based on the second image, it is less disturbed by light, thereby improving the accuracy of skin color recognition, reducing the skin color deviation caused by illumination changes in the first image, and improving the accuracy of subsequent skin color area recognition.
[0039] In some possible embodiments, the preset calculation formula is the following formula (1):
[0040]
[0041] Where, in formula (1), I' is the compensation pixel value, μ L is the illumination mean of the first image, σ L is the brightness standard deviation of the first image, μ T is the illumination mean of the first image under the preset target illumination, σ T The target illumination is obtained by calculating the brightness standard deviation of the first image under a preset target illumination. The target illumination can be ambient illumination, or by calculating a first brightness mean of the illumination compensation area, a second brightness mean of the non-illumination compensation area, a brightness difference between the second brightness mean and the first brightness mean, multiplying the brightness difference by a preset coefficient (the preset coefficient is less than 1), and calculating the difference between the ambient illumination and the product. The brightness standard deviation and the illumination mean of the first image corresponding to the target illumination can be obtained through self-defense calculation or through a preset deep learning network. The target illumination can be understood as the illumination achievable in the desired illumination compensation area.
[0042] In other possible embodiments, the calculation method corresponding to the preset calculation formula can also be: calculating the first brightness mean of the illumination compensation area, calculating the second brightness mean of the non-illumination compensation area, calculating the brightness difference between the second brightness mean and the first brightness mean, calculating the product value of the brightness difference and a preset coefficient (the preset coefficient is less than 1), and calculating the sum of the pixel value and the product value of each pixel point in the illumination compensation area to obtain the corresponding compensation pixel value.
[0043] Step 104 : converting the second image from the first color space to the second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space.
[0044] Since skin color has different distribution characteristics in different color spaces, for example, in the YCbCr color space, skin color pixels are generally concentrated in a certain area. Therefore, in order to enrich the acquired skin color features, in one embodiment of the present disclosure, the second image is converted from the first color space to the second color space, and the color image features of each color channel of the second image in the first color space and the second color space are extracted. That is, in this embodiment, the color image features of each color channel of the second image in the first color space are extracted, and the color image features of each color channel of the second color space are extracted.
[0045] The second color space may be any color space different from the first color space. In some possible embodiments, the first color space is an RGB color space and the second color space is a YCbCr color space. The color space conversion may be performed using the color conversion formulas shown in formulas (2)-(4).
[0046] Y=0.299R+0.587G+0.114B Formula (2)
[0047] C b =128-0.1687R-0.3313G+0.5B Formula (3)
[0048] C r =128+0.511R-0.4187G-0.0813B Formula (4)
[0049] Step 105 : Identify skin color information in the first image based on all color image features of all color channels in the first color space and the second color space.
[0050] In an embodiment of the present disclosure, skin color information in the first image is identified based on all color image features of all color channels in the first color space and the second color space, wherein the skin color information includes skin color categories, and the skin color categories may include any categories such as black, yellow, white, etc.
[0051] In this embodiment, the color image features of multiple color channels are combined to identify skin color information, thereby improving the accuracy of the skin color information.
[0052] In summary, the skin color recognition method of the disclosed embodiment identifies an illumination compensation area in a first image, calculates the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value for each pixel, then replaces the pixel value of each pixel in the illumination compensation area in the first image with the corresponding compensated pixel value to obtain a second image, converts the second image from the first color space to the second color space, and extracts color image features for each color channel of the second image in the first color space and the second color space. Based on all color image features of all color channels in the first color space and the second color space, skin color information in the first image is identified. In this technical solution, illumination compensation and color image features of multiple color spaces and multiple color channels are combined to identify skin color information, thereby improving the accuracy of skin color information recognition.
[0053] Based on the above embodiment, in different application scenarios, different methods are used to identify skin color information in the first image based on all color image features of all color channels in the first color space and the second color space. Examples are as follows:
[0054] In one embodiment of the present disclosure, Figure 2 As shown, identifying skin color information in the first image based on all the color image features of all color channels in the first color space and the second color space includes:
[0055] Step 201: fuse all color image features to obtain a fused color image feature.
[0056] In some possible embodiments, all color image features may be concatenated to obtain a fused color image feature;
[0057] In some possible embodiments, all color image features may be input into a pre-trained deep learning network to obtain fused color image features output by the deep learning network.
[0058] In step 202, the fused color image features are input into a pre-trained attention network to obtain an attention feature map output by the attention network.
[0059] The attention network is pre-learned to focus on key skin color areas for feature extraction, where the key skin color areas include but are not limited to face areas, hand areas, etc.
[0060] In this embodiment, the fused color image features are input into a pre-trained attention network to obtain an attention feature map output by the attention network.
[0061] Among them, in some possible embodiments, such as Figure 3 As shown, the attention network includes a pooling layer, a first fully connected layer, a second fully connected layer and an output layer. The pooling layer is used to extract the color description features of each color channel in the fused color image feature. The first fully connected layer is used to reduce the dimension of the color description features of the first feature dimension output by the pooling layer to the second feature dimension. The second fully connected layer is used to upgrade the color description features of the second feature dimension output by the first fully connected layer to the first feature dimension, and calculate the weight coefficient f of each color channel according to the color description features upgraded to the first feature dimension through the activation function. In this embodiment, the correlation between different color channels can be better fitted after processing by two fully connected layers, reducing the amount of calculation of the model. The output layer is used to multiply the weight coefficient of each color channel with the color description features of the corresponding color channel in the fused color image feature to obtain the attention feature map. For example, when the input fused color image feature is F, you can as an attention feature map.
[0062] Step 203: Input the attention feature map into a pre-trained support vector machine model to obtain skin color information output by the support vector machine model.
[0063] Among them, the support vector machine model (SVM) is one of the most influential machine learning algorithms in supervised learning. In this example, SVM is used for skin color recognition and classification. The support vector machine model pre-learns to output skin color information based on the input attention feature map. The SVM algorithm performs recognition and classification based on the input attention feature map to obtain the corresponding skin color information. The SVM algorithm only needs to introduce a small number of samples for training, and does not require a large amount of sample data, which reduces the consumption of computing resources for skin color recognition.
[0064] In one embodiment of the present disclosure, all color image features are fused to obtain fused color image features, and the fused color image features are input into a pre-trained neural network model. The neural network model is pre-trained to obtain skin color information based on the input fused color image features, thereby obtaining the skin color information output by the neural network model.
[0065] In summary, the skin color recognition method of the embodiment of the present disclosure integrates the characteristics of multiple color spaces, can capture skin color information more comprehensively, and based on the attention mechanism, can automatically focus on key skin color areas to improve skin color recognition accuracy.
[0066] It should be understood that although Figure 1-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0067] In one embodiment, Figure 4 As shown, a skin color recognition device is provided, including: a compensation area recognition module 410, a calculation processing module 420, a compensation processing module 430, a multi-channel color feature acquisition module 440, and a skin color recognition module 450, wherein:
[0068] The compensation region identification module 410 is configured to identify an illumination compensation region in the first image;
[0069] The calculation processing module 420 is used to calculate the pixel value of each pixel point in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel point;
[0070] The compensation processing module 430 is configured to replace the pixel value of each pixel in the illumination compensation area of the first image with the corresponding compensation pixel value to obtain a second image;
[0071] a multi-channel color feature acquisition module 440 for converting the second image from the first color space to the second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space;
[0072] The skin color recognition module 450 is configured to recognize skin color information in the first image based on all color image features of all color channels in the first color space and the second color space.
[0073] In one embodiment of the present disclosure, the preset calculation formula includes:
[0074]
[0075] Where I' is the compensation pixel value, μ L is the illumination mean of the first image, σ L is the brightness standard deviation of the first image, μ T is the illumination mean of the first image under the preset target illumination, σ T is the brightness standard deviation of the first image under the preset target illumination.
[0076] In one embodiment of the present disclosure, the first color space is an RGB color space, and the second color space is a YCbCr color space.
[0077] In one embodiment of the present disclosure, the skin color recognition module 450 is configured to:
[0078] Fusing all color image features to obtain fused color image features;
[0079] Input the fused color image features into the pre-trained attention network to obtain the attention feature map output by the attention network;
[0080] The attention feature map is input into the pre-trained support vector machine model to obtain the skin color information output by the support vector machine model.
[0081] In one embodiment of the present disclosure, the attention network includes a pooling layer, a first fully connected layer, a second fully connected layer, and an output layer, wherein:
[0082] The pooling layer is used to extract the color description features of each color channel in the fused color image features. The first fully connected layer is used to reduce the color description features of the first feature dimension output by the pooling layer to the second feature dimension.
[0083] The second fully connected layer is used to upgrade the color description features of the second feature dimension output by the first fully connected layer to the first feature dimension, and calculate the weight coefficient of each color channel according to the color description features upgraded to the first feature dimension through the activation function.
[0084] The output layer is used to multiply the weight coefficient of each color channel with the color description feature of the corresponding color channel in the fused color image feature to obtain the attention feature map.
[0085] In one embodiment of the present disclosure, the compensation region identification module 410 is configured to:
[0086] Identify whether a pixel value of each pixel in the first image is greater than a preset pixel threshold;
[0087] Determine that an area consisting of pixels whose pixel values are not greater than a preset pixel threshold is an illumination compensation area.
[0088] In one embodiment of the present disclosure, the compensation region identification module 410 is configured to:
[0089] Inputting the first image into a pre-trained convolutional neural network;
[0090] Get the illumination compensation region output by the convolutional neural network.
[0091] The specific definition of the skin color recognition device can be found in the definition of the skin color recognition method above and will not be repeated here. Each module in the aforementioned skin color recognition device may be implemented in whole or in part via software, hardware, or a combination thereof. Each of these modules may be embedded in or independent of a processor within a computer device in hardware form, or may be stored in a computer device memory in software form, allowing the processor to call and execute the corresponding operations of each module.
[0092] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as preset calculation formulas. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a skin color recognition method.
[0093] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a skin color recognition method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.
[0094] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present disclosure, and does not constitute a limitation on the computer device to which the solution of the present disclosure is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0095] In one embodiment, the skin color recognition device provided by the present disclosure can be implemented in the form of a computer program. Figure 5 The computer device can be operated on the computer device shown. The memory of the computer device can store various program modules that constitute the skin color recognition device, such as, Figure 4 The computer program composed of the various program modules enables the processor to execute the steps of the skin color recognition method of each embodiment of the present disclosure described in this specification.
[0096] For example, Figure 5 The computer device shown can be Figure 4The compensation area identification module in the skin color recognition device shown identifies the illumination compensation area in the first image. The computer device can calculate the pixel value of each pixel in the illumination compensation area according to a preset calculation formula through the calculation processing module to obtain the compensated pixel value of each pixel. The computer device can replace the pixel value of each pixel in the illumination compensation area in the first image with the corresponding compensated pixel value through the compensation processing module to obtain a second image. The computer device can convert the second image from the first color space to the second color space through the multi-channel color feature acquisition module, and extract the color image features of each color channel of the second image in the first color space and the second color space. The computer device can identify the skin color information in the first image based on all color image features of all color channels in the first color space and the second color space through the skin color recognition module.
[0097] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0098] identifying an illumination compensation region in the first image;
[0099] Calculate the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel;
[0100] Replacing the pixel value of each pixel in the illumination compensation area of the first image with the corresponding compensation pixel value to obtain a second image;
[0101] Converting the second image from the first color space to the second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space;
[0102] Skin color information in the first image is identified based on all color image features of all color channels in the first color space and the second color space.
[0103] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0104] Fusing all color image features to obtain fused color image features;
[0105] Input the fused color image features into the pre-trained attention network to obtain the attention feature map output by the attention network;
[0106] The attention feature map is input into the pre-trained support vector machine model to obtain the skin color information output by the support vector machine model.
[0107] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0108] Identify whether a pixel value of each pixel in the first image is greater than a preset pixel threshold;
[0109] Determine that an area consisting of pixels whose pixel values are not greater than a preset pixel threshold is an illumination compensation area.
[0110] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0111] Inputting the first image into a pre-trained convolutional neural network;
[0112] Get the illumination compensation region output by the convolutional neural network.
[0113] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: step A; step B; step C.
[0114] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0115] identifying an illumination compensation region in the first image;
[0116] Calculate the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel;
[0117] Replacing the pixel value of each pixel in the illumination compensation area of the first image with the corresponding compensation pixel value to obtain a second image;
[0118] Converting the second image from the first color space to the second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space;
[0119] Skin color information in the first image is identified based on all color image features of all color channels in the first color space and the second color space.
[0120] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided by the present disclosure may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).
[0121] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0122] The above embodiments merely illustrate several implementations of the present disclosure, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the scope of the present disclosure, all of which fall within the scope of protection of the present disclosure. Therefore, the scope of protection of the patent disclosed herein shall be determined by the appended claims.
Claims
1. A skin color recognition method, characterized in that: The method comprises: identifying an illumination compensation region in the first image; Calculating the pixel value of each pixel in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel; Replacing the pixel value of each pixel point in the illumination compensation area in the first image with the corresponding compensation pixel value to obtain a second image; converting the second image from the first color space to the second color space, and extracting color image features of each color channel of the second image in the first color space and the second color space; Skin color information in the first image is identified based on all the color image features of all color channels in the first color space and the second color space.
2. The method according to claim 1, wherein The preset calculation formula includes: Wherein, I' is the compensation pixel value, μ L is the illumination mean of the first image, σ L is the brightness standard deviation of the first image, μ T is the illumination mean of the first image under the preset target illumination, σ T is the brightness standard deviation of the first image under the preset target illumination.
3. The method according to claim 1, wherein The first color space is an RGB color space, and the second color space is a YCbCr color space.
4. The method according to claim 1, wherein The identifying skin color information in the first image according to all the color image features of all the color channels in the first color space and the second color space includes: fusing all the color image features to obtain a fused color image feature; Inputting the fused color image features into a pre-trained attention network to obtain an attention feature map output by the attention network; The attention feature map is input into a pre-trained support vector machine model to obtain the skin color information output by the support vector machine model.
5. The method according to claim 4, wherein The attention network includes a pooling layer, a first fully connected layer, a second fully connected layer and an output layer, wherein: The pooling layer is used to extract the color description features of each color channel in the fused color image features, and the first fully connected layer is used to reduce the dimension of the color description features of the first feature dimension output by the pooling layer to the second feature dimension. The second fully connected layer is used to upgrade the color description features of the second feature dimension output by the first fully connected layer to the first feature dimension, and calculate the weight coefficients of the respective color channels according to the color description features upgraded to the first feature dimension through an activation function. The output layer is used to multiply the weight coefficient of each color channel by the color description feature of the corresponding color channel in the fused color image feature to obtain the attention feature map.
6. The method according to claim 1, wherein The identifying of the illumination compensation area in the first image includes: Identifying whether a pixel value of each pixel in the first image is greater than a preset pixel threshold; Determine that an area consisting of pixels whose pixel values are not greater than the preset pixel threshold is the illumination compensation area.
7. The method according to claim 1, wherein The identifying of the illumination compensation area in the first image includes: Inputting the first image into a pre-trained convolutional neural network; Obtain the illumination compensation area output by the convolutional neural network.
8. A skin color recognition device, characterized in that: The device comprises: a compensation area recognition module, configured to recognize an illumination compensation area in the first image; A calculation processing module, configured to calculate the pixel value of each pixel point in the illumination compensation area according to a preset calculation formula to obtain a compensated pixel value of each pixel point; a compensation processing module, configured to replace the pixel value of each pixel point in the illumination compensation area in the first image with a corresponding compensation pixel value to obtain a second image; a multi-channel color feature acquisition module, configured to convert the second image from a first color space to a second color space, and extract color image features of each color channel of the second image in the first color space and the second color space; A skin color recognition module is configured to recognize skin color information in the first image based on all the color image features of all color channels in the first color space and the second color space.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.