Claudia | Lucy |
---|---|
She's so calm and kind. she always stand in front of my door, waiting for me to come home. Once she hear the sound of my motorcycle, she'll shout 'MIAWW MIAWW MIAAWWW!!!' and run her feet to me. She's beautiful
This one have a lot of energy. She can sing all night long! unlike her sister, she always angry when other cats touch her (even males). Well I guess that's why she's still single while her sister already had a kitten :'D
I've just learned about Keras and I think I need to get started to have fun with this one. So, this is my 1st project using keras, in this project, I'll try to make a deep nets model to classify which one is Claudia, which one is Lucy.
image source: https://keras.io/
Well, let's begin!
I took 100 samples of photos for both of them manually, while sleeping, eating, walking, and even cuddling in my foot.
Using OpenCV with the helps from matplotlib and pandas, I preprocess the raw images to become a clean dataset stored in dataframe. I labeled the dataset with Claudia as 0 and Lucy as 1. I then further split this dataset to 80:10:10 ratio for Testing purpose
The dataset then saved into three parts:
1. train.csv (160 rows of observations)
2. validation.csv (20 rows of observations)
3. test.csv (20 rows of observations)
I created a class to automatically build a model with desired number of layers and nodes per layer using keras. Defaulted to 1 layer and 10 nodes as base model.
Using my newly created class before, I did some experimentation in hyperparameters to build the best model. I use combination of [2,3,4] layers alongside with [100,150,200,250,300] nodes.
After the experimentation, the best 3 models is selected. they are:
Model | Training Loss | Validation Loss |
---|---|---|
2 Layers 150 Nodes | 0.2732 | 0.8059 |
3 Layers 150 Nodes | 0.1646 | 0.8059 |
4 Layers 100 Nodes | 0.2067 | 0.8059 |
Using 3 best models chosen, I do a prediction using test dataset. Here's the test result:
Model | Accuracy |
---|---|
2 Layers 150 Nodes | 80% |
3 Layers 150 Nodes | 80% |
4 Layers 100 Nodes | 75% |
well, it seems the model with 2 layers and 150 wins the competition.
- This is obviously not a perfect model, Deep Learning with Neural Network usually works well with big datasets. using only 200 observations (160 as training data) to get 80% accuracy was good enough.
- This is my 1st project using keras, so I need to learn more utilizing it in the future and welcoming any advice