Deploy AI Systems Yourself (DAISY) Kit. DaisyKit Python is the wrapper of DaisyKit SDK, an AI framework focusing on the ease of deployment.
Project description
DaisyKit Python
https://pypi.org/project/daisykit/
Deploy AI Systems Yourself (DAISY) Kit. DaisyKit Python is the wrapper of DaisyKit SDK, an AI framework focusing on the ease of deployment. At present, this package only has prebuilt distribution for Windows - Python 3. For other platform, you need to compile from source.
How to install ?
For Windows:
pip3 install daisykit
For Ubuntu:
- Install dependencies
sudo apt install pybind11-dev # Pybind11 - For Python/C++ Wrapper
sudo apt install libopencv-dev # For OpenCV
sudo apt install libvulkan-dev # Optional - For GPU support
- Install DaisyKit (compile from source)
pip3 install --upgrade pip # Ensure pip is updated
pip3 install daisykit
For other platforms:
-
Install OpenCV, Pybind11 and Vulkan development package (if you want GPu support)
-
Install DaisyKit (compile from source)
pip3 install --upgrade pip # Ensure pip is updated
pip3 install daisykit
Examples
Object detection:
import cv2
import json
from daisykit.utils import get_asset_file, to_py_type
from daisykit import ObjectDetectorFlow
config = {
"object_detection_model": {
"model": get_asset_file("models/object_detection/yolox-tiny.param"),
"weights": get_asset_file("models/object_detection/yolox-tiny.bin"),
"input_width": 416,
"input_height": 416,
"score_threshold": 0.5,
"iou_threshold": 0.65,
"use_gpu": False,
"class_names": [
"person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic light",
"fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
"elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
"skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard",
"tennis racket", "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple",
"sandwich", "orange", "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch",
"potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell phone",
"microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear",
"hair drier", "toothbrush"
]
}
}
flow = ObjectDetectorFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
poses = flow.Process(frame)
flow.DrawResult(frame, poses)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Convert poses to Python list of dict
poses = to_py_type(poses)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Face Detection with mask recognition:
import cv2
import json
from daisykit.utils import get_asset_file, to_py_type
import daisykit
config = {
"face_detection_model": {
"model": get_asset_file("models/face_detection/yolo_fastest_with_mask/yolo-fastest-opt.param"),
"weights": get_asset_file("models/face_detection/yolo_fastest_with_mask/yolo-fastest-opt.bin"),
"input_width": 320,
"input_height": 320,
"score_threshold": 0.7,
"iou_threshold": 0.5,
"use_gpu": False
},
"with_landmark": True,
"facial_landmark_model": {
"model": get_asset_file("models/facial_landmark/pfld-sim.param"),
"weights": get_asset_file("models/facial_landmark/pfld-sim.bin"),
"input_width": 112,
"input_height": 112,
"use_gpu": False
}
}
face_detector_flow = daisykit.FaceDetectorFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
faces = face_detector_flow.Process(frame)
# for face in faces:
# print([face.x, face.y, face.w, face.h,
# face.confidence, face.wearing_mask_prob])
face_detector_flow.DrawResult(frame, faces)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Convert faces to Python list of dict
faces = to_py_type(faces)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Background Matting:
import cv2
import json
from daisykit.utils import get_asset_file
from daisykit import BackgroundMattingFlow
config = {
"background_matting_model": {
"model": get_asset_file("models/background_matting/erd/erdnet.param"),
"weights": get_asset_file("models/background_matting/erd/erdnet.bin"),
"input_width": 256,
"input_height": 256,
"use_gpu": False
}
}
# Load background
default_bg_file = get_asset_file("images/background.jpg")
background = cv2.imread(default_bg_file)
background = cv2.cvtColor(background, cv2.COLOR_BGR2RGB)
background_matting_flow = BackgroundMattingFlow(json.dumps(config), background)
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
mask = background_matting_flow.Process(frame)
background_matting_flow.DrawResult(frame, mask)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Human Pose Detection:
import cv2
import json
from daisykit.utils import get_asset_file, to_py_type
from daisykit import HumanPoseMoveNetFlow
config = {
"person_detection_model": {
"model": get_asset_file("models/human_detection/ssd_mobilenetv2.param"),
"weights": get_asset_file("models/human_detection/ssd_mobilenetv2.bin"),
"input_width": 320,
"input_height": 320,
"use_gpu": False
},
"human_pose_model": {
"model": get_asset_file("models/human_pose_detection/movenet/lightning.param"),
"weights": get_asset_file("models/human_pose_detection/movenet/lightning.bin"),
"input_width": 192,
"input_height": 192,
"use_gpu": False
}
}
human_pose_flow = HumanPoseMoveNetFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
poses = human_pose_flow.Process(frame)
human_pose_flow.DrawResult(frame, poses)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Convert poses to Python list of dict
poses = to_py_type(poses)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Barcode Detection:
import cv2
import json
from daisykit.utils import get_asset_file
from daisykit import BarcodeScannerFlow
config = {
"try_harder": True,
"try_rotate": True
}
barcode_scanner_flow = BarcodeScannerFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
result = barcode_scanner_flow.Process(frame, draw=True)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Hand Pose Detection:
import cv2
import json
from daisykit.utils import get_asset_file, to_py_type
from daisykit import HandPoseDetectorFlow
config = {
"hand_detection_model": {
"model": get_asset_file("models/hand_pose/yolox_hand_swish.param"),
"weights": get_asset_file("models/hand_pose/yolox_hand_swish.bin"),
"input_width": 256,
"input_height": 256,
"score_threshold": 0.45,
"iou_threshold": 0.65,
"use_gpu": False
},
"hand_pose_model": {
"model": get_asset_file("models/hand_pose/hand_lite-op.param"),
"weights": get_asset_file("models/hand_pose/hand_lite-op.bin"),
"input_size": 224,
"use_gpu": False
}
}
flow = HandPoseDetectorFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the video frame
ret, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
poses = flow.Process(frame)
flow.DrawResult(frame, poses)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# Convert poses to Python list of dict
poses = to_py_type(poses)
# Display the resulting frame
cv2.imshow('frame', frame)
# The 'q' button is set as the
# quitting button you may use any
# desired button of your choice
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()
Bug report
Please open an issue on our official repository if you find any error.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file daisykit-0.1.20211119.tar.gz
.
File metadata
- Download URL: daisykit-0.1.20211119.tar.gz
- Upload date:
- Size: 15.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b8f09931419aa259dd38d8b662e05d414776599e2f76514583c94a4d31ad299 |
|
MD5 | 3a23234ff297d874ef6e43a0d8b741ba |
|
BLAKE2b-256 | 58908eda6345976757af008231cf4e2b1bd23fd58dbd16396b140b066ba4607d |
File details
Details for the file daisykit-0.1.20211119-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1503c388d941613a7b136003b456929db4cbfa3ba0afb8e4d3c3e0815d5daeb |
|
MD5 | f277e1869575d28e5d0c25cce40a0b27 |
|
BLAKE2b-256 | 947a19c4647718b7dd31db5e2102315ea457c5cbc67e67e19daeb4c5d972025b |
File details
Details for the file daisykit-0.1.20211119-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 433e20cf938d9a1e1382484843d60324e40086e1fd205a85ef174a235cbcbd41 |
|
MD5 | a4fc13bf22d33ec1d57f7e31ae07cf29 |
|
BLAKE2b-256 | 646eeef364a7fc311dca7e1b16eb13193d2be15bbac6b6f45f59056a228161fd |
File details
Details for the file daisykit-0.1.20211119-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a6beabf66674809340c685850ad4463003ac5e6c1ec13f7ddda21098931e486 |
|
MD5 | f705d1524dbc1455a4a75b855615711e |
|
BLAKE2b-256 | 3aeb2310b1efd730ceb1799815923b4fb3847544dd7e39fa6bfaf71a6f549e5c |
File details
Details for the file daisykit-0.1.20211119-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 245a3493aacdd922f3c376567b108d38c4b378509a6a3458a4b5a7070f640601 |
|
MD5 | aa27711691fcff18acf287bae96901fd |
|
BLAKE2b-256 | 7a8ef8ab2c8bd83f2cd621ecd741509f3aac3ac322d8757f3106682758712fbd |
File details
Details for the file daisykit-0.1.20211119-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 47.9 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96bf5a57bc0837b486cdb59dcad17f8e9fc49dce95a47e8e095d02e4b504ccfa |
|
MD5 | 1187385e1fb5a8fca69edad1d7b65227 |
|
BLAKE2b-256 | 458f8b0f63f1740782fc0ba41b2398378c1d5fac7851593f657264a51cc5b024 |
File details
Details for the file daisykit-0.1.20211119-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b521ddc3dcb7c4bce395cc53cde97dbf2d61976db28078245fcd79d56fce6d4 |
|
MD5 | f0649ca215986742f82055489b398e44 |
|
BLAKE2b-256 | b8b5d273969f422d8edc4f31d2b7ce5c2edfc0e5793a5e7daec6b7100b0a15cc |
File details
Details for the file daisykit-0.1.20211119-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: daisykit-0.1.20211119-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 24.0 MB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc0be431035da0e54718e8ebed6fa35e6ae74bc9902aec92b562778a5372cd1 |
|
MD5 | ef44c6ded8e3926ec995de825dd8f3b3 |
|
BLAKE2b-256 | c0e7f6f65f5dc1cc4085f94bb47820a7e01c40607e03a26526d4d4148a8297e1 |