Professional Documents
Culture Documents
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
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
5
Tune hyper parameters
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