In this repository, I share my practice in containerizing a Machine Learning (ML)/Deep Learning model as REST API using Flask and Docker.
- Python (Tensorflow & Pillow)
- Flask, HTML & CSS
- Docker
The data can be downloaded as the following:
wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip \
-O ./data/cats_and_dogs_filtered.zip
The ML model consists of data preprocessing, feature extraction and classifier. In the training phase, data augmentation and dropouts techniques are utitlized to improve the performance. Below is the block diagram of the deep learning model.
Figure: Cat vs Dog Classifier diagram.
The inception v3 weights can be accessed as the folowing:
wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \
-O ./data/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5
Clone the repository into your local machine as the following:
git clone https://github.com/bagheri365/CatDog-Calssifier-Deployment.git mygit
cd mygit
Build an image from the Dockerfile as the following:
docker build -t myimage:latest .
Note that a docker image is a template that contains the application, and all the dependencies required to run that application on Docker.
You can run the docker container as the following:
docker run -it -p 5000:5000 myimage
Note that the container simply is running instance of the image.
Here are demos of the REST API built with Flask.