Deep Learning as a Cloud API Service.

Overview

Deep API

Deep Learning as Cloud APIs.

This project provides pre-trained deep learning models as a cloud API service. A web interface is available as well.

Quick Start

Python 3:

$ pip3 install -r requirements.txt
$ python main.py

Anaconda:

$ conda env create -f environment.yml
$ conda activate cloudapi
$ python main.py

Using Docker:

docker run -p 8080:8080 wuhanstudio/deep-api

Navigate to https://localhost:8080

API Client

It's possible to get predictions by sending a POST request to http://127.0.0.1:8080/vgg16_cifar10.

Using curl:

```
export IMAGE_FILE=test/cat.jpg
(echo -n '{"file": "'; base64 $IMAGE_FILE; echo '"}') | \
curl -H "Content-Type: application/json" \
     -d @- http://127.0.0.1:8080/vgg16_cifar10
```

Using Python:

def classification(url, file):
    # Load the input image and construct the payload for the request
    image = Image.open(file)
    buff = BytesIO()
    image.save(buff, format="JPEG")

    data = {'file': base64.b64encode(buff.getvalue()).decode("utf-8")}
    return requests.post(url, json=data).json()

res = classification('http://127.0.0.1:8080/vgg', 'cat.jpg')

This python script is available in the test folder. You should see prediction results by running python3 minimal.py:

cat            0.99804
deer           0.00156
truck          0.00012
airplane       0.00010
dog            0.00009
bird           0.00005
ship           0.00003
frog           0.00001
horse          0.00001
automobile     0.00001

Concurrent clients

Sending 5 concurrent requests to the api server:

$ python3 multi-client.py --num_workers 5 cat.jpg

You should see the result:

----- start -----
Sending requests
Sending requests
Sending requests
Sending requests
Sending requests
------ end ------
Concurrent Requests: 5
Total Runtime: 2.441638708114624

Full APIs

Post URLs:

Model Dataset Post URL
VGG-16 Cifar10 http://127.0.0.1:8080/vgg16_cifar10
VGG-16 ImageNet http://127.0.0.1:8080/vgg16
Resnet-50 ImageNet http://127.0.0.1:8080/resnet50
Inception v3 ImageNet http://127.0.0.1:8080/inceptionv3

Post Data (JSON):

{
  "file": ""
}

Query Parameters:

Name Type Default Value
top integer 10 One of [1, 3, 5, 10], top=5 returns top 5 predictions.
no-prob integer 0 no-prob=1 returns labels without probabilities. no-prob=0 returns labels and probabilities.

Example post urls (returns top 10 predictions with probabilities):

http://127.0.0.1:8080/vgg16?top=10&no-prob=0

Returns (JSON):

Key Value
success True / False
Predictions Array of prediction results, each element contains {"labels": "cat", "probability": 0.99}
error The error message if any

Example returned json:

{
  "success": true,
  "predictions": [
    {
      "label": "cat",
      "probability": 0.9996376037597656
    },
    {
      "label": "dog",
      "probability": 0.0002855948405340314
    },
    {
      "label": "deer",
      "probability": 0.000021985460989526473
    },
    {
      "label": "bird",
      "probability": 0.000021391952031990513
    },
    {
      "label": "horse",
      "probability": 0.000013297495570441242
    },
    {
      "label": "airplane",
      "probability": 0.000006046993803465739
    },
    {
      "label": "ship",
      "probability": 0.0000044226785576029215
    },
    {
      "label": "frog",
      "probability": 0.0000036349929359857924
    },
    {
      "label": "truck",
      "probability": 0.0000035354278224986047
    },
    {
      "label": "automobile",
      "probability": 0.000002384880417594104
    }
  ],
}

References

You might also like...
 Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution
Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution

Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution Figure: Example visualization of the method and baseline as a

A simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)
A simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

this is a simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

Pytorch implementation of Straight Sampling Network For Point Cloud Learning (ICIP2021).

Pytorch code for SS-Net This is a pytorch implementation of Straight Sampling Network For Point Cloud Learning (ICIP2021). Environment Code is tested

Deploy a ML inference service on a budget in less than 10 lines of code.
Deploy a ML inference service on a budget in less than 10 lines of code.

BudgetML is perfect for practitioners who would like to quickly deploy their models to an endpoint, but not waste a lot of time, money, and effort trying to figure out how to do this end-to-end.

An air quality monitoring service with a Raspberry Pi and a SDS011 sensor.

Raspberry Pi Air Quality Monitor A simple air quality monitoring service for the Raspberry Pi. Installation Clone the repository and run the following

Web service for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation based on OpenFace 2.0
Web service for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation based on OpenFace 2.0

OpenGaze: Web Service for OpenFace Facial Behaviour Analysis Toolkit Overview OpenFace is a fantastic tool intended for computer vision and machine le

Space-event-trace - Tracing service for spaceteam events
Space-event-trace - Tracing service for spaceteam events

space-event-trace Tracing service for TU Wien Spaceteam events. This service is

Black-Box-Tuning - Black-Box Tuning for Language-Model-as-a-Service

Black-Box-Tuning Source code for paper "Black-Box Tuning for Language-Model-as-a

PyTorch implementation of the Deep SLDA method from our CVPRW-2020 paper
PyTorch implementation of the Deep SLDA method from our CVPRW-2020 paper "Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis"

Lifelong Machine Learning with Deep Streaming Linear Discriminant Analysis This is a PyTorch implementation of the Deep Streaming Linear Discriminant

Releases(v0.1.0)
  • v0.1.0(Oct 26, 2021)

    Deep Learning as a Cloud API Service that supports:

    • Pretrained VGG16 model on Cifar10 dataset
    • Pretrained VGG16 model on ImageNet dataset
    • Pretrained Resnet50 model on ImageNet dataset
    • Pretrained Inceptionv3 model on ImageNet dataset
    • Automatic python client code generation
    • Automatic curl client code generation
    • A web interface for the api service

    A minimal version is deployed here:

    http://api.wuhanstudio.uk/

    Source code(tar.gz)
    Source code(zip)
Owner
Wu Han
Ph.D. Student at the University of Exeter in the U.K. for Autonomous System Security. Prior research experience at RT-Thread, LAIX, Xilinx.
Wu Han
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

null 153 Dec 14, 2022
Deep Compression for Dense Point Cloud Maps.

DEPOCO This repository implements the algorithms described in our paper Deep Compression for Dense Point Cloud Maps. How to get started (using Docker)

Photogrammetry & Robotics Bonn 67 Dec 6, 2022
GndNet: Fast ground plane estimation and point cloud segmentation for autonomous vehicles using deep neural networks.

GndNet: Fast Ground plane Estimation and Point Cloud Segmentation for Autonomous Vehicles. Authors: Anshul Paigwar, Ozgur Erkent, David Sierra Gonzale

Anshul Paigwar 114 Dec 29, 2022
PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place Recognition, CVPR 2018

PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place Recognition PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place

Mikaela Uy 294 Dec 12, 2022
Efficient training of deep recommenders on cloud.

HybridBackend Introduction HybridBackend is a training framework for deep recommenders which bridges the gap between evolving cloud infrastructure and

Alibaba 111 Dec 23, 2022
Ivy is a templated deep learning framework which maximizes the portability of deep learning codebases.

Ivy is a templated deep learning framework which maximizes the portability of deep learning codebases. Ivy wraps the functional APIs of existing frameworks. Framework-agnostic functions, libraries and layers can then be written using Ivy, with simultaneous support for all frameworks. Ivy currently supports Jax, TensorFlow, PyTorch, MXNet and Numpy. Check out the docs for more info!

Ivy 8.2k Jan 2, 2023
Deep learning (neural network) based remote photoplethysmography: how to extract pulse signal from video using deep learning tools

Deep-rPPG: Camera-based pulse estimation using deep learning tools Deep learning (neural network) based remote photoplethysmography: how to extract pu

Terbe Dániel 138 Dec 17, 2022
deep-table implements various state-of-the-art deep learning and self-supervised learning algorithms for tabular data using PyTorch.

deep-table implements various state-of-the-art deep learning and self-supervised learning algorithms for tabular data using PyTorch.

null 63 Oct 17, 2022
Time-series-deep-learning - Developing Deep learning LSTM, BiLSTM models, and NeuralProphet for multi-step time-series forecasting of stock price.

Stock Price Prediction Using Deep Learning Univariate Time Series Predicting stock price using historical data of a company using Neural networks for

Abdultawwab Safarji 7 Nov 27, 2022
FTIR-Deep Learning - FTIR Deep Learning With Python

CANDIY-spectrum Human analyis of chemical spectra such as Mass Spectra (MS), Inf

Wei Mei 1 Jan 3, 2022