nudity detection in color images

8 downloads 108933 Views 202KB Size Report
seconds of Fame – An Interactive, Computer-Vision Based. Art Illustration.” In Proc. Of the 7th Int'l Conference on. Control, Automation, Robotics, and Vision, pp.
Int’l Conf. IP, Comp. Vision, and Pattern Recognition | IPCV’08 |

627

Image-Based Pornography Detection Rigan Ap-apid De La Salle University, Manila, Philippines

Abstract - This paper presents an algorithm for detecting pornography or nudity in color images based on a skin color distribution model. The skin color model is based on correlation analyses of RGB and HSV color components. This model is used to identify and locate skin regions in an image. The skin regions are analyzed for clues indicating nudity or non-nudity such as their sizes and relative distances from each other. The Nudity Detection Algorithm is able to detect nudity with a 94.85% recall and a false positive rate of 6.52% on a set of images consisting of 641 nude images and 936 non-nude images.

Pornography is a relative term but in a broad sense, pornography means the deliberate depiction of erotic acts than in general, causes sexual excitement. On the other hand, nudity refers to the showing of body parts that are usually associated to sexuality, which generally evokes intense emotional or sexual response, whether intended or not. In this sense, nude images may be considered pornographic. In this paper, pornography and nudity are used interchangeably.

2 Keywords: Pornography, Nudity, Skin Color Model.

1

Introduction

The field of digital media has been rapidly developing, exposing us to huge amounts of information that are often irrelevant for our own purposes. Thus, retrieval and classification techniques have been and are continuously being developed and improved to facilitate the exchange of relevant information. Correspondingly, there is a clear necessity for user-customized information selection. For many years now, we have been facing problems due to the lack of control and regulation over what information can be made available over the Internet. One such problem is the proliferation of pornography or nudity. As the distribution of all types of multimedia information becomes more widespread than ever, pornography detection is recognized as an important step towards limiting the proliferation of unwanted and damaging information. Thus, new methods for detecting and filtering pornography are continually being sought. This paper describes a system for detecting nudity in color images. Contrary to most detection systems, images are not compared to pre-classified images in a database. This system also differs from other detection systems in that aside from raw RGB values, it uses two other color spaces (HSV and normalized RGB) to aid in the classification of images.

The Skin Color Distribution Model

Color is the most important feature used to determine whether an image contains nudity or not. Every nudity detection system involves a skin filter, which aims to determine which pixels are skin-colored or not using a skin color distribution model. Most skin color distribution models use a single color space (obtained through a transformation of RGB values) to classify pixels as skin-colored or not [1], [2], [3], [4]. This is based on results showing that the choice of color space is not critical provided that enough training and proper falsealarm thresholding is done [5], [6]. However, based on experiments done in this study, the performance of a model can be improved by using two or more other color spaces. Thus, aside from RGB values, the skin color model used in this system uses the Normalized RGB and HSV color spaces. The set of images used for developing the color model in this study consists of manually labeled skin regions representing the general types of skin color – light, brown, and dark. Contrary to some studies, different skin tones do not exhibit the same chromaticity if the luminance component is removed. Thus, the set of images were partitioned into three subsets based on perceived illumination levels. The color properties of each subset are analyzed based on correlation to develop the skin color model. Experimental results suggest that removing the luminance component in the Normalized RGB or HSV spaces does not entirely remove the effect of luminance. The correlations between r (normalized red) and g (normalized green) values and between hue (h) and

Int’l Conf. IP, Comp. Vision, and Pattern Recognition | IPCV’08 |

628

saturation (s) change as the illumination level changes. The correlation values are shown in Table 1. Table 1 Correlation of Skin Color Components Correlation Correlation Between h Skin Type Between r and g and s Light Brown Dark

-0.5854 -0.5045 -0.4264

0.4356 -0.6368 -0.3050

The experiments show that the correlation coefficients are different for light, brown, and dark skin. The correlation coefficients between r and g suggest that the relationship can be modeled by linear regression. Thus, different linear regression equations involving r and g are obtained for light, for brown, and for dark skin. To minimize the effect of high luminance, further processing is needed for light or nearly white pixels. Correlation coefficients for h and s also indicate a linear relationship especially for brown skin. Thus, regression equations are also obtained for h and s. Table 2 shows the regression equations for r and g and for h and s.

The inequalities maintain the linear relationship defined by the regression equations since the same coefficients and hence slopes are used, allowing more skin pixels to be labeled correctly. The skin filter treats skin pixels differently, depending on the luminance values. Skin pixels that are nearly white present some problems because they show properties similar to wood and white surfaces. Thus, to minimize the number of false-negatives, nearly white pixels that have been initially classified as skin are further processed to include nearby pixels that may have been wrongly labeled as non-skin pixels. Experiments show that the skin filter works with 96.29% recall and a 6.76% false positive rate on the training set consisting of 1,182,608 manually labeled skin pixels and 10,471,553 manually labeled non-skin pixels. It works with a 97.23% recall and a 6.98% false positive rate on the test set consisting of 2,303,824 manually labeled skin pixels and 24,285,952 manually labeled non-skin pixels. Table 3 shows the performance of the skin color model compared to other models.

Table 3 Comparison of Skin Color Models

Table 2 Regression Equations for Skin Color Components Regression Equation (r,g)

Skin Type LIGHT

Regression Equation (h,s)

0.3936 = g + 0.1657 * r 0.2507 = s - 0.9165 * h

BROWN 0.4207 = g + 0.2372 * r 0.7142 = s + 2.1879 * h DARK

0.3543 = g + 0.1310 * r 0.5296 = s + 0.3386 * h

A pixel is a candidate for a skin pixel if it satisfies the initial conditions for its RGB component values. It is then checked if it satisfies any of the linear regression inequalities for r and g or for h and s. The coefficients of the variables in the regression equations are used to set up inequalities that must be satisfied for a pixel to be classified as a skin pixel. Inequalities are used to minimize false negatives resulting from a very strict skin filter, which would be the case if equations were used. For example, only a few values of r and g would satisfy

g + 0.1657 * r = 0.39

(1)

compared to

0.36 < g + 0.1657 * r < 0.42

(2)

Correct Detection (%)

False Positives (%)

Peer et al. [7]

10

42.5

Lin et al. [4]

34

7.5

Solina et al. [8]

98

14

97.23 98

6.98 12.46

Skin Filter

The Skin Color Distribution Model in This Study

3

The Nudity Detection Algorithm

The Nudity Detection Algorithm is based primarily on observations that in general, nude images contain large amounts of skin, people have different skin tones, and skin regions in nude images are relatively close to each other. Generally, the Nudity Detection Algorithm consists of detecting skin-colored pixels in the image, locating skin regions based on the detected skin pixels, analyzing the skin regions for clues of nudity or non-nudity, and then classifying the image as nude or not. The first step in the algorithm requires a skin color distribution model, which is the basis for classifying pixels as skin or non-skin. As the image is scanned from the

Int’l Conf. IP, Comp. Vision, and Pattern Recognition | IPCV’08 |

upper left corner of the image across and down to the lower right corner, color component values are obtained for each pixel. These values are then checked to determine if they satisfy the parameters for being skin, set by the skin color distribution model. The percentage of skin pixels relative to the image size is one of the main features that affect the probability of an image being nude or not. The larger the percentage of skin is, the higher the probability that an image will be classified nude.

16. Classify an image as follows: a) If the percentage of skin pixels relative to the image size is less than 15 percent, the image is not nude. Otherwise, go to the next step. b) If the number of skin pixels in the largest skin region is less than 35% of the total skin count, the number of skin pixels in the second largest region is less than 30% of the total skin count and the number of skin pixels in the third largest region is less than 25% of the total skin count, the image is not nude. c) If the number of skin pixels in the largest skin region is less than 45% of the total skin count, the image is not nude. d) If the total skin count is less than 30% of the total number of pixels in the image and the number of skin pixels within the bounding polygon is less than 55 percent of the size of the polygon, the image is not nude. e) If the number of skin regions is more than 60 and the average intensity within the polygon is less than 0.25, the image is not nude. f) Otherwise, the image is nude.

The next step in the algorithm involves the analysis of detected skin pixels in terms of adjacency or continuity to identify or locate skin regions. The number of skin regions, the sizes of the largest skin regions and the relative positions of these skin regions are important features that aid in the classification. Although the percentage of skin is a good indicator of the presence or absence of nudity in an image, it allows too many false positives if used alone. The results show that the performance can be improved by combining skin percentage feature and region properties. In summary, the nudity detection algorithm works in the following manner: 1. 2. 3. 4.

5. 6. 7. 8. 9. 10. 11.

12. 13. 14.

15.

Scan the image starting from the upper left corner to the lower right corner. For each pixel, obtain the RGB component values. Calculate the corresponding Normalized RGB and HSV values from the RGB values. Determine if the pixel color satisfies the parameters for being skin established by the skin color distribution model. Label each pixel as skin or non-skin. Calculate the percentage of skin pixels relative to the size of the image. Identify connected skin pixels to locate skin regions. Count the number of skin regions. Identify pixels belonging to the three largest skin regions. Calculate the percentage of the largest skin region relative to the image size. Identify the leftmost, the uppermost, the rightmost, and the lowermost skin pixels of the three largest skin regions. Use these points as the corner points of a bounding polygon. Calculate the area of the bounding polygon. Count the number of skin pixels within the bounding polygon. Calculate the percentage of the skin pixels within the bounding polygon relative to the area of the polygon. Calculate the average intensity of the pixels inside the bounding polygon.

629

The presence of body parts such as breasts and sexual organs is a characteristic of nude images. The performance of a nudity detection system can be greatly enhanced if these body parts can be detected. However, object detection is difficult for objects that are not isolated. Breasts and sexual organs are connected to the body and so are hands and fingers. Thus, it is not easy to algorithmically distinguish between a hand or finger and a male sexual organ because both exhibit similar properties. Efforts by this researcher to establish a pattern for detecting human breasts and genitalia were unsuccessful. However, it is possible to detect the presence of nipples in some images, especially if the nipple is much darker than the surrounding skin region (breast). In particular, a method developed for nipple detection based on edge detection and textural analysis works with a 70% recall. However, this does not improve the performance of the nudity detection algorithm.

4

Performance of the Algorithm

Separate sets of images were collected for training and testing the nudity detection algorithm developed in this study. The training set consisted of 350 nude images and 500 non-nude images. The testing set consisted of 641 nude images and 936 non-nude images. In this study, images of shirtless females and males are both considered nude. Posterior shots showing human buttocks are also considered nude. In general, images of unclothed children may not be inappropriate but the

Int’l Conf. IP, Comp. Vision, and Pattern Recognition | IPCV’08 |

630

algorithm does not determine whether an image is that of a child or otherwise. Such images are also considered nude. The performance of the Nudity Detection Algorithm on the test images is unexpectedly better than its performance on the training images. On the training set, the algorithm worked with a 93.71% recall and an 8.04% false positive rate. On the testing set, the algorithm correctly identified 608 out of 641 nude images, a 94.85% recall. It wrongly classified 61 out of 936 non-nude images, a false positive rate of 6.52%. False alarms cannot be avoided because some benign images have characteristics that are very similar to that of nude images. Possible reasons for false alarms include the presence of large objects whose colors are very similar to skin such as wood and dry leaves, scantily clad persons, and close-up shots of human faces. The researcher was not able to obtain data sets used by other researchers dealing with nudity detection. The researcher was also unable to obtain detailed algorithms or software implementations of the algorithms. Thus, it is impossible to compare the algorithms directly using the same image set. The reported results can be compared but a meaningful evaluation of the relative performances cannot be done. Table 4 shows a comparison of the Nudity Detection System with other similar systems in terms of the reported results. Table 4 Comparison of Performance with Other Systems Recall (%)

False-Positives (%)

SVM [4]

86

35

WIPE [9]

97.5

18.4

Jones-Rehg [3]

86.7

9

90

15

94.85

6.52

Algorithm/System

PORNsweeper [10] The Nudity Algorithm

Detection

It cannot be concluded that the Nudity Detection Algorithm designed by the researcher is better than other similar systems. However, although relatively simple, it can be said that the algorithm performs reasonably well compared to other similar algorithms.

5

Observations and Recommendations

This study supports the belief that the choice of color space in skin color modeling is not crucial, as shown by several other studies. However, using a single color space may limit the performance of the skin color filter. This study shows that better performance can be achieved by using two or more color spaces. Contrary to some studies, experimental results in this study suggest that chrominance values significantly differ for light and dark skin even if the luminance component is removed through a normalization or transformation of RGB values. Thus, a skin color model should not treat light and dark skin in the same manner. This may be more computationally expensive but it allows for more skin pixels to be labeled correctly. The correlation coefficients for the color values (Normalized RGB and HSV) for different skin color suggest a high linear correlation. Thus, it is possible to model skin color using linear regression analysis and this is confirmed by the results of this study. However, linear regression may not be the best model for skin color. The relationship between the values may not be strictly linear. If this is the case, using curves may be more appropriate than using lines to model the relationship. The researcher believes that the performance of the nudity detection algorithm can be improved by using similarity measures or template matching where images are compared to pre-classified nude images. However, large memory requirements for the use of templates may present undesirable consequences. The appropriateness of the templates used must also be carefully established. The performance may also be improved by using convex bounding polygons and using polygons with more than four sides. The drawback is the effect on execution time. It is computationally more expensive to identify interior points for concave polygons than for convex ones. Increasing the number of sides also has a corresponding increase in execution time. Thus, care must be taken in determining the appropriate threshold for the optimal number of sides of the bounding polygon. The classification of images is based on a set of features, which include skin percentage and several skin region properties. All these features are combined to aid in the classification. However, some features if used alone yield better results than other features. For example, the use of the property which involves the skin count in the largest skin region being less than 60% of the total skin count, yields better recall than the use of the feature involving the average intensity being less than 0.25. Thus, it may be possible to improve performance by putting an

Int’l Conf. IP, Comp. Vision, and Pattern Recognition | IPCV’08 |

appropriate weight on each feature’s effect on the overall performance. The evaluation of performance of the algorithm would have been more meaningful if the comparison with other similar systems was done using a single image set. However, it is difficult to obtain image sets used in other researches on skin color. The implementations of the algorithms are also not publicly available. Thus, it would be worthwhile for someone to develop benchmarks for algorithms in skin and nudity detection. This would enable researchers in the field to establish standard performance targets and to carry out objective performance evaluations. The nudity detection algorithm can be a foundation for an Internet porn filter but the use of images alone may result in high false-alarm rates. However, with textual content analysis, the algorithm can be enhanced to minimize false alarms. False alarm rates may also be minimized by adding face or human detection in the initial stages of the algorithm. There may be contrasting issues regarding the control of what electronic information can be made publicly available but it is important that steps need to be taken to minimize the proliferation of damaging information. Nudity or pornography detection is an essential step towards that direction.

6

References

[1] Chai, D. and Bouzerdoum, A. “A Bayesian Approach to Skin Color Classification in YCbCr Color Space.” In Proc. Of IEEE Region Ten Conference, vol. 2, 421-424, 1999 [2] Forsyth, D.A. and Fleck, M.M. “Automatic Detection of Human Nudes.” International Journal of Computer Vision, 32(1), 63-77, 1999 [3] Jones, M. and Rehg, J. “Statistical Color Models with Application to Skin Detection.” [online] Available: http:// www.cc.gatech.edu/~rehg/Papers/SkinDetect-IJCV.pdf (14 May 2008) [4] Lin, Y., Tseng, H. and Fuh, C. “Pornography Detection Using Support Vector Machine.” In Proc. Of The 16th IPPR Conference on Computer Vision, Graphics and Image Processing (CVGIP). Kinmen, ROC, 2003 [5] Chan, Y, Harvey, R., & Smith, D. “Building Systems to Block Pornography.” In Proc. Of Challenge of Image Retrieval, BCS Electronic Workshops in Computing Series, pp. 34-40, 1999

631

[6] Bosson, A., Cawley, G., Chan, Y., & Harvey, R. “Nonretrieval: blocking pornographic images.” [online]. Available: http://www.springerlink.com/content/ 3xgt5292b9jncjae (14 May 2008) [7] Peer, P., Kovac, J, & Solina, F. “Human Skin Colour Clustering for Face Detection.” In Proc. Of EUROCON 2003 – International Conference on Computer as a Tool, 2003. [8] Solina, F., Peer, P., Batagelj, B., and Juvan, S. “15 seconds of Fame – An Interactive, Computer-Vision Based Art Illustration.” In Proc. Of the 7th Int’l Conference on Control, Automation, Robotics, and Vision, pp. 198-204, 2002 [9] Wang, J., Li, J., Wiederhold, G., & Firschein, O. “System for Screening Objectionable Images Using Daubechies’ Wavelets and Color Histograms.” In Proc. of the International Workshop on Interactive Distributed Multimedia Systems and Telecommunication Services, pp. 10–30, 1997 [10] Daniel Rutter. “Pornsweeper Review” [online]. Available: http://www.dansdata.com/rpornsweeper.htm (13 May 2008)