All Projects β†’ jabertuhin β†’ image-classification-api

jabertuhin / image-classification-api

Licence: other
Serving model through api. FastApi + PytorchLightning

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to image-classification-api

classy
classy is a simple-to-use library for building high-performance Machine Learning models in NLP.
Stars: ✭ 61 (+134.62%)
Mutual labels:  pytorch-lightning
quoters
πŸ“ Random quotes generator package. Available on npm and PyPi
Stars: ✭ 17 (-34.62%)
Mutual labels:  fastapi
ride
Training wheels, side rails, and helicopter parent for your Deep Learning projects in Pytorch
Stars: ✭ 18 (-30.77%)
Mutual labels:  pytorch-lightning
pytorch tempest
My repo for training neural nets using pytorch-lightning and hydra
Stars: ✭ 124 (+376.92%)
Mutual labels:  pytorch-lightning
jsf
Creates fake JSON files from a JSON schema
Stars: ✭ 46 (+76.92%)
Mutual labels:  fastapi
fastapi douyin
ζ›΄ζ–° 2.0 η‰ˆζœ¬οΌŒδ½Ώη”¨ Python WEB ι«˜ζ€§θƒ½εΌ‚ζ­₯ζ‘†ζžΆ FastAPI εˆΆδ½œηš„ζŠ–ιŸ³ζ— ζ°΄ε°θ§£ζžδΈ‹θ½½οΌŒι‡‡η”¨ε‰εŽη«―εˆ†η¦»ζ€ζƒ³οΌ
Stars: ✭ 58 (+123.08%)
Mutual labels:  fastapi
termpair
View and control terminals from your browser with end-to-end encryption πŸ”’
Stars: ✭ 1,390 (+5246.15%)
Mutual labels:  fastapi
poem
A full-featured and easy-to-use web framework with the Rust programming language.
Stars: ✭ 1,167 (+4388.46%)
Mutual labels:  fastapi
fastapi-oidc
Verify and decrypt 3rd party OIDC ID tokens to protect your fastapi (https://github.com/tiangolo/fastapi) endpoints.
Stars: ✭ 24 (-7.69%)
Mutual labels:  fastapi
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-34.62%)
Mutual labels:  fastapi
fastapi-uvicorn-gunicorn-nginx-supervisor-boilerplate
Production ready boilerplate to start with Fastapi
Stars: ✭ 17 (-34.62%)
Mutual labels:  fastapi
fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (+457.69%)
Mutual labels:  fastapi
gestop
A tool to navigate the desktop with hand gestures. Builds on mediapipe.
Stars: ✭ 20 (-23.08%)
Mutual labels:  pytorch-lightning
Bank-Note-Authentication
πŸ’Έ Authenticate Bank Notes on the basis of Genuity and Forged using Sklearn and deployed on Heroku and FastAPI Server πŸ’³ πŸ’²
Stars: ✭ 17 (-34.62%)
Mutual labels:  fastapi
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-30.77%)
Mutual labels:  fastapi
wallpaper-api
An api which can use different sites to scrape images and serve them through API
Stars: ✭ 18 (-30.77%)
Mutual labels:  fastapi
FastApi-boilerplate
Project template for python FastApi
Stars: ✭ 41 (+57.69%)
Mutual labels:  fastapi
covid-mask-detector
Detect whether a person is wearing a mask or not
Stars: ✭ 102 (+292.31%)
Mutual labels:  pytorch-lightning
disent
🧢 Modular VAE disentanglement framework for python built with PyTorch Lightning β–Έ Including metrics and datasets β–Έ With strongly supervised, weakly supervised and unsupervised methods β–Έ Easily configured and run with Hydra config β–Έ Inspired by disentanglement_lib
Stars: ✭ 41 (+57.69%)
Mutual labels:  pytorch-lightning
fastapi-tdd-docker
Test-Driven Development with FastAPI and Docker
Stars: ✭ 89 (+242.31%)
Mutual labels:  fastapi

Build Status

User Guide

Serving deep learning model thorugh API.

Installation

Used fastapi, pytorch, pytorch-lightning mainly to create this project. You can use requirements.txt to install appropriate package version. First, create a virtual environment before installing any packages.

pip install -r requirements.txt

Note: The model was trained on Google Colab with GPU support.

About Project

This is a pet project where I wanted to learn FastApi. It's easy to train a new model these days. I also wanted to serve the model through an API. FastApi is very light and Flask like framework.

After googling I found some similar projects but they used keras. As a pytorch fan I used pytorch lightning for the training purpose.

CIFAR10 dataset was used in this project. The dataset was downloaded via torchvision dataset.

The project was designed in such a way that anyone can clone/download and run the projcet without any tweaking.

How to run the app

After installing necessary packages, use the following command to run the app from project root directory-

uvicorn app.main:app

And visit http://127.0.0.1:8000/docs from your browser. You will be able to see swagger. From there you can upload an image through predict endpoint and then you will get a json response.

Use --reload argument if you want to change code and see the effect immediately.

To Run the Test Cases Use pytest command from project root directory. Then you will see something similar to this -

alt text

How to run the app with docker

Make sure you are in the project root directory and you have started docker. Then create docker image using the following command.

docker build -t image-classifier-api .

After the image is successfully built, run the following commands to run the container.

docker run -p 5000:80 image-classifier-api

And visit http://127.0.0.1:5000/docs from your browser. You will be able to see swagger. From there you can upload an image through predict endpoint and then you will get a json response.

Model Training and Performance

Model performance wasn't the main focus of this project. So, I didn't try much to improve the model performance. All the hyperparameters can be found in config.py file.

All the files related to training can be found in the deep_learning_model/training folder.

Personal Feedback About The Project

  • Naming is an issue that is there. (variable naming, Class naing, module naming, etc). This could have been better.
  • There isn't clear seperation between the service and controller layer.
  • There is "TorchScript" to take pytorch code to production which is much optimized version.
  • The description of this README file isn't enough user friendly.

NOTE: Please, raise issue if you find an area where it needs some improvement.

Future Plan

This projects isn't upto the production standard at all. I will be updating this periodically. I have asked few of my seniors to review my codebase and provide feedback.

Though I have plan to work on the following improvements:

  • Introducing Docker
  • CI pipeline
  • SonarCloud or Other code quality checking tool/service integration
  • Dependency Injection in FastApi
  • Saving requested images in s3 bucket.
  • deploying the project on AWS or Heroku App

References:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].