hailo-inference/cpp_inference/readme.md
2022-03-31 11:10:10 +02:00

2.8 KiB

YOLOV5 Age Gender Model Demo

This example demonstrates basic usage of HailoRT streaming API over multiple networks, using vstreams. It loads a folder of images and tries to detect faces in them. Once it found a face it will switch to a different model that will do age and gender recognition.

Setup on Ubuntu 20.04

OpenCV

To install OpenCV run:

sudo apt install libopencv-dev python3-opencv

To verify the installation run:

python3 -c "import cv2; print(cv2.__version__)"

Hailo-8

Confirm the Hailo-8 PCIe Module has been detected

sudo update-pciids
lspci
04:00.0 Co-processor: Hailo Technologies Ltd. Hailo-8 AI Processor (rev 01)

HailoRT

Install HailoRT available from https://hailo.ai/developer-zone/ and confirm the driver is working.

Enter virtual environment

source hailo_platform_venv/bin/activate

Check Hailo firmware

hailo fw-control identify
(hailo) Running command 'fw-control' with 'hailortcli'
Identifying board
Control Protocol Version: 2
Firmware Version: 4.4.0 (release,app)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8_B0
Serial Number: HAILO00000000000
Part Number: HM218B1C2FA
Product Name: HAILO-8 AI ACCELERATOR M.2 M KEY MODULE

Building the demo

Modify the following line in build.sh to fit your HailoRT installation.

HAILORT_ROOT=~/HailoRT_v4.4.0/Hailort/Linux/Installer/platform/hailort

Build the demo

./build.sh

After building the hailo_demo, the script will copy the two HEF files and the images directory into the build folder. Run the demo.

cd build
./hailo_demo.sh
-I- Running network. Input frame size: 1228800
-I- YoloV5 ran successfully.
-I- Detections before NMS: 100.
-I- Detections after NMS: 9.
Class ID: 3.000000)
Face 0 at (68.490112, 61.253448), (180.168640, 208.362183)
Class ID: 3.000000)
Face 1 at (268.007507, 64.514343), (375.192413, 202.842468)
Class ID: 3.000000)
Face 2 at (449.910217, 62.940426), (556.207397, 204.165405)
Class ID: 3.000000)
Face 3 at (75.827576, 257.073730), (180.360580, 398.298706)
Class ID: 3.000000)
Face 4 at (258.935303, 256.697327), (369.707764, 397.922302)
Class ID: 3.000000)
Face 5 at (456.254761, 257.156647), (567.933289, 408.756989)
Class ID: 3.000000)
Face 6 at (74.192513, 450.853729), (180.489777, 593.538330)
Class ID: 3.000000)
Face 7 at (256.249298, 451.983093), (366.119324, 594.667725)
Class ID: 3.000000)
Face 8 at (455.748230, 451.876953), (561.161499, 596.028809)
-I- Running network. Input frame size: 150528
-I- HSE ran successfully.
Face 0:
	Male - 26
Face 1:
	Female - 23
Face 2:
	Female - 23
Face 3:
	Male - 27
Face 4:
	Female - 29
Face 5:
	Male - 29
Face 6:
	Female - 23
Face 7:
	Female - 29
Face 8:
	Female - 27