Skip to content

clintonyeb/monkey_species_image_classification

 
 

Repository files navigation

Image Classification

Deep Learning, Xception CNN, Transfer Learning, CAM, Flask, and Docker

Overview

As we know, not all monkeys as the same! In this project, we're helping confusd humans to differentiate between 10 monkey species, namely, "Mantled Howler", "Patas Monkey", "Bald Uakari", "Japanese Macaque", "Pygmy Marmoset", "White-headed Capuchin", "Silvery Marmoset", "Common Squirrel Monkey", "Black-headed Night Monkey", and "Nilgiri Langur".

Approach

We used the Xception Convolutional Neural Network architecture, transfered the weights fitted on ImageNet, retrained some of the final layers, and used the CAM technique to verify the network efficiency. We made a handy dandy web application as our UI. You just load one or more images, and you'll get the name of the most similar monkey to the image. Try it out! It's fun!

If you really want to try it out, you need to know the following

We used an extremely lightweight development environment for a web application running a React front-end and Flask API back-end. The front-end connects to the back-end by making HTTP requests for desired data. React and Flask are containerized and managed with Docker Compose.

Why Create React App?

Create React App allows us to very easily create a React app with no build configuration. React is currently one of the most popular front-end Javascript libraries for building UIs.

Why Flask?

Flask is a lightweight, highly-customizable micro-framework for Python. It let's us build really simple web applications quickly (the "hello world" app is literally 5 lines of code). Flask doesn't come built-in with much, and if you're looking to integrate a more robust back-end framework with React (say, Ruby on Rails), I'd recommend checking out this blog post.

Why Docker Compose?

Docker maintains software and all of its dependencies within a "container", which can make collaborating and deploying simpler. Docker Compose is a tool for easily managing applications running multiple Docker containers.

How to Use

Firstly, download Docker desktop and follow its instructions to install it. This allows us to start using Docker containers.

Create a local copy of this repository and run

docker-compose build

This spins up Compose and builds a local development environment according to our specifications in docker-compose.yml. Keep in mind that this file contains settings for development, and not production.

After the containers have been built (this may take a few minutes), run

docker-compose up

This one command boots up a local server for Flask (on port 5000) and React (on port 3000). Head over to

http://localhost:3000/ 

to view an incredibly underwhelming React webpage listing two fruits and their respective prices. Though the apparent result is underwhelming, this data was retrieved through an API call to our Flask server, which can be accessed at

http://localhost:5000/api/v1.0/test

The trailing '/api/v1.0/test' is simply for looks, and can be tweaked easily in api/app.py. The front-end logic for consuming our API is contained in client/src/index.js. The code contained within these files simply exists to demonstrate how our front-end might consume our back-end API.

Finally, to gracefully stop running our local servers, you can run

docker-compose down

in a separate terminal window or press control + C.

License

Feel free to use the code in this repository however you wish. Details are provided in LICENSE.md.

About

Monkey Species Deep Learning Prediction - Computer Vision

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 92.7%
  • Python 4.7%
  • JavaScript 2.0%
  • Other 0.6%