All Projects → kneron → host_lib

kneron / host_lib

Licence: other
This project contains python examples for the Kneron USB dongle

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to host lib

object-flaw-detector-cpp
Detect various irregularities of a product as it moves along a conveyor belt.
Stars: ✭ 19 (+26.67%)
Mutual labels:  edge-ai
motor-defect-detector-python
Predict performance issues with manufacturing equipment motors. Perform local or cloud analytics of the issues found, and then display the data on a user interface to determine when failures might arise.
Stars: ✭ 24 (+60%)
Mutual labels:  edge-ai
MaixPy3
MaixPy for Linux Python3, let's play with edge AI easier!
Stars: ✭ 125 (+733.33%)
Mutual labels:  edge-ai
smart-social-distancing
Social Distancing Detector using deep learning and capable to run on edge AI devices such as NVIDIA Jetson, Google Coral, and more.
Stars: ✭ 129 (+760%)
Mutual labels:  edge-ai
object-size-detector-python
Monitor mechanical bolts as they move down a conveyor belt. When a bolt of an irregular size is detected, this solution emits an alert.
Stars: ✭ 26 (+73.33%)
Mutual labels:  edge-ai
nn-Meter
A DNN inference latency prediction toolkit for accurately modeling and predicting the latency on diverse edge devices.
Stars: ✭ 211 (+1306.67%)
Mutual labels:  edge-ai
stlink-tool
Firmware uploader for ST-Link
Stars: ✭ 49 (+226.67%)
Mutual labels:  libusb
fastface
Light Face Detection using PyTorch Lightning
Stars: ✭ 71 (+373.33%)
Mutual labels:  edge-ai
libusb-win32
libusb-win32 project official github repo
Stars: ✭ 44 (+193.33%)
Mutual labels:  libusb
safety-gear-detector-python
Observe workers as they pass in front of a camera to determine if they have adequate safety protection.
Stars: ✭ 54 (+260%)
Mutual labels:  edge-ai
libmaix
A library and SDK for embeded AI model inference with hardware acceleration
Stars: ✭ 40 (+166.67%)
Mutual labels:  edge-ai
cabl
Controller ABstraction Layer
Stars: ✭ 111 (+640%)
Mutual labels:  libusb
asterisk-chan-dongle
chan_dongle channel driver for Huawei UMTS cards, works with Asterisk 14+
Stars: ✭ 233 (+1453.33%)
Mutual labels:  dongle
libusb
Go bindings for the C libusb library.
Stars: ✭ 74 (+393.33%)
Mutual labels:  libusb
concurrent-video-analytic-pipeline-optimization-sample-l
Create a concurrent video analysis pipeline featuring multistream face and human pose detection, vehicle attribute detection, and the ability to encode multiple videos to local storage in a single stream.
Stars: ✭ 39 (+160%)
Mutual labels:  edge-ai
training-mixed-precision-quantized-networks
This repository containts the pytorch scripts to train mixed-precision networks for microcontroller deployment, based on the memory contraints of the target device.
Stars: ✭ 43 (+186.67%)
Mutual labels:  edge-ai
g810-led-python
Old Linux led controller for the Logitech G810 Keyboard
Stars: ✭ 12 (-20%)
Mutual labels:  libusb
PS3Eye
Sony PS3Eye Java/Processing Library.
Stars: ✭ 16 (+6.67%)
Mutual labels:  libusb
awesome-edge-computing
A curated list of awesome edge computing, including Frameworks, Simulators, Tools, etc.
Stars: ✭ 149 (+893.33%)
Mutual labels:  edge-ai
awesome-edge-ai
A curated list of edge tools for AI applications
Stars: ✭ 38 (+153.33%)
Mutual labels:  edge-ai

Kneron Host Lib

This project contains python examples for Kneron USB dongle

This is a brief introduction. For more detailed documents, please visit http://doc.kneron.com/pythondocs.

Support KL520, KL720, other models are coming soon.

Install Host Lib Python Package

Prerequisites

General:

  • Python 3.8
    • Some system may have python 2.7 as their default python. In that case, you need to use replace 'python' with 'python3' , 'pip' with 'pip3' in the following examples.
  • opencv-python (Install using pip install opencv-python)
    • on raspberry pi, using pip3 install opencv-python==3.4.6.27 and if you have other version of opencv-python installed, please run pip3 uninstall opencv-pythonto uninstall them first
  • matplotlib and pillow (Install using pip install matplotlib)

Linux:

  • For Ubuntu, 18.04 is verified.
  • libusb (Ubuntu install using apt install libusb-1.0-0-dev)

Windows:

  • WinUSB (Install after plugging in the dongle and run Zadig)

  • MINGW64/MSYS or PowerShell

    • MSYS
        pacman -S python3-pip  # restart MSYS after installation
        pacman -S mingw-w64-x86_64-opencv
        pacman -S mingw-w64-x86_64-python-numpy
    • PowerShell: run as administrator

Mac OS:

  • Mac OS should be later than 10.15.6.
  • libusb (Install with Homebrew using brew install libusb)

Installation

Simply run the following command but replace the item within <> .

pip install python/packages/kdp_host_api-<version>_<os_version>_-py3-none-any.whl

os_version should be win, mac, Raspbian orlinux.

Please check the python/packages folder for the version available.

Extra steps for MSYS

python -m site # check sys.path
pip install -t <site-packages_relative_path_in_sys.path> python/packages/kdp_host_api-<version>_<os_version>_-py3-none-any.whl
#example: pip install -t /mingw64/lib/python3.8/site-packages python/packages/kdp_host_api-1.1.3_win_-py3-none-any.whl

Troubleshooting

If the the .whl can not be installed and reporting error File is not a zip file, please use git-lfs pull to fetch the pacakge.

Run examples

Getting started with help

  1. Please make sure you have installed the packages mentioned in the previous section.
  2. Plug in the dongle.
  3. Using command line tool and enter the python folder.
  4. Run python main.py -h

If all of the packages are installed correctly, you would get a message with available examples like the following:

Run Python examples by calling the Python APIs

optional arguments:
  -h, --help            show this help message and exit
  -t TASK_NAME, --task_name TASK_NAME
                        KL520-cam_dme_async_post_host_yolo
                        KL520-cam_dme_serial_post_host_ssd_fd
                        KL520-cam_dme_serial_post_host_tiny_yolov3_ssd_fd
                        KL520-cam_dme_serial_post_host_yolo
                        KL520-cam_dme_serial_ssd_fd
                        KL520-cam_isi_async_parallel_post_host_yolo
                        KL520-cam_isi_async_parallel_yolo
                        KL520-cam_isi_async_ssd_fd
                        KL520-cam_isi_async_yolo
                        KL520-cam_isi_serial_yolo
                        KL520-dme_async_pre_post_host_classification
                        KL520-dme_async_pre_post_host_fcos
                        KL520-dme_keras
                        KL520-get_crc
                        KL520-get_kn_num
                        KL520-get_model_info
                        KL520-get_nef_model_metadata
                        KL520-soft_reset
                        KL520-update_app_nef_model
                        KL520-update_fw
                        KL720-cam_isi_post_host_yolov3_ssd_fd
                        KL720-cam_isi_pre_post_host_fcos
                        KL720-get_kn_num
                        KL720-get_model_info
                        KL720-get_nef_model_metadata
                        KL720-isi_load_model
                        KL720-isi_pre_post_host_classification
                        KL720-soft_reset
                        KL720-update_app_nef_model
                        KL720-update_fw
                        KL720-yolo_public_example
  -p [PARAM_LIST [PARAM_LIST ...]], --param_list [PARAM_LIST [PARAM_LIST ...]]
                        Any input params to pass to the test you run

Run Examples

520 version

There are two kinds of examples, need update_app_nef_model and don't need extra steps.

If this is the first time you are using a KL520 dongle, please run KL520-update_app_nef_model to update the firmware and nef model. Just follow the steps below to update tiny_yolo_v3 into the dongle and update the firmware and nef model.

  1. Copy all files under input_models/KL520/tiny_yolo_v3 and app_binaries/KL520/tiny_yolo_v3 into app_binaries/KL520/ota/ready_to_load.
  2. Enter python directory.
  3. Run python main.py -t KL520-update_app_nef_model (This step may take some time).

If you have errors related to adding device failure, please check your permission. If on Linux, please try using sudo.

Examples need update_app_nef_model

Most examples need extra steps to upload the model file into the dongle. You can find the model files under input_models/KL520. Here is a table of the relationship between models and examples:

Example Model and Firmware
KL520-cam_dme_serial_ssd_fd ssd_fd_lm
KL520-cam_isi_async_ssd_fd ssd_fd_lm
KL520-cam_isi_serial_yolo tiny_yolo_v3
KL520-cam_isi_async_yolo tiny_yolo_v3
KL520-cam_isi_async_parallel_yolo tiny_yolo_v3
KL520-cam_isi_async_parallel_post_host_yolo tiny_yolo_v3

Here are the steps you need to update the dongle and run the example. Let's take KL520-cam_isi_async_yolo as the example.

  1. From the chart, we know we need to use model and firmware of tiny_yolo_v3.
  2. Copy all files under input_models/KL520/tiny_yolo_v3 and app_binaries/KL520/tiny_yolo_v3 into app_binaries/KL520/ota/ready_to_load.
  3. Enter python directory.
  4. Run python main.py -t KL520-update_app_nef_model (This step may take some time).
  5. Run python main.py -t KL520-cam_isi_async_yolo.

Now, you can get a window pop up and running your test. Congratulations!

To stop the test and quit, just press q when focusing on the command line.

No Extra Step Example

Let's try the example do not need extra steps: KL520-dme_keras.

You just need to run the command python main.py -t KL520-dme_keras with your dongle plugged in. Then, you can get the output without any error message.

$ python main.py -t KL520-dme_keras
adding devices....

start kdp host lib....

Task:  KL520-dme_keras
loading models to Kneron Device: 
starting DME mode ...

DME mode succeeded...

Model loading successful
starting DME configure ...

DME configure model [18] succeeded...

./data/images/cat.jpg
281 0.5517006780734921
282 0.23251050988507144
285 0.12161772961601827
./data/images/fox.jpg
277 0.8187506998369483
278 0.0760648702786444
272 0.02318463970950107
de init kdp host lib....

720 version

If this is the first time you are using a KL720 dongle, please run KL720-update_fw to update the firmware.

  1. Copy all files under app_binaries/KL720/solution_companion into app_binaries/KL720/dfu/ready_to_load.
  2. Enter python directory.
  3. Run python main.py -t KL720-update_fw (This step may take some time).

If you have errors related to adding device failure, please check your permission. If on Linux, please try using sudo.

Run Examples

Here are the steps you need to run the example. Let's take KL720-cam_isi_pre_post_host_fcos as the example.

  1. Enter python directory.
  2. Run python main.py -t KL720-cam_isi_pre_post_host_fcos.

Now, you can get a window pop up and running your test. Congratulations!

To stop the test and quit, just press q when focusing on the command line.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].