XCloud is an open-source AI platform which provides common AI services (computer vision, NLP, data mining and etc.) with RESTful APIs. The platform is developed and maintained by @LucasX based on Django and PyTorch.
- Computer Vision
- Face Analysis
- Face Comparison
- Facial Beauty Prediction (ShuffleNet V2 as backbone)
- Gender Recognition
- Race Recognition
- Age Estimation
- Facial Expression Recognition
- Face Retrieval
- Image Recognition
- Scene Recognition
- Food Recognition
- Flower Recognition
- Plant Disease Recognition
- Pet Insects Detection & Recognition
- Pornography Image Recognition
- Skin Disease Recognition
- Face Analysis
- NLP
- Text Similarity Comparison
- Sentiment Classification for douban.com
- News Classification
- Data Mining
- Zhihu Live Quality Evaluation
- Data Services
- Zhihu Live & Comments
- Major Hospital Information
- Primary and Secondary School on Baidu Baike
- Weather History
- Research
- Age Estimation
- Medical Image Analysis (Skin Lesion Analysis)
- Crowd Counting
- Intelligent Agriculture
- Content-based Image Retrieval
- Image Segmentation
- Image Dehazing
- Image Quality Assessment
- create a virtual enviroment named
pyWeb
follow this tutorial - install Django and PyTorch
- install all dependent libraries:
pip3 install -r requirements.txt
- activate Python Web environment:
source ~/pyWeb/bin/activate pyWeb
- start django server:
python3 manage.py runserver 0.0.0.0:8001
- open your browser and visit welcome page:
http://www.lucasx.top:8001/index
In order to construct a more efficient inference engine, it is highly recommended to use TensorRT. With the help of TensorRT, we are able to achieve 97.63 FPS on two 2080TI GPUs, which is significantly faster than its counterpart PyTorch model (29.45 FPS).
The installation is listed as follows:
- download installation package from NVIDIA official websites. I use
.tar.gz
in this project - add nvcc to you PATH:
export PATH=/usr/local/cuda/bin/nvcc:$PATH
- install pyCUDA:
pip3 install 'pycuda>=2017.1.1'
- unzip
.tar.gz
file, and modify your environment by adding:export LD_LIBRARY_PATH=/data/lucasxu/Software/TensorRT-5.1.5.0/lib:$LD_LIBRARY_PATH
- install TensorRT Python wheel:
pip3 install ~/Software/TensorRT-5.1.5.0/python/tensorrt-5.1.5.0-cp37-none-linux_x86_64.whl
- install torch2trt
- then you can use model_converter.py to convert a PyTorch model to TensorRT model
As suggested in Django doc, DO NOT USE THIS SERVER IN A PRODUCTION SETTING, it may bring you potential security risk and performance problems. Henceforth, you'd better upgrade Django built-in server to a stronger one, such as Nginx.
- install Gunicorn:
pip3 install gunicorn
- run your server (with multi threads support):
gunicorn XCloud.wsgi -b YOUR_MACHINE_IP:8001 --threads THREADS_NUM
- open your browser and visit welcome page:
http://YOUR_MACHINE_IP:8001/index
- install uWSGI:
pip3 install uwsgi
. Tryconda install -c conda-forge uwsgi
if you prefer Anaconda - start your uWSGI server:
uwsgi --http :8001 --chdir /data/lucasxu/Projects/XCloud -w XCloud.wsgi
- you can specify more configuration in uwsgi.ini, and start uWSGI by:
uwsgi --ini uwsgi.ini
- open your browser and visit welcome page:
http://YOUR_MACHINE_IP:8001/index
Note: this tutorial gives more details about Nginx and Django
- install Nginx:
sudo apt-get install nginx
- install uwsgi:
sudo pip3 install uwsgi
- start Nginx:
sudo /etc/init.d/nginx start
. Typeps -ef |grep -i nginx
to see whether Nginx has started successfully - open your browser and visit
YOUR_IP_ADDRESS:80
, if you see nginx welcome page, then you have installed Nginx successfully - modify XCloud_nginx.conf if needed, then copy XCloud_nginx.conf to
/etc/nginx/conf.d
directory - restart Nginx:
sudo /etc/init.d/nginx restart
In the near future, I will explore more methods in Machine Leanring in Production
fields, and share related articles on this repository or my blog.
For stress testing, please refer to API_TESTING_WITH_JMETER.md for more details!
- @LucasX: system/algorithm/deployment/report
- @reallinfo: logo design
- XCloud is free for researchers. For commercial use, please email me AT xulu0620@gmail.com for more details.
- Please ensure that your machine has a strong GPU equipment.
- For XCloud in Java, please refer to CVLH for more details!
- Technical details can be read from our Technical Report.
If you use our codebase or models in your research, please cite this project. We have released a Technical Report about this project.
@misc{xu2019xcloud,
author = {Lu Xu and Yating Wang},
title = {XCloud: Design and Implementation of AI Cloud Platform with RESTful API Service},
howpublished = {\url{https://github.com/lucasxlu/XCloud.git}},
year = {2019}
}