Skip to content
A Keras deep learning image classifiers on Django server with REST API
JavaScript HTML CSS Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

AI Image classifiers on Django server with REST API

python3.5 python3.6 django2.1.5 Build Status


A Keras deep learning image classifiers on Django server with REST API. It can help you quickly deploy and apply ML models.


Machine Learning (ML) models are typically trained and test on benchmark data sets. However, such data sets may not represent the data in real applications. These ML models should be updated after tested on real data sets. Deployment of the models after each update may be time consuming. Therefore, automated deployment is needed to save time and effort. In this proposal, we describe our solution to integrate trained ML models into any application of interest. We use Django web-based platform to build REST API for model deployment. Jenkins is used for continuous integration and automated deployment of ML models into Django servers.


  • Add Account management funtion
  • Add Login & Signup
  • Add Django Rest Framework
  • Optimize front-end interface, adapt to mobile and PC interface
  • Design front-end and back-end interactive interfaces
  • Add feature: Face comparison
  • Add feature: Bank card identification
  • Add feature: Gesture identification
  • Add feature: Image classify using following model:
    • ResNet50
    • Xception
    • MobileNet, MobileNetV2
    • InceptionV3, InceptionResNetV2
    • DenseNet121, DenseNet169, DenseNet201
    • VGG16, VGG19
    • NASNetMobile, NASNetLarge
  • Run each part of functions seperately in local and cloud server
  • Run all the functions in local server and cloud server
  • Design and using machine learning CI/CD Tools such as Git, Jenkins, Nginx, uwgsi for deployment.




pip3 install -r requirements.txt


I assume you already have your own local virtual environment.

git clone
pip install -r requirements.txt
python makemigrations
python migrate
python runserver

Access the web page though this link:

Name Description
Face comparison Extract and analyze facial features in pictures
Bank card identification Identify the field information above the bank card
Gesture identification Detect and return the meaning of the gesture in the picture.
Image classify Detects objects in the image, returns the detected object name, and the corresponding confidence.

Web API for image classify

Name Input Size API address
ResNet50 224x224
Xception 299x299
MobileNet 224x224
MobileNetV2 224x224
InceptionV3 299x299
InceptionResNetV2 224x224
DenseNet121 224x224
DenseNet169 224x224
DenseNet201 224x224
VGG16 224x224
VGG19 224x224
NASNetLarge 331x331
NASNetMobile 224x224


Parameter Type Description
image file Image file that you want to classify.
top text
(optional, default=6)
Return top-k categories of the results. Must me string in integer format.

Note: You can not send a very large size image.


Parameter Type Description
success bool Whether classification was sucessfuly or not
predictions label, float pair of label and it's probability

Accuracy for individual models

Model Accuracy Top-6 Accuracy
Xception 0.780 0.955
VGG16 0.722 0.914
VGG19 0.723 0.910
ResNet50 0.748 0.931
InceptionV3 0.789 0.948
InceptionResNetV2 0.813 0.963
MobileNet 0.714 0.904
MobileNetV2 0.723 0.912
DenseNet121 0.761 0.934
DenseNet169 0.772 0.952
DenseNet201 0.783 0.945
NASNetMobile 0.752 0.920
NASNetLarge 0.837 0.959


Using Postman to test the API:


    "success": true,
    "predictions": [
            "label": "red_fox",
            "probability": 0.8969062566757202
            "label": "kit_fox",
            "probability": 0.08841043710708618
            "label": "grey_fox",
            "probability": 0.012036639265716076
            "label": "Arctic_fox",
            "probability": 0.0022438077721744776
            "label": "coyote",
            "probability": 0.0002566342300269753
            "label": "white_wolf",
            "probability": 0.00005685776341124438


The codes are tested using Travis-CI platform with django 2.1.x and Python 3.5, 3.6


If you have questions or issues, please feel free to tell us.


Welcome to make pull request. If you have a related project/component/tool, add it with a pull request to add it!


Admin Account

python createsuperuser

username: ranxiaolang
email: YOUR EMAIL  
password: ranxiaolang  

Access the web page though this link:

Django Restframework

Access the web page though this link:



This software is licensed under the MIT License. For more information, read the file LICENSE.

You can’t perform that action at this time.