Professional Documents
Culture Documents
AMachine Learning Based Adult Content Detection
AMachine Learning Based Adult Content Detection
net/publication/341158045
CITATIONS READS
11 541
4 authors, including:
Saritha L R
Jio Institute Ulwe
6 PUBLICATIONS 32 CITATIONS
SEE PROFILE
All content following this page was uploaded by Saritha L R on 06 May 2022.
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
Abstract—In the era of internet, recognizing pornographic those images as porn or not we will be using the Support Vector
images is of great significance for protecting children’s physical Machine (SVM) Algorithm. The SVM has an hyperplane which
and mental health. With small kids surfing over the internet they separates the data points in two partitions as per their class. After
are just one click away from getting access to pornographic determining the image as porn it is then coloured black using
images. However, this task is very challenging as the key image processing[16]. Thus, the adult content detection model
pornographic contents (example. breast, private part) in an image will surely help filter unwanted/adult images.
often lie in local regions of small size. The proposed model is based
on supervised learning-based Support Vector Machine (SVM) II. LITERATURE SURVEY
algorithm which returns whether an image is safe or unsafe. The
proposed model not only differentiates the image between A. Pornographic image recognition using feature based
safe/unsafe but also blurs/colors the exposed skin portion approach
completely black if the image is found to be unsafe (i.e. The early works focuses on classifying the image based on
pornographic image) using image processing technique. So, that the percentage of skin exposed in the images. A fixed threshold
the end user won’t be able to see exposed private parts in an image.
value is being set thereafter if the percentage of skin exposed in
When tested on our newly-collected large scale dataset
demonstrates the effectiveness of the proposed method, achieving
the images is above certain threshold value then the image is
an accuracy of ~91% when tested 4k pornographic images and 4k classified as pornographic image [6],[7],[8]. Further the
normal images. classification involves feature based approach, region based and
body part-based approach. The feature-based approach involves
extracting important features from the entire image. Some of the
Keywords—adult content detection, SVM, pornographic image features involve bag-of-feature (BoF) approach [1],[2],[3] along
recognition, pornographic image blur, safe browsing with deep convolutional neural network (CNNs) approach [4],
[5]. The BoF approach captures local patterns of the entire image
I. INTRODUCTION but it lacks entire discriminative power of an image. On the
The adult content detection is an important and challenging counterpart the CNN-based approach can automatically learn to
task especially with the large amount of freely available content discriminate image from large dataset [8]. But, since they
on the web as it involves filtering the adult images and then blur directly adopt CNN architecture to model the entire
those images before the image reaches to the end user. Also, pornographic image, some crucial local details (example. private
many film production boards have implemented rating model for parts) are largely ignored.
movies so that viewers can come to know about the presence of B. Pornographic image recognition using region based
adult content in those films. In this model, the pornographic approach
images will be detected on the basis of the percentage of skin
exposed in those images. Thereafter, if found that the image is The region based approach extracts features based on the
porn then the image will be blurred. This will ensure that the end detection of images [9], [10]. Further based on the region
user is not able to see any porn images if it suddenly pops out detection such as hand geometry, shapes pertaining to private
while surfing the internet. In this, initially the model is being parts (example. breasts) are being widely detected through
trained on the available dataset. Further for classification of region-based approach [14]. Thus, as compared to the previous
Proceedings of the 14thINDIACom; INDIACom-2020; IEEE Conference ID: 49435
2020 7 International Conference on “Computing for Sustainable Global Development”, 12 th - 14th March, 2020
th
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
feature-based approach for classification of images the region- space into high dimensional feature space [11],[12],[15]. While
based approach plays a vital role in classification. The region- providing the data to kernel function as an input the data is in
based approach is much more robust but, there exists a risk of non- separable form and when this data is being converted into
determining the inappropriate regions since skin detection high dimensional feature space then it becomes separable and
involves a challenging task. the data can be classified.
III. PROPOSED APPROACH The SVM diagram is being shown below which shows how
the separation between two data classes takes place.
The proposed approach is completely based on machine
learning. In this, the model is initially trained on the training
dataset during which the accuracy obtained was 94% and while
testing the model the accuracy found was 91%.The model gives
4% false positives by classifying some of the non-adult images
into adult. The entire classification of image whether porn or not
is completely based on the amount of skin percentage being
exposed in the images. The Support Vector Machine (SVM)
algorithm is used for the classification of images whether porn
or not [11]. The SVM algorithm works on the basis of an
hyperplane which separates the data points of the two classes.
The hyperplane is also called as decision boundary as it decides
to which class the new data belongs to. The hyperplane selected
is such that it should have the maximum margin i.e. the width of
the margin should be maximum. This is taken into consideration
as the maximum margin hyperplane helps to classify the future
data points accurately whether porn or not. The dataset we have
Fig.1 . Support Vector Machine Implementation Diagram
is non-linear in nature therefore we will be using Non-Linear
SVM and kernel function. The kernel functions task involves In fig.1 the middle slant line is a hyperplane which separates the
converting the low dimensional feature space into high data points of two class. The two lines on both the sides of a
dimensional feature space [11]. While providing the data to hyperplane is drawn such that it passes close to one of the data
kernel function as an input the data is in non- separable form and points of two classes i.e. support vectors. Here, two classes are
when this data is being converted into high dimensional feature being separated by hyperplane so that the prediction of model is
space then it becomes separable and the data can be classified. accurate such that the images can be classified as per their class
Further after classifying the images into porn or not then using (i.e. porn and non-porn) [15].
image processing technique the porn image is then coloured
black completely by converting the RGB colour model into the
HSV colour model so the end user won’t be able to see such
content [16]. Thus, the model works on the basis of classification
algorithm SVM and further if the image is found to be porn then
it will be turned black thus, ensuring the safety of kids while
browsing on the web and also it helps an individual to have
smooth user experience while using social media sites.
IV. SUPPORT VECTOR MACHINE ALGORITHM
Support Vector Machine (SVM) has similar origin as neural
network. Initially, we trained the model so that it can be used in
further testing with random images .SVM builds up this model
Fig. 2 . Hyperplane Selection in Support Vector Machine
based on statistical learning, and the process of building up a
model and tuning parameters can be finished in a certain In fig.2 the hyperplane selection criteria is being explained. The
duration. Each record of information is a vector of attributes that hyperplane is selected such that the margin must be maximum
should be as representative as possible for that record of data. i.e. the horizontal distance between the data points of two classes
Since each record is formed as a vector, thus called SVM or support vectors across the hyperplane must be always
[11],[12],[13]. maximum so as to get the prediction of the model as accurate as
SVM algorithm is used for classification of images whether possible. Further, even if the data gets increased in near future
porn or not. The dataset we have is non-linear i.e. using this then too the accuracy of the model will not decrease due to the
dataset we cannot separate the data points linearly to separate the maximal margin hyperplane as the data points won’t get
two different classes i.e. porn and non-porn[15]. For that we accumulated or bounded close to each other [11],[12].
have used Non- Linear SVM and kernel function. The kernel The dataset we have contains 4k pornographic images and
function’s task involves separating low dimensional feature 4k normal images. Out of which some images are such that they
Proceedings of the 14thINDIACom; INDIACom-2020; IEEE Conference ID: 49435
2020 7 International Conference on “Computing for Sustainable Global Development”, 12 th - 14th March, 2020
th
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
cannot be directly distinguished whether pornographic or not. two dimensional image which can now be separated using
So, in such cases we use Non-Linear SVM and kernel function hyperplane.
as stated in [11],[12],[15]. The kernel function coverts the low
dimensional feature space into high dimensional feature space
so that the data points pertaining to two different classes which
are initially non separable becomes separable. In the figure
below, we can see that the one dimensional image which
contains the data points that are non separable at first after
passing through the kernel function gets converted into two
dimensional image with separable data points[15]. Also, the two
dimensional image which is initially in non-separable form after
passing through kernel function gets converted into three
dimensional image with separable data ponts. The figure below
illustrates the same.
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
In fig.7 the pornographic image is being loaded on the model animated adult image so there is little difference in processing
and based upon the skin exposed in the image it is then time for both animated and real image(depends on training).
classified as unsafe image with accuracy of image being B. Implementation when non-pornographic image is being
pornographic close to 89.094%. uploaded onto the model
Fig. 11. After uploading the non-pornographic image onto the model, it
displays whether the image is safe or unsafe.
In fig.11 the non-pornographic image is being loaded on the
model and based upon the skin exposed in the image it is then
classified as safe image.
Fig. 12. The non-pornographic image is not colored black it remains the
same.
In fig.12 the non-pornographic image that has been previously
loaded on to the model and got detected as safe is then not
colored black as the skin area exposed is very less or negligible.
Fig. 9. After uploading the pornographic image onto the model, it displays
whether the image is safe or unsafe further it also displays the accuracy.
In fig.9 the pornographic image is being loaded on the model
and based upon the skin exposed in the image it is then classified
as unsafe image with accuracy of 88.99%.
Fig. 13. After uploading the non-pornographic image onto the model, it
displays whether the image is safe or unsafe.
In fig.13 the non-pornographic image is being loaded on the
model and based upon the skin exposed in the image it is then
classified as safe image.
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
Bharati Vidyapeeth's Institute of Computer Applications and Management (BVICAM), New Delhi (INDIA)
[10] Q. Zhu, C.-T. Wu, K.-T. Cheng, and Y.-L. Wu. An adaptive skin model
and its application to objectionable image filtering. In Proceedings of the
12th annual ACM international conference on Multimedia, pages 56–63.
ACM, 2004.
[16] Basilio, Jorge & Torres, Gualberto & Sanchez-Perez, Gabriel & Medina,
Linda & Perez-Meana, Hector & Escamilla-Hernandez, Enrique. (2011).
Explicit Content Image Detection. Signal & Image Processing. 1.
10.5121/sipij.2010.1205.