28 Aralık 2019 Cumartesi

Tensorflow Gender Detector

Here is my last Tensorflow experiment. A convolutional neural network implementation sample that detect human genders via Tensorflow and Keras.

Souce code
https://github.com/diwsi/Tensorflow-Gender-Detector

Training Data
I used https://www.kaggle.com/playlist/men-women-classification for training data. Removed useless pictures, cropped from center as square shape and resized to 128x128 pixels.

Network Model
Tensorflow keras network contains 4 convolutional layers with 3 by 3 filters. Has somoe dropout between dense layers to prevent overfitting. (trainer.py)



Training
"Sparse Categorical Crossentropy" for loss funtion with adam optimizer over 50 epochs. (trainer.py)




Prediction
After training completed here is the result of test images (predictor.py)



f1.jpg Woman:99% Man:0%
f2.jpg Woman:99% Man:0%
f3.jpg Woman:99% Man:0%
f4.jpg Woman:99% Man:0%
f5.jpg Woman:99% Man:0%
f6.jpg Woman:100% Man:0%
m1.jpg Woman:43% Man:56%
m2.jpg Woman:0% Man:99%
m3.jpg Woman:0% Man:99%
m4.jpg Woman:28% Man:71%
m5.jpg Woman:2% Man:97%
m6.jpg Woman:99% Man:0%
m7.jpg Woman:0% Man:99%
m8.jpg Woman:0% Man:99%
m9.jpg Woman:0% Man:100%