DeepStackPython
Official Python SDK for DeepStack
DeepStack
(DeepStack)[https://deepstack.cc] is an AI server that allows deploying object detection, face detection, face recognition, image enhance, scene recognition and detection of custom objects on the edge and in production servers. DeepStack Runs on Docker, Windows, Linux, Mac and Nvidia Jetson devices. And it is entirely free and Open Source
The DeepStack Python SDK makes it easy to perform all of the above awesome AI magic on Images and Videos in few lines of code, Just Install DeepStack and the Python SDK and you are good to go!
Installation Instructions
Install DeepStack on Windows
You can install DeepStack via docker on windows, note that this does not support GPU acceleration
docker pull deepquestai/deepstack:cpu-2021.02.1
You can also install the Native Windows Version of DeepStack, this supports GPU acceleration
CPU Version
Download and run DeepStack CPU Installer
GPU Version
- Download and Install CUDA 10.1 from here https://developer.nvidia.com/cuda-10.1-download-archive-base
- Download and install Cudnn from here https://developer.nvidia.com/cudnn'
- Download and run DeepStack GPU Installer
Install DeepStack on Linux
Linux Support is via Docker, hence you must install docker first
sudo apt-get update && sudo apt-get install docker.io
CPU Version
sudo docker pull deepquestai/deepstack:cpu-2021.02.1
GPU Version
sudo docker pull deepquestai/deepstack:gpu-2021.02.1
Install DeepStack on MacOS
MacOS support is via Docker, install docker on Mac and run
sudo docker pull deepquestai/deepstack:cpu-2020.02.1
Note that GPU acceleration is not available for Mac at the moment
Install DeepStack on Nvidia Jetson
sudo docker pull deepquestai/deepstack:jetpack-2021.02.1
Install DeepStack Python SDK
pip3 install deepstack-sdk
Examples
Object Detection
-
Run DeepStack Object Detection API
-
Docker CPU:
docker run -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack
-
Docker GPU:
sudo docker run --gpus all -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu
-
Windows CPU & GPU:
deepstack --VISION-DETECTION True --PORT 80
-
NVIDIA Jetson:
sudo docker run --runtime nvidia -e VISION-DETECTION=True -p 80:5000 deepquestai/deepstack:jetpack
-
-
Sample code
from deepstack_sdk import ServerConfig, Detection config = ServerConfig("http://localhost:80") detection = Detection(config) response = detection.detectObject("detection.jpg",output="detection_output.jpg", draw_bounding_box=True,show_label=True,show_conf=True) for obj in response: print("Name: {}, Confidence: {}".format(obj.label, obj.confidence))
Result
- Find more code samples in examples folder of this repository.
Face
-
Run DeepStack Face API
-
Docker CPU:
docker run -e VISION-FACE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack
-
Docker GPU:
sudo docker run --gpus all -e VISION-FACE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu
-
Windows CPU & GPU:
deepstack --VISION-FACE True --PORT 80
-
NVIDIA Jetson:
sudo docker run --runtime nvidia -e VISION-FACE=True -p 80:5000 deepquestai/deepstack:jetpack
-
-
Sample code: Face Detection
from deepstack_sdk import ServerConfig, Face config = ServerConfig("http://localhost:80") face = Face(config) response = face.detectFace("got.jpg",output="got_detected.jpg") for obj in response: print("Face Detected, Confidence: {}".format(obj.confidence))
-
Sample code: Face Recognition
from deepstack_sdk import ServerConfig, Face config = ServerConfig("http://localhost:80") face = Face(config) images = ["thanos.jpg"] response = face.registerFace(images=images,userid="Thanos") print(response)
from deepstack_sdk import ServerConfig, Face config = ServerConfig("http://localhost:80") face = Face(config) response = face.recognizeFace(image=r"thanos2.jpg", output="face_recognized.jpg",draw_bounding_box=True,show_label=True,show_conf=True) print(response)
Enhance (4X)
-
Run DeepStack Enhance API
-
Docker CPU:
docker run -e VISION-ENHANCE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack
-
Docker GPU:
sudo docker run --gpus all -e VISION-ENHANCE=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack:gpu
-
Windows CPU & GPU:
deepstack --VISION-ENHANCE True --PORT 80
-
NVIDIA Jetson:
sudo docker run --runtime nvidia -e VISION-ENHANCE=True -p 80:5000 deepquestai/deepstack:jetpack
-
-
Sample code
Input Image dimension (Width: 460px, Height :259px)
from deepstack_sdk import ServerConfig, Enhance config = ServerConfig("http://localhost:80") enhance = Enhance(config) response = enhance.enhanceObject("supermarket.jpg", output="supermarket_4X.jpg") for obj in response: print("Base64: {}, width: {}, height: {}".format(obj.base64, obj.width, obj.height))
Output Image dimension (Width: 1840px, Height : 1036px)
- Find more code samples in examples folder of this repository.