{'fraction_non_alphanumeric': 0.03359883329593897, 'fraction_numerical': 0.012452322189813776, 'mean_word_length': 4.97887323943662, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Automatic Facial Skin Feature Detection for Everyone

Automatic assessment and understanding of facial skin condition have several applications, including the early detection of underlying health problems, lifestyle and dietary treatment, skin-care product recommendation, etc. Selfies in the wild serve as an excellent data resource to democratize skin quality assessment, but suffer from several data collection challenges.The key to guaranteeing an accurate assessment is accurate detection of different skin features. We present an automatic facial skin feature detection method that works across a variety of skin tones and age groups for selfies in the wild. To be specific, we annotate the locations of acne, pigmentation, and wrinkle for selfie images with different skin tone colors, severity levels, and lighting conditions. The annotation is conducted in a two-phase scheme with the help of a dermatologist to train volunteers for annotation. We employ Unet++ as the network architecture for feature detection. This work shows that the two-phase annotation scheme can robustly detect the accurate locations of acne, pigmentation, and wrinkle for selfie images with different ethnicities, skin tone colors, severity levels, age groups, and lighting conditions.


Introduction
Understanding facial skin quality is beneficial to beauty and health. For mild to moderate cases, a trip to a dermatologist may not be worth the time and cost. Yet, when presented with the huge variety of off-the-shelf skin products, a consumer may be unsure of which is best for her needs. An automatic facial skin quality assessment system not only saves time and money, but also helps protect privacy. Successfully detecting different facial skin features is the key to guaranteeing a comprehensive and accurate assessment of skin quality. However, existing solutions either fail to identify problematic regions and only output overall grading (e.g., learning-based methods [5,14], commercial Apps [19] or products [20]) or are sensitive to unexpected factors such as lighting conditions and skin tone colors (e.g., traditional methods [1][2][3][4]22]). Besides, all existing solutions (e.g., [6]) deal with images captured in controlled environments, which limits its practicability in various scenarios for casual users. In contrast, this paper relaxes the constraint of controlled environments and targets on selfie images captured in the wild. Besides, this paper highlights the problematic regions for a deep understanding of facial skin quality for skin features of acne, pigmentation, and wrinkles, with the input of a single selfie image.
We regard the skin feature detection problem as a dense prediction problem [15], i.e., it produces a binary mask that pixelwisely indicates the locations of acne, pigmentation, or wrinkle. There are many similar dense prediction problems in computer vision, such as semantic segmentation [16], image enhance-ment [17], intrinsic image decomposition [18], etc. Different from these problems that exploit priors of significant color differences or/and the analytic image formation models, the color difference between regions of normal skin and interested skin are minor and the existing analytic image formation models cannot be directly used for the problem of skin feature detection. From the view of image signal processing, the challenges of this problem are brought by the unexpected lighting conditions of selfies images and various skin tone colors.
To address the above challenges, the basic idea of this paper is to leverage the data-driven approach and learn priors from training data. That is, by observing the locations of acne, pigmentation, and wrinkle for large-scale selfie images in the wild (with different lighting conditions and skin tone colors), our model is expected to learn robust features for the detection task. Therefore, the key is to obtain training data with reliable annotation. We observe that it is hard to obtain accurate annotation of acne and pigmentation with one-phase manual annotation due to the impact of image quality and lighting. We also observe that the distribution of annotated wrinkle location is long-tailed [21], e.g., there are few wrinkles in regions of the forehead or crow's feet while they frequently appear in regions of under-eye and cheeks. To improve the annotation accuracy for acne and pigmentation, and obtain wrinkle data with balanced distribution, we adopt a two-phase scheme to annotate training data with the help of a dermatologist. To be specific, a coarse annotation of the locations of acne, pigmentation, and wrinkle is first conducted on 3,755 face images. All these images are elaborately prepared for the needed diversity, with different skin tone colors, levels of severity, and conditions of lighting. With these images, we train the preliminary skin feature detection models. In the second phase, we conduct a fine-grained annotation based on the model-generated results of acne and pigmentation and get 1,994 refined annotations. We also annotate the wrinkle of 995 elder faces as the additional training data. These data are used to improve the models of acne, pigmentation, and wrinkle. To summarize, the contributions of this work are as follows: • We propose the first deep learning based skin feature detection approach for a single selfie image in the wild. We show that the proposed method achieves a superior performance advantage as compared with conventional methods. • We propose a two-phase scheme annotation method for large-scale selfie images in the wild. We show this scheme can produce reliable annotations to train deep learning based skin feature detection models.

Related Work
As there are only a few works that address three skin features, i.e., acne, pigmentation, and wrinkle, simultaneously. We briefly review the advances for these three skin features, respectively. Acne. The substantial advances of single image-based solutions for acne lesion analysis have been made for different tasks , including the grading of severity [5,7,10], sub-type classification [9,12], smoothness detection [8], and acne detection. Existing solutions of acne detection are traditional methods, which employ the techniques of image signal processing for the task of acne detection, such as discrete wavelet [1], color clustering [2], and color space conversion [3,13]. These methods are sensitive to environment changes and face textures. Pigmentation. As one of the dominant features for pigmentation analysis is color, researchers introduce appearance/biophysical models to measure the distributions of melanin and hemoglobin. The appearance models consider characteristics of wavelengthdependent scattering and absorption [23], principle chromatic component [24], and multi-layered structure [25]. The biophysical models consider hyper-spectral responses of human skin to realistically render skin images by taking into account light diffusion scattering between different layers [26], the amount of oil, melanin, and hemoglobin in skin [27], the distributions of melanin and hemoglobin for different facial expressions [28], concentrations of chromophores [29], and hyper-spectral surface and subsurface scattering effects of skin appearance [30]. These methods fail to take the impact of lighting colors into account, which may produce inaccurate results. Wrinkle. Existing solutions of wrinkle detection are traditional methods. These methods can be categorized into texturebased [31,32], filter-based [33,34,37], and shape modelbased [35,36,38] methods. Texture-based methods might fail for temporary wrinkles with nonlinear and blurry shapes. Filterbased approaches are sensitive to lighting changing because shadow can weaken the edge information. Shape model-based methods need lots of computation to fit the face landmarks.
Existing skin feature detection methods are traditional methods. They are sensitive to lighting changes, face textures, and skin tone colors. In this paper, we propose the first deep learning based skin feature detection method that deals with the input of a single selfie image in the wild with different lighting conditions and skin tone colors, for skin features of acne, pigmentation, and wrinkle.

Methodology
To train and test our skin feature detection models, we collect selfie images from consumers. All these data are captured at home by casual users. Therefore, the lighting conditions are uncontrolled. We manually exclude images with poor quality (e.g., images with missing patches, extreme poses, very dark environment, low resolution, severely blurry) and get 3,755 images. All these images are from females and with ethnicities of Asian, African, Caucasian, Indian, and Hispanic.

Manual Annotation
To mitigate the impact from the environment, we mask out the background based on Dlib [39], an open-source library that can detect the facial profile. Our dermatologist then trains 4 volunteers to perform data annotation. The volunteers learn to dis-criminate acne, pigmentation, and wrinkle under different lighting conditions for faces with different skin colors. All volunteers are in the age group of 18-25 and are required to pass color-blind testing 1 before the annotation. The annotation result is represented as a mask image. We annotate the masks of acne and pigmentation together due to that they are unlikely to appear at the same location. Finally, 3,755 images are annotated to train our models. Figure 1 shows some examples of the annotation results.

Two-Phase Scheme Annotation
We find that annotations of acne and pigmentation from different volunteers can hardly achieve agreement due to the impact of image quality and lighting. Therefore, we regard the first-phase annotations of acne and pigmentation as the coarse annotation and conduct the second-phase annotation for annotation refinement. We then train two preliminary models for acne and pigmentation, respectively, using coarse annotated data as the training data. The method is introduced in the next section. We then conduct annotation refinement on these machine-generated data. The refinement is based on the machine-generated data instead of the those in the first phase for two reasons: 1) overall annotations are reliable so that the machine-generated results are accurate, i.e., the accuracy of the machine-generated annotations are comparable or even better than the manually annotated ones, 2) machine-generated annotations are more consistent than manual ones. 1,994 annotations are refined in the second phase in total. We then use these data to train our networks and get improved models of acne and pigmentation detection, respectively. The number of images for each ethnicity is displayed in Figure 2. The method used is introduced in the next section. We also train a wrinkle detection model based on the training data annotated in the first phase. However, we find the wrinkles on  the crow's feet and forehead cannot be successfully detected due to the long-tailed distribution of our training data. Figure 3 shows the distribution of the wrinkles in this training data. Therefore, we additionally annotate 1,000 more selfies images from elder faces in the second phase. Finally, we use data from both phases, 3,200 images in total, to train the wrinkle detection model.
The overview of our two-phase scheme annotation can be found in Figure 4.

Data-Driven Method
With the annotated data, the skin feature detection problem can be regarded as predicting the binary mask from the input of a selfie image. Inspired by the great success of UNet++ for the problem of medical image segmentation [40], we adopt the network architecture of UNet++ as the backbone to train our models. As compared with other backbones, Unet++ not only alleviates the unknown network depth but also aggregates features of varying semantic scales. Deep supervision and attention [40] are also integrated into our method.
We train three models for three skin features of acne, pigmentation, and wrinkle, respectively. To train the preliminary models, we use 3,500 out of 3,755 images for training. For the remaining 255 images, we carefully select 90 of them, with different lighting conditions, severity, and skin tone colors as the testing set. The loss function is to measure the similarity between the predicted annotationM and the ground truth M, which is implemented by an L1 loss, The network architecture is based on that in [40]. All selfies images are cropped and resized to the size of 384 × 384. The batch sizes are set to 16. All three models are trained using Adam solver with β 1 = 0.9 and β 2 = 0.999. We set the initial learning rates as 0.001.

Performance
As there is seldom a study of using learning-based methods to solve the problem of skin feature detection, we compare performance with that from traditional methods. To be specific, we compare the acne detection method from [3], the pigmentation detection method from [41], and the wrinkle detection method from [42]. We use IoU as the metric for quantitative evaluation. Given the manually annotated/refined mask M and the predicted oneM, the IoU is calculated by where 'and' and 'or' are the logical operators, 'sum' is the summation operation. As shown in Table 1, our method also produce the best IoU as compared with traditional methods. Figure 5 illustrates the visual comparison. As compared with traditional methods, results from our method are much more accurate as the performance of traditional methods are significantly impacted by unexpected patterns, lighting conditions, and skin tone colors. Note that the numbers are not high because these features are sparsely distributed.
We also compare detection results produced by our preliminary and improved models. As can be found from Table 1 and Figure 5, the models trained by data annotated in the second phase produce much more accurate predictions.

Perception Study
To further investigate the performance of our method, we conduct a perception study on people in the street. Following the advice from domain experts, we align the gender and ethnicity of the respondents and those of the testing images. That is, both respondents and testing faces are Asian females. We ask the respondents to provide their age and skin tone based on a scale between ST1 (lightest) and ST15(darkest). The information of respondents can be found in Figure 6.
We used 20 images for each skin condition in this study. The numbers of images for different severity of skin conditions are balanced, i.e., 7 for mild, 7 for moderate, and 6 for severe. All respondents are briefed on the basic knowledge of the types and severity of skin conditions. The respondents are required to score the accuracy of our method's prediction results for each testing sample. Two questions are asked for each image, i.e., "What do you think of the overall detection result?", "Are there any incorrectly detected acne?", to evaluate the algorithm performance in terms of false-negative error and false-positive error, respectively. There are three optional scores for each question, i.e., bad, good, very good for the first question, and none, a few, many for the  second question. We also ask the respondents to grade the overall accuracy of our method for all images for each skin condition in a third question. Figure 7, the responses on acne detection were 37% very good, 52% good and 11% bad. The responses on incorrectly detected acne were 58% none, 39% a few, and 3% many. Overall, respondents felt that the acne algorithm performed well (77% good, 10% very good, and 13% fair) with few images have missing detections or false positives. The respondents provided some additional comments regarding the acne detection results. Some felt that the detection for acne should be more precise. Some felt that acne was detected as pigmentation. Others felt that skin tone colour might affect the outcome of detection and image resolution can be improved to get a better result.

Acne. As shown in
Pigmentation. As shown in Figure 8, the responses for pigmentation detection were 47% very good, 50% good, and 3% bad. The responses on incorrectly detected pigmentation are 71% none, 28% a few, and 1% many. Overall, respondents felt that the pigmentation algorithm performed well (73% very good and 27% good) with a few images have missing detections or false positives. In comparison between the pigmentation's false-negative and pigmentation's false-positive results, the perception results are better than for acne. The respondents provided some additional comments regarding the pigmentation detection results. Some felt that acne or moles was detected as pigmentation. These were not so obvious due to the image resolution and quality.
Wrinkles. As shown in Figure 9, the responses for wrinkle detection were 36% very good, 58% good, and 6% bad. The responses on incorrectly detected wrinkles are 72% none, 26% a few, and 2% many. Overall, respondents feel that the wrinkle algorithm performs well (67% good, 20% very good, and 13% fair) with a few images have missing detection or false positives. The respondents added additional comments regarding the wrinkle detection results. Some felt that line-like features (e.g., hair, eyebrow, scars)   seemed to be detected as wrinkles.

Conclusion
In this paper, we propose a deep learning based approach for the task of skin feature detection. We focus on skin conditions of acne, pigmentation, and wrinkle. To train our method, we collect and annotate a large-scale training dataset. To achieve accurate detection, we conduct two-phase annotation to take advantage of machine learning for better annotation. Our method produces promising results for the detection of acne, pigmentation, and wrinkle for a single selfie face in the wild.