Nothing Special   »   [go: up one dir, main page]

Image Guarder

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

IMAGE GUARDER: AN INTELLIGENT DETECTOR FOR ADULT IMAGES

Wei Zeng1, Wen Gao1, 2, Tao Zhang1 and Yang Liu1

1
Department of Computer Science and Technology, Harbin Institute of Technology, China
2
Institute of Computing Technology, Chinese Academy of Sciences, China
{wzeng, tzhang ,yliu}@jdl.ac.cn; wgao@ict.ac.cn

ABSTRACT There is a growing industry aimed at filtering and


blocking adult contents from web indexing and browsing.
In this paper, we proposed an intelligent adult image Two types of solutions successfully occurred in the
detector, called Image Guarder, which can automatically software industry. The first is collecting the adult web site
analyze the image content, efficiently recognize adult addresses. Once one of prohibited web sites is accessed,
images. In order to speed up recognition, a two layers the inspection software checks the rights of user, and
recognition framework is adopted. An adaptive statistical blocks the unauthorized accessing. The second is filtering
color model is developed to detect the skin pixel in variant web page by content analysis. Key words of adult web
illumination environment. Smooth character is used to test pages are modeled by statistic nature language model.
the skin texture feature after skin color detection. Only the Once the keywords are found in user’s computer, the
images that have enough skin color pixels and smooth inspector program screens the related content of the web
texture are sent to a support vector machine (SVM) page. Because many new web sites occurred every day, it
classifier to refine the recognition. Color, texture and is hard to collect all adult website addresses. The second
shape features are extracted from the skin regions and fed technique is sensitive to the key words. It may be block
into the trained SVM. The experimental results are carried the sex education pages for the key words are occurred.
out on a large image set about 110,657 nature images and As a direct and supplementary solution, there are some
11,351 adult images downloaded from the Internet. The attempts to recognize adult images by image content
Image Guarder shows excellent performance that the analysis technique. The pioneer work was done by
precision for adult image recognition is 76.5%, while the Forsyth’s research group [1]. They designed and
precision for benign image is 95% respectively. The implemented an automatic system that can tell whether
average process speed is less than one seconds per frame there were naked people presenting in an image. Their
on a Pentium IV1.5GHz PC. approach combined tighly-tunned skin filter and smooth
texture analysis for skin detection. After skin detection,
the geometric analysis was used to group skin regions
into human figure for human body detection. Wang et al.
1. INTRODUCTION presented a system of screening objection images for
practical applications [2]. Wang’s method employed a
An explosion of on-line image and video data in digital combination of an icon filter, a graph-photo detector, a
form is already well underway. The freedom of information color histogram filter, a texture filter and a wavelet-based
acquirement and dissemination makes the Word-Wide shape matching algorithm. The images that passed
Web (WWW) become the most popular place where histogram analysis, texture analysis and shape matching
people obtain, deliver and interchange information. were classified as the adult image. Jones and Rehg
However, the unconstrained information delivery also developed a statistic model for skin color detection [3]. As
brings side effects such as illegal adult content accessing, one of the applications, the adult image was recognized by
illegal advertisements, violence information etc. Sometimes, the skin detector and the neural network classifier.
the unwilling adult images may occur in your computer A.Bosson et al. recently have proposed a multi-layer
when you access a new website or open an email attached perceptron classifier and showed a commercial system [4].
with images. Those side effects become more and more a The researches presented many encouraged results, but it
social problem, especially for young person who browses is still a long way to use automatic adult image detector in
adult images or videos. It is urgent to develop the efficient real application.
tools to clean the Internet and filter adult contents Identifying adult images is an image object recognition
automatically. problem. It is difficult for the following reasons:
• Images are captured in variant illumination; lack skin color
• Images are digitized in different resolution; skin skin color detector
• Images may contain part of human body; detector lack skin texture
• Human body may have various poses; skin texture validation
• Human body may be partly dressed;
• Some art images are much like the adult image.
As the prior knowledge about adult images is that they
have dominant skin regions. A robust adaptive statistical
feature extraction
color model is developed to detect the skin pixel in the
color space. In order to characterize the smoothness color texture shape
property of skin, a simple texture validation approach is
applied to verify the detected skin regions. After the skin
detection, all skin regions are treated as candidate image SVM classifier
regions. Color, texture and shape features are extracted
from the detected skin regions. A trained classifier,
Yes No
support vector machine (SVM), is used to identify the
adult image in the feature space. To speed up recognition, Adult images Benign images
a two layers’recognition framework is adopted. Only the Fig.1. The system structure of Image Guarder
images that have enough skin regions are selected as
candidates in the first layer for the next step’s recognition. Since our skin color detector computes the pixel
The SVM is used as image classifier in the second layer’s probability of skin in the image, the skin color detection
recognition. Such pre-classification can efficiently detect can be finished within O(n) time, where n is the size of
many benign images in application because a large number image. The skin texture detector is simply calculating the
of nature images have little skin. region intensity variance in a moving window. So, the skin
The remainder is organized as follows. In Section 2, we texture validation is very fast. Consequently, the first
describe the system structure of the proposed system. layer’s recognition is quickly. Such asymmetric processing
The modified skin color detector and the simple skin for adult and benign images is very useful in real
texture validation approach are described in Section 3 and applications because the priori probability of adult image
Section 4. The adult image classifier is discussed in is low in the world.
Section 5. Experiments are reported in Section 6 and
conclusion is given in Section 7. 3. ROBUST SKIN COLOR DETECTION

2. SYSTEM DESIGN Skin color detection is a binary classification problem


accomplished in color space. The RGB color space is
The developed adult image system, called Image Guarder, chosen as the color representation in our implementation.
has a two layers’recognition framework. Only the images
that have enough skin regions are output as candidate 3.1. Skin Pixel Detection by the Illumination Adaptive
images in the first layer’s detection. Most of benign Statistical Color Model
images are recognized correctly because of the fact that
the large number of nature images with little skin color. Since the images are captured under variant lighting
After color detection, a texture detector is adopted to conditions, the illumination of the image will influence the
remove spurious skin regions that violate the texture color measure of skin. However, the unknown camera
distribution of skin. Images that have skin pixels above a parameters and the spectrum of the light source disturb
predefined threshold are considered as the candidate computing the illumination parameter accurately. In this
images and fed into next layer’s recognition. This simple paper, we propose a simple and efficient method, called
adult image detector has low recognition precision illumination adaptive statistical color model (IASCM), to
because only color and texture of skin are employed in detect the skin color under variant illumination. We pre-
recognition. To decrease the false alarm, the sophisticated group the sample image into different clusters according
image classier is used to refine the recognition. The the average image brightness. Several color models are
candidate images are fed into a trained support vector learned from the clustered illumination training images. In
machine to obtain the further recognition. Color, texture each class, the color model is the statistical skin color
and shape features are extracted for the SVM classifier. model as description in [3]. The proposed approach
The system architecture is illustrated in figure 1. achieves a better result in real skin color detection. In the
IASCM, the pixel is represented by the color values and
average image brightness L. The posterior probability of
skin pixel is computed as
P ( Skin| RGB, L ) =
(1)
P ( RGB, L | Skin) P ( Skin)
P( RGB, L | Skin) P( Skin) + P( RGB , L | ¬Skin) P (¬Skin)

where P( RGB, L Skin) and P( RGB, L ¬ Skin) are the class


conditional probability of skin and non-skin pixels under
the average brightness L. Under the equal prior probability
assumption, the equation (1) can be simplified to
P( RGB | Skin, L) . (2)
P( Skin| RGB, L) =
P( RGB | Skin, L) + P( RGB | ¬Skin, L) Fig.3. The ROC curves of skin color detection

A pixel will be classified as skin pixel if 3.2. Background Removing


P(Skin| RGB, L) ≥ θ , θ ∈[0, 1] , (3)
Sometimes, the background is detected as skin region
where θ is the threshold. Three illumination levels are such as carnation wall, yellow clothes etc. The spurious
used in our implementation. They are dark, normal, bright skin region will influence ultimate classification. It is hard
illumination condition. to distinguish the background from real skin regions
Figure 2 gives some examples of the detected skin because the color of the background and skin regions is
regions under dark, normal, bright illumination the same in color space. However, the skin regions and
environment. The second column shows the results of background may distribute as two connected clusters in
single statistical color model approach [3] and the third color space. Based on this point, the 3D connected region
column is results of the IASCM method. The first line is extraction algorithm is applied to segment the background
dark image. The second line is normal image and the third and skin regions, detailed in [5].
line is bright one. The precision IASCM model is equal to In figure 4, the results of background removing are
the statistical model under normal illumination and better given. The second column gives the results of skin color
under dark condition. detection. The third column shows the detected skin
regions after background removing. Yellow and red
clothes are miss-detected by the skin color model and
removed by the connected region analysis.

Fig.2. Results of skin color detection


Figure 3 shows the receiver operating characteristic original image skin color mask processed mask
(ROC) curve for the proposed algorithm and the single Fig. 4. Examples of background removing
color model approach. We manually labeled skin pixels in
829 adult images that are downloaded from the Internet as
3.3 Small Skin Region Eliminating
experimental data. The dash line is the performance of the
IASCM approach. From figure 3, it is clearly seen that the
Because the direct reflection of the skin, some skin pixels
IASCM method shows better result.
are desaturated. Those skin pixels will be classified as
non-skin pixel. Some pixels in shadow region will also be content of the adult image. The color, texture and shape
miss-classified for its color is very close to black. These features are extracted from the marked object. A support
two types errors will produce many skin holes in the vector machine (SVM) is adopted as the adult image
detected skin regions. Therefore, we apply a region classifier to recognize the object in feature space.
analysis to eliminate the small holes. If the small region is Based on domain knowledge, human body is with
surround by skin color and its color is closed to white or dominant skin color, smooth skin texture and human body
black. The region is marked as skin region. shape. Therefore, forty-eight dimensional feature is used
At the same time, some pixels that belong to the to represent the adult image in feature space. The feature
background are detected as skin region. It produces some is composed of
skin fragment regions in the background. If the area of • color features: color mean, color moment, mean of
connecting skin region is less than 5% of the whole skin color probability, variance of skin color
detected skin region size, the small region is classified as probability;
background. The median filter is used to filter out noise at • texture features: texture contrast, texture coarseness;
the last step. • shape features: skin region area, region edge
intensity, the Zernike moment.
4. SKIN TEXTURE VALIDATION
6. EXPERIMENTAL RESULTS
Smoothness is an important texture character of skin. It
can be used to verify the detected skin color regions. In The performance of the SVM classifier is tested on the
this paper, we adopt a simple first order statistic texture collection of 70,406 nature images downloaded from the
descriptor to represent the skin texture. The local variance Internet. The data set consists of 11,349 adult images and
is used to measure the region smoothness in a moving 59,057 benign images. Those images are manually grouped
window. If the variance is below the predefined threshold, into adult images and benign images. The ratio of the adult
the region is classified as skin region. The window size is images and benign images is about 1: 6. In each test, we
the proportion of the boundary box of the skin color chose one-tenth samples as the train set, while the
regions. The threshold is computed from the statistic from remainder is test set. The accuracy of the SVM is given in
a manually labeled skin region library. table 1.
Figure 5 shows the results of skin texture validation.
The miss-classified color regions are removed by the Table 1. Accuracy of C4.5 and SVM (In SVM 1 linear kernel
texture analysis while the skin regions are kept. function is used, and in SVM 2 radial basis function is used as
kernel with gama=0.01)
C4.5 SVM1 SVM2
1 91.4% 90.55% 91.52%
2 90.8% 90.52% 91.57%
3 91.2% 90.73% 91.71%
4 91.1% 90.72% 91.59%
5 90.7% 90.70% 91.64%
6 90.9% 90.70% 91.63%
7 91.0% 90.70% 91.70%
8 90.7% 90.76% 91.67%
9 90.6% 90.70% 91.70%
10 90.9% 90.73% 91.61.%
Average 90.9% 90.7% 91.63%

original image skin color mask processed mask As C4.5 is the most popular decision tree method, it is
successfully used in the person image classification [3].
Fig.5. Examples of skin texture validation
We compared the C4.5 decision tree classifier and the
SVM in adult image recognition. Two types of kernel
5. ADULT IMAGE RECOGNITION functions, linear kernel function and radial basis function,
are used, which are represented as SVM 1 and SVM 2. Table
After the skin detection, the coarse object mask of human 1 illustrates the recognition results of C4.5 and SVM. It is
body is obtained. All the skin regions are treated as the shown that SVM 2 has highest accuracy, while SVM 1 has
the lowest accuracy. All the three classifiers have above zero to one. Zero means that no skin color detected in the
90% accuracy. image, and vise versa. From figure 6, there is about 99%
In this paper, we use precision and recall to test the adult image and the 14% benign images that have above
classifier performance. Table 2 illustrates the precision and ten percentage of skin color. That is to say, if the
recall of the SVMs. It is clear to see that C4.5 has the threshold is set 0.1, 99% adult images and 14% benign
highest recall, but its precision is the lowest. The SVM images will be classified as candidates of adult images.
based on radial basis function has the highest precision. The threshold 0.1 is also adopted in the Image Guarder
Therefore, the SVM with radial basis function is adopted because 86% benign images are correctly recognized.
in the Image Guarder as the second layer’s classifier. Figure 6(b) shows the texture occupation rate (TOR)
curves of skin region. The texture occupation rate defined
Table 2. The precision and recall of the three classifiers as the percentage of smooth texture for the skin color
Precision/Recall C4.5 SVM1 SVM2 regions detected by the skin color detector. TOR
1 73.03/73.73 72.62/67.16 75.49/70.18 represents the quantity of smooth texture in the detected
2 72.54/69.01 73.42/64.59 77.29/67.59 skin color regions. The adult image set and benign image
3 72.58/73.38 73.16/67.07 76.31/70.40 set have different TOR curves shown in figure 6(b). It can
4 72.19/72.44 72.65/68.03 75.67/70.47 be clearly seen that above 96% adult images have the 30%
5 72.04/69.36 72.68/67.77 75.97/70.38 smooth skin texture, while only 22% benign images have
such quantity of smooth texture. That is to say that if the
6 71.43/72.15 72.64/67.85 76.38/69.59
threshold for skin texture analysis si set as 0.3, 72%
7 72.05/72.02 72.70/67.72 75.80/71.24
benign images can be recognized by the skin texture
8 71.15/71.26 72.66/68.46 76.06/70.53
validation process.
9 70.48/71.73 73.05/67.04 76.42/70.15
10 70.78/74.34 72.57/68.26 75.86/70.36
Average 71.83/71.94 72.82/67.30 76.13/70.09

Since SVM has many parameters to adjust, there is a


trick to construct the cost function. This can offer variant
precision and recall in real application and provides
controllable classifier. It is the reason that we choose the (a) (b)
SVM with radial basis function as the image classifier to Fig.6. (a)The occupation rate of skin color;
balance the precision of adult images and benign images (b) The texture occupation rate of skin
recognition in real application.
To test the performance of the Image Guarder, we set The precision and speed of the Image Guarder is
up a test library obtained from CDs and the Internet. There influenced by the thresholds for skin color and texture
are 110,657 nature images, and 11,351 images are adult analysis . In short, the more benign images are recognized
images. The benign image library is composed of seven by color and texture analysis, the quicker the system is.
CDs of the Cordraw image library and nature images Figure 7(a) gives the system recognition precision curves
download from about 160 picture websites. when the threshold for the TOR is 0.3. The adult image
In the first layer’s adult image recognition, the precision dropped rapidly when the threshold when the
thresholds for skin color and skin texture detection is threshold for skin color detection rises. The adult image
decided by experiments. The criterion of the thresholds recognition precision curve dropped slowly between 0 and
decision is passing the benign images as more as it can 0.1. The system precision curve is more flat than the curve
while the adult image recognition precision dropped less. in figure 6. This is because that the SVM correct the
It is a trade-off between the speed and precision. The more recognition results of the first layer’ s recognition. Figure
the benign recognized by the skin color and the skin 7(b) gives the system recognition precisions when the
texture detector, the quicker the system is. However, the threshold for the SOR is 0.1. The adult image recognition
system precision will descend rapidly because the first precision dropped slowly between 0 and 0.4. The system
layer’s recognition is low precision. precision for the total data dropped more flat than that of
The skin color occupation rate (COR) is defined as the the precision of the adult images. From the system
percent of skin color in the image, which is used as the recognition curves, it is clear to see that the carefully
measure to detect candidate of adult image. Figure 6(a) selected thresholds can improve the process speed
shows the COR curves for the whole image library. Two systematically and keep the system precision at the same
data sets are used to get the occupation rate curve from time. It is a trick for speed and precision in the adult image
detection system design.
(a) (b)
(a) Precision curves for variant threshold for the SOR of skin;
(b) Precision curves for variant threshold for the TOR of skin
Fig. 7. The SOR and TOR curves

Table 3 illustrates the time analysis for the Image


Guarder. The first line gives the results of processing
speed in each step of the proposed system. The feature Fig. 8. Some examples of detected adult images
extraction process consumes about 99% time of the
system. This is because that many time-consuming feature 7. CONCLUSION AND FUTURE WORK
computing is finished in this step. As we can see that 70%
benign images will be detected in the first layer’s In this paper, we propose an adult detection system. The
recognition. This saves much time for benign image proposed system detects the skin regions by an
processing. The ratio of adult images and benign images is illumination adaptive skin color detector followed by the
about 10:1 in our test data set. The processing time will be skin texture validation. Color, texture, and shape features
different for variant mixture ratio of adult images and are extracted from the skin regions for classification. A
benign images. Since the system pay low computing load trained SVM classifier is used to recognize the adult image
in the simple skin color detection and skin texture in feature space. Our system showed excellent
validation, more robust and accurate algorithms can be performance and rapid speed on the extensive testing data
developed to improve the system performance. set. Future work will focus on the more reliable skin
detector and efficient shape description. In real application,
Table 3. The results of the system processing time speed is also needed to pay more attention.
Color Texture Feature
System
detection analysis extraction 8. ACKNOWLEDGEMENT
Speed
(second per 0.0635 0.0493 1.3396 1.3439 This work has been supported by the National Hi-Tech
frame) Development Programs of China under grant No.
2003AA142140.
Candidate
24179 13299 - -
(frame) 9. REFERENCES
Time
6390.6 1192 16315 24328.3 [1] Margaret Fleck, David A.Forsyth, Chris Bregler, “Find
(second)
naked people,”Proc. 4th European Conf. on Computer Vision,
Saving time UK, vol. 2, pp. 593-602, 1996.
97920 13394 - -
(second) [2] James Z. Wang, Jia Li, Gio Wiederhold, Oscar Firschein,
“System for screening objectionable images,” Computer
Communications, Vol.21, No. 15, pp. 1355-1360, Elsevier, 1998.
In our system, the system precision for adult images is
[3] Michael J. Jones, James M. Rehg, “Statistical Color Models
76.5%, while the precision for benign images is 95%
with Applications to Skin Detection,” Technical report of the
respectively. The speed for benign image is 10 frames per
Cambridge Research Laboratory, No.98-11, Dec.1998.
second, and for the adult image is 0.7 frames per second.
[4] A.Bosson, G.C.Cawley, Y.Chan and R.Harvey, ”Non-
Because little skin color detected in benign image, it saves
retrieval: blocking pornographic images,”Proc. Int. Conf. on the
much time in skin color detection, skin texture validation
Challenge of Image and Video Retrieval, Lecture Notes in
and feature extraction steps. The hardware platform is a
Computer Science, Vol.2383, pp.60-69, 2002
Pentium IV1.5GHz PC with 256M memories. Figure 8 gives
[5] Kyung-min Cho, Jeong-hun Jang, Ki-Sang Hong, “Adaptive
some examples of detected adult images. As for
skin-color filter,”Pattern Recognition,Vol.34, pp.1067-73, 2001
publication, some parts of the images are marked.

You might also like