he Hailo software suite comprises of 4 components: the Dataflow compiler (DFC), Hailo-RT, Hailo Model Zoo and Tappas.
Hailo’s Dataflow compiler (DFC) was designed to run on a Linux Ubuntu x86 based system. However since Windows 10/11 offers WSL2, this makes running the DFC possible on a Windows x86 machine.
The Hailo-RT library implements the communication between the host and the Hailo device for inference: this library must be installed separately on the host of the inference machine, which can be x86, ARM based system. In case of Hailo-RT, the OS of the inference host can be Linux or Windows because both a Linux and Windows version of Hailo-RT are provided. This is to contrast with the DFC, for which only a python wheel for Linux is provided. Moreover, the windows version of the Hailo-RT library is installed through a Windows MSI installer and does not need WSL2. In case you wish to do both model building and inferencing on the same Window machine, you will need both the DFC tool and Hailo-RT installed on it. Then keep in mind that the DFC must be used through WSL2 terminal and Hailo-RT must be used through a Windows command prompt. If you use a Linux machine for both model build and inference, this separation doesn’t exist since both DFC and Hailo-RT can be installed on Linux.
The Hailo Model Zoo is available on GitHub: GitHub - hailo-ai/hailo_model_zoo: The Hailo Model Zoo includes pre-trained models and a full building and evaluation environment and can be installed inside the virtual environment of the DFC. For installation instructions, see GitHub - hailo-ai/hailo_model_zoo: The Hailo Model Zoo includes pre-trained models and a full building and evaluation environment . Note that only the ‘hailo’ commands of the DFC that don’t invoke the Hailo-RT for inference are functional through WSL2.
The last component called Tappas is not compatible with WSL because it implements inference applications that rely on Hailo-RT. Since there isn’t currently any Windows version of Tappas, it must be installed on a system that runs Linux natively.
The remaining of the document covers the installation of the DFC python wheel package in WSL2.
WSL2 installation
To install WSL2, follow the instructions from: Install WSL | Microsoft Docs
It will take a few minutes to install WSL2 and it will ask you to reboot.
After rebooting, it will finish the installation and ask you to create a username and password.
After login, run
sudo apt-get update
sudo apt-get upgrade
The DFC can make use of GPU to speed up the execution of the quantization step. To enable GPU in WSL2, please refer to CUDA on WSL :: CUDA Toolkit Documentation (nvidia.com)
X-server installation
A Xserver must be installed in Windows so that any Ubuntu application that implement a GUI can show up on your display. These include your favorite browser such as Google Chrome, Tensorboard, etc . With a X-server installed, starting a Jupyter notebook will automatically launch a Ubuntu based internet browser. Without it, you would have to manually copy paste the notebook’s URL to a Windows based internet browser.
We recommend VxXsrv:
a) Download and install VxXsrv from: VcXsrv Windows X Server
When installing it, select the default options.
b) After installation, create a new desktop shortcut that points to C:\Program Files\VcXsrv\vcxsrv.exe and set the following command in the Target field of the shortcut’s properties: "C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto
c) Double click on the shortcut to launch the X-server.
d) Optionally, add X-Server to Startup Program by using Window(KEY)+R, and then executing the following command:
shell:startup
Copy the shortcut created above into the Startup folder.
e) Start a WSL-Ubuntu terminal through the Windows start menu and edit the .bashrc file:
vim .bashrc
Press ‘i’ and add the following line:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
Press ESC and then the key ‘:’ and type ‘wq’ to write the file and quit
Close the terminal and open a new one in order to execute .bashrc .
f) For testing, install terminator, which is a terminal emulator like xterm:
sudo apt-get install terminator
Test the xserver by launching a terminal window:
terminator &
If you get the following error:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.InvalidFileContent: D-Bus library appears to be incorrectly set up: see the manual page for dbus-uuidgen to correct this issue. (Failed to open “/var/lib/dbus/machine-id”: No such file or directory; UUID file ‘/etc/machine-id’ should contain a hex string of length 32, not length 0, with no other text)
Run the command:
sudo dbus-uuidgen --ensure
Install some useful applications on Ubuntu
-
Google-chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
google-chrome &
-
Sublime-text editor
Folow the instructions in: How to Install Sublime Text 3 on Ubuntu 20.04 | Linuxize -
Nautilus file browser
sudo apt install nautilus
Dependent packages installation
In a WSL-Ubuntu terminal, install the following packages required by the DFC:
sudo apt install -y unzip python3-dev python3-pip python3-tk graphviz graphviz-dev build-essential virtualenv
Hailo DFC installation
In a WSL-Ubuntu terminal, create directory hailo in /home/, since the default login directory is your home directory, type:
mkdir workspace
cd workspace
google-chrome &
In Chrome:
· Go to Hailo website The World’s Top Performing Edge AI Processor For Edge Devices .
· Login to Developer Zone
· Go to SW Downloads page Software Downloads | by Hailo the leading AI Processor company
· There are two buttons:
- Hailo Software Suite: the software suite and its associated components (DFC, Hailo-RT, Model Zoo, Tappas) are released every quarter. Select this button if you want to download a DFC release that coincides with a software suite release.
- Archives released: select this button if you want to download older release.
For this present document, we’ll select ‘Hailo Software Suite’ to download the DFC that coincides with the latest SW suite.
In the Product section, select Dataflow_Compiler. Note that the OS is ‘Linux’ by default and it is the only option at this time, that’s why we need WSL2 to support it on Windows.
Download the wheel Hailo Dataflow Compiler - Python package vX.YY. Here, we are assuming here that the downloaded filename is hailo_dataflow_compiler-3.28.0-py3-none-linux_x86_64.whl and it is downloaded in your ~/Downloads folder . Go to your ubuntu terminal and type:
mv ~/Downloads/hailo_dataflow_compiler-3.28.0-py3-none-linux_x86_64.whl ~/hailo
Follow installation instruction in Dataflow Compiler v3.28.0 . If you get an error running
virtualenv <VENV_NAME>
such as: the path python2 (from --python=python2) does not exist
run:
virtualenv --python=python3 <VENV_NAME>
Running the tutorials
The DFC release include 6 tutorials in form of Jupyter notebook:
DFC_0_Introduction.ipynb
DFC_1_Parsing_Tutorial.ipynb
DFC_2_Model_Optimization_Tutorial.ipynb
DFC_3_Compilation_Tutorial.ipynb
DFC_4_Inference_Tutorial.ipynb
DFC_5_Layer_Noise_Analysis_Tutorial.ipynb
DFC_6_QAT_Tutorial.ipynb
HRT_0_Inference_Tutorial.ipynb
HRT_1_Power_Measurement_Tutorial.ipynb
HRT_2_Inference_Tutorial_Multi_Process_Service.ipynb
HRT_3_Inference_Single_Model_Tutorial.ipynb
HRT_4_Async_Inference_Multiple_Models_Tutorial.ipynb
Tutorials DFC_1 to DFC_6 are supported on WSL. The Jupyter-notebook of tutorials HRT_1 to HRT_4 rely on Hailo-RT for inference and thus are not functional. Indeed when running from WSL, they can’t communicate with the Hailo-RT driver which resides on the Windows side. May be in the future a solution will be found but currently these inference tutorials are only functional on a system running Linux natively.
To invoke a tutorial, first activate the DFC virtual environment :
. ./hailo_virtualenv/bin/activate
and then run:
hailo tutorial &
Google-chrome will open a page which allows you to select the tutorial you want to run.
Note that the source code of all the tutorials are located in the directory hailo_venv/lib/python3.10/site-packages/hailo_tutorials/notebooks/ and any output files generated during a tutorial execution will be placed inside this directory structure.