- This is a project that was inspired from this article
- This project uses https://www.kaggle.com/c/dogs-vs-cats/data as a dataset
- It was written in Python
- Keras uses TensorFlow by Google
- It is ~85% accurate.
This project requires TensorFlow to run.
Check if Python and Pip is installed
$ python -V # or: python3 -V
$ pip -V # or: pip3 -V
To install these packages on Ubuntu:
$ sudo apt-get install python-pip python-dev python-virtualenv # for Python 2.7
$ sudo apt-get install python3-pip python3-dev python-virtualenv # for Python 3.n
We recommend using pip version 8.1 or higher. If using a release before version 8.1, upgrade pip:
$ sudo pip install -U pip
If not using Ubuntu and setuptools is installed, use easy_install to install pip:
$ easy_install -U pip
Create a directory for the virtual environment and choose a Python interpreter.
$ mkdir ~/tensorflow # somewhere to work out of
$ cd ~/tensorflow
# Choose one of the following Python environments for the ./venv directory:
$ virtualenv --system-site-packages venv # Use python default (Python 2.7)
$ virtualenv --system-site-packages -p python3 venv # Use Python 3.n
Activate the Virtualenv environment. Use one of these shell-specific commands to activate the virtual environment:
$ source ~/tensorflow/venv/bin/activate # bash, sh, ksh, or zsh
$ source ~/tensorflow/venv/bin/activate.csh # csh or tcsh
$ . ~/tensorflow/venv/bin/activate.fish # fish
When the Virtualenv is activated, the shell prompt displays as (venv) $.
Upgrade pip in the virtual environment. Within the active virtual environment, upgrade pip:
(venv)$ pip install -U pip
You can install other Python packages within the virtual environment without affecting packages outside the virtualenv.
Choose one of the available TensorFlow packages for installation:
tensorflow —Current release for CPU tensorflow-gpu —Current release with GPU support tf-nightly —Nightly build for CPU tf-nightly-gpu —Nightly build with GPU support Within an active Virtualenv environment, use pip to install the package:
$ pip install -U tensorflow
Use pip list to show the packages installed in the virtual environment. Validate the install and test the version:
(venv)$ python -c "import tensorflow as tf; print(tf.__version__)"
TensorFlow is now installed. Use the deactivate command to stop the Python virtual environment.
Install Keras from PyPI (recommended):
$ sudo pip install keras
Alternatively: install Keras from the GitHub source: First, clone Keras using git:
$ git clone https://github.com/keras-team/keras.git
Then, cd to the Keras folder and run the install command:
$ cd keras
$ sudo python setup.py install
Keras is now installed.
Clone this repository and cd in it.
$ git clone https://github.com/ardaa/kerasml.git
$ cd kerasml
If you want to train the model:
$ python train.py
If you want to predict using the model: Add the directory of file that you want to predict in predict.py at line 52.
img_path = 'test1/1.jpg' # Change here
# Load the image as a tensor
new_image = load_image(img_path)
Then run it
$ pythonw predict.py
Want to contribute? Great!
Fork the repository, make your changes and make a pull request.
- Make the image to be predicted selectable from bash
- Improve the model to run faster.
MIT