Learning image recognition using sentdexs' tutorial which you can find here: https://pythonprogramming.net/convolutional-neural-network-kats-vs-dogs-machine-learning-tutorial/
This is my simple attempt to learn about image recognition using tensorflow. After much effort, I did understand what happens in the background.
Feel free to try out the codes
Here are the steps:
- Make sure you have all the required packages mentioned in
Pipfile
- You first need to preprocess your data. Ensure you've downloaded the images from https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition/data , Now:
- Run
python process_train_data.py
to create thetrain_data.npy
file - Then run
python process_test_data.py
to create thetest_data.npy
file
- Run
- Finally, you are ready to create and train your model. Ensure you've uncommented the
create_model
andtrain_model
function calls increate_n_train.py
and then runpython create_n_train.py
. If you have a slow PC (like I do), this may take a while. - Now you are ready to start the classification. Run
python make_classification.py
Of course, if you are not an absolute beginner and have some understanding of tensorflow, you can use the model.meta
file I've provided.
Do note: please keep the downloaded images and all the code files from this repository into a single directory. You can ignore this if you plan to tweak the path in the code yourself.
I managed to obtain around 96% accuracy. Some results are here:
Result2:
Not the best, but good enough for a beginner!