Skip to content

tetsu/keras-image-classifier

Repository files navigation

Keras Image Classifier

Classify images by Deep Learning using Keras with TensorFlow backend.

How to Setup

  1. Download Anaconda from anaconda.com, and install it.

  2. Setup new python environment with Anacond-Navigator

  3. Open a terminal window, and do following installations

  4. Add TensorFlow module to your Python environment by typing following command in terminal.

    pip install tensorflow
    
  5. Add FlickrAPI module to your Python environment by typing following command in terminal.

    pip install flickrapi
    
  6. Add pillow module to your Python environment by typing following command in terminal.

    pip install pillow
    
  7. Add Scikit-Learn module to your Python environment by typing following command in terminal.

    pip install sklearn
    
  8. Add keras module to your Python environment by typing following command in terminal.

    pip install keras
    
  9. Add Flask module to your Python environment by typing following command in terminal.

    pip install Flask
    
  10. Go to your working folder, and clone this repository by typing following command in terminal.

    git clone [email protected]:tetsu/animal-classifier.git
    
  11. Create a Flickr account, and enter Flickr Key and Secret in config/env_sample.py, and rename the file to env.py.

    FLICKR_KEY = "{your flickr key}"
    FLICKR_SECRET = "{your flickr secret}"
    CLASSES = ["monkey", "boar", "crow"]
    IMAGE_SIZE = 50
    NUMBER_OF_IMAGES = 400
  12. Go to the top folder of this project, and download images of assigned classes by typing following command in terminal.

    python download.py
    
  13. 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.

  14. Convert images to NUMPY data to use on Keras by typing following command in terminal.

    python gen_data.py
    
  15. Train model, generate trained neural network h5 file, and evaluate the result by typing following command in terminal.

    python image_cnn.py
    
  16. Classify an image by typing following command in terminal.

    python predict.py {an image file path}
    
  17. Run Flask app by typing following command in terminal

    FLASK_APP=index.py flask run
    

About

Classify photos using Keras with TensorFlow backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages