Classify images by Deep Learning using Keras with TensorFlow backend.
-
Download Anaconda from anaconda.com, and install it.
-
Setup new python environment with Anacond-Navigator
-
Open a terminal window, and do following installations
-
Install modules by typing following command in terminal.
pip install tensorflow flickrapi pillow sklearn keras Flask
-
Go to your working folder, and clone this repository by typing following command in terminal.
git clone [email protected]:tetsu/animal-classifier.git
-
Create a Flickr account, and enter Flickr Key and Secret in
config/env_sample.py
, and rename the file toenv.py
.FLICKR_KEY = "{your flickr key}" FLICKR_SECRET = "{your flickr secret}" CLASSES = ["monkey", "boar", "crow"] IMAGE_SIZE = 50 NUMBER_OF_IMAGES = 400
-
Go to the top folder of this project, and download images of assigned classes by typing following command in terminal.
python download.py
-
Check folders under "images" folder, and remove images that are not proper for learning, such as unclear images, wrong images, images with other animals or breeds, etc.
-
Convert images to NUMPY data to use on Keras by typing following command in terminal.
python gen_data.py
-
Train model, generate trained neural network h5 file, and evaluate the result by typing following command in terminal.
python image_cnn.py
-
Classify an image file by typing following command in terminal.
python predict.py {an image file path}
-
You can also classify an image file on a web page by typing following command in terminal, and check it on web browser.
FLASK_APP=index.py flask run