Skip to content

DL model deployment using docker, API deployment with FastAPI, and MLOps using WandB for overhead-mnist dataset

Notifications You must be signed in to change notification settings

AbhishekRS4/overhead_mnist

Repository files navigation

Overhead MNIST

Dataset info

  • The dataset used in this project is the Overhead-MNIST dataset and it can be found here
  • The dataset contains 10 classes

Project info

  • This repo contains an end-to-end deep learning project deployment for overhead image classification
  • The purpose of this project is to try multiple new things. The following new things that have been explored
    • In this project, the recently popular Kolmogorov-Arnold Networks (KAN) is also explored
    • Simple and Complex CNNs using the KAN layer is developed and tested
    • Weights and Biases has been used for MLOps including its new feature of model registry
    • For training, the Automatic Mixed Precision (AMP) has been explored by using float16 for some layer weights to speed up training
    • For deployment, an API has been developed and deployed using FastAPI and docker
  • For the training, the dataset is split into 95% - 5% for train and validation sets respectively
  • The python packages are listed in requirements.txt
  • The docker container can be deployed using Dockerfile
  • For training and logging the model, use the modeling/train.py script
  • The FastAPI app deployment code is in app.py script
  • To test the deployed FastAPI app on a local machine, the test_post_request.py script can be used
  • Some sample test images are available in sample_test_images

Training using docker image

  • Use the following command for training using the docker image
docker run --rm -it --init   --gpus=all   --ipc=host   --user="$(id -u):$(id -g)"   --volume="$PWD:/app"   my_pytorch python3 modeling/train.py --dir_dataset /app/dir_dataset/

Docker deployment instructions on a local machine

docker build -t fastapi_overhead_mnist .
  • To the run the container, run the following command
docker run -p 7860:7860 -t fastapi_overhead_mnist

HuggingFace deployment

  • The FastAPI application has also been deployed to HuggingFace
  • To test the deployed FastAPI app on HuggingFace, use the test_post_request.py script in the HuggingFace repo since the endpoint is different

Docs

Sample test images

Sample test image 1 Sample test image 2 Sample test image 3 Sample test image 4 Sample test image 5 Sample test image 6 Sample test image 7 Sample test image 8 Sample test image 9 Sample test image 10

References