Giter Club home page Giter Club logo

resnet50_app's Introduction

Personal Tutorial on Deep Learning REST APIs (simple)

Description

I wanted to try out how to send an ML model to production. Turns out it is a bit more complicated, but this is how to run it on local machine. Still want to learn how to dockerize it all but okay this is a start.

This repository presents a method of taking a ML model and deploying it as an API, showing the easiest way to take an deep learning model to production. I also take advantage of Test Driven Development (TDD) by writing acceptance and developer tests throughout, which can be seen in testing/.

TDD

I started with the assumption that the Keras API was inherently well tested (thus out of the scope of our requirements) and that Flask was equally so, therefore the simple test cases found in tests.robot

  • Submit Photo
    • Send a Photo using a POST request
    • App receives Photo
    • Photo sent = photo received
  • Model correctly predicts sample photos
    • Model receives photo
    • Model makes prediction
    • Prediction = expected

which contain the high level keywords also in tests.robot

  • Supply Image
  • Detection

using the low level keywords written in TestLibrary.py

  • send_img
  • post_img
  • image_analysis

The results are then stored in the files log.html, output.xml, and report.html also located in testing/

API

The API consists of two actions (hence simple). One responds to the get request of the URL (in this case the host machine) and provides a basic form to uplaod a file for precition. The second action is a POST method that takes the uploaded file (upon the submit button being pressed) and returns a JSON (I said simple) response of the top 5 predictions from the network.

Note: The Model is not loaded every time a prediction is requested, instead I load the model upon the main execution of the file simple_keras_api_server.py right before the server is started.

The main focus of this API was to learn how to load a keras model efficiently, serve it using Flask, and make predictions returnable (JSON) to the client.

ResNet50

More can be read about RESNET here on the keras website.

Development Environment

The following python libraries are used: numpy, gevent, flask, pillow, keras, tensorflow, robotframework

Todo

  • COVID Model
    • Add ML assisted diagnosis of COVID from patient's lung xrays concept
    • Write tests for including it into the system
      • Training Model
      • Loading Model
      • Model receives/predicts xrays
  • Front-end revamp
  • Add separate report folder within testing/
  • Tests
    • What happens when no file is submitted
    • Too large of file
    • Not an Image on request

resnet50_app's People

Contributors

fusionby2030 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.