You are on page 1of 9

Online Adult Content Detection System

Authors:
1. Katende Chris Marvin

Presented by -
Katende Chris Marvin
Affiliation: Makerere University
Country:Uganda
Explore and data cleaning

❑ Due to the use of an image ased dataset, I had trouble with plotting
heat maps and other parts of question but I was successful I cleaning
my data set with the help of the pandas dependecy.
 for image_class in os.listdir(data):
 for image in os.listdir(os.path.join(data,image_class)):
 image_path=os.path.join(data,image_class,image)
 try:
 img = cv2.imread(image_path)
 tip =imghdr.what(image_path)
 if tip not in image_exts:
 print('image not found {}'.format(image_path))
 os.remove(image_path)
 except Exception as e:
 print('bad image type {}'.format(image_path))

2
Data cleaning continued

❑ With the above for-loop,it searches/traverses


through the dataset looking for dodgy images or
images that are not clear and prints out “bad image
type”.

3
Data Splitting


Initially, my dataset was already split but
with the use of the numpy iterator that
loops through the data, it standardizes the
dataset to a given quantity and with the
use of the (len) method I get to know the
actual quantity and wit allocation of a
solid seventy percent to the the train data,
it can then be scaled with a 20%
validation data and 10% test data

4
Dataset training

❑ After data has been split the model is trained using


the keras.models method which compiles the data
into accuracy test models and loss models and its
with the use of the fit the runs the and tries to
separate the porn pictures from the non-porn ones.
❑ Each time an epoch runs, the accuracy rises and
loss keeps on going down and if this happens, it
means that your model is perfectly successfully
trained.

5
Tune hyper parameters

❑ Hyperparameter tuning (or hyperparameter


optimization) is the process of determining the right
combination of hyperparameters that maximizes the
model performance. It works by running multiple
trials in a single training process. Each trial is a
complete execution of your training application with
values for your chosen hyperparameters, set within
the limits you specify. This process once finished
will give you the set of hyperparameter values that
are best suited for the model to give optimal results

6
Validation.

predictions = []
for pred in model_dense.predict(next(test)[0]):
p = []
for i in pred:
p.append(float(i))
predictions.append(p)
Using the above code in my notebooke I was ale to
predict different data that has to be either porn and
non porn and each time it ranit output values that go
with a high probability for each instance if the

7
continuation

❑ Image is pornographic it shows a higher probabilty


againsts a lower probability non porn pictures.

You might also like