In: Computer Science
You have been given a task to differentiate between the images of a cat and a dog. You have been given a dataset of 50000 coloured images of size 40x40 which contains either a cat or a dog. Being as specific as you can, please detail the procedure of how you are going to solve this problem.
There are many ways in Machine Learning (ML) and Deep Learning(DL).
In the given question the dataset is comprised of photos of dogs and cats provided as a subset of photos from a much larger dataset of 50000 coloured images of 40X40.
Please follow below algorithm:
1. Plot dog photos from the dogs vs cats dataset
2. Define location of dataset
3. Plot first few images
4. Define subplot and filename
5. Load image pixels
6. Plot given raw pixel data
7.Display the figure
8. Plot CAT photos from the dogs vs cats dataset (follow the same as 2 to 7 above step)
lets assume that images are standaized.
Now, If we want to load all of the images into memory, you can load and save them as single NumPy array.( this optional, however increases the performance of the model).
9. Now load and confirm images shape and size.
Strucutre the dataset directory and images properly.
Now, we can randomly decide to consider 25% of the images into the test dataset.
Developing CNN Model: " Baseline model"
A baseline model will establish a mini. model performance to all of our models.You can use VGG model. The model will be fit with stochastic gradient descent and better to start with a conservative learning rate of 0.001 and a momentum of 0.9. The given problem is a binary classification task, this requirs the prediction of one value of either 0 or 1. It is also required to use an output layer with 1 node and a sigmoid activation ( for better performnace use can use the binary cross-entropy loss function).
10. Prepre the data for model (i.e for traning and testing)
11. Use 15 or 20 epochs to fit the model
12. Plot loss and accuracy
( you can deifne and check different number of VGG models for Entropy loss and classification accuracy)
I hope you can write code either in python or R.