⚠️ Beta: This application is currently in beta. Features and APIs may change.
This example demonstrates lane detection using a Hailo8 or Hailo10H device.
It receives an input video and annotates it with the lane detection coordinates.
- hailo_platform:
- 4.23.0 (for Hailo-8 devices)
- 5.3.0 (for Hailo-10H devices)
- tqdm
- opencv-python
- ufld_v2_tu
Run this app in one of two ways:
- Standalone installation in a clean virtual environment (no TAPPAS required) — see Option 1
- From an installed
hailo-appsrepository — see Option 2
To avoid compatibility issues, it's recommended to use a clean virtual environment.
-
Install PyHailoRT
- Download the HailoRT whl from the Hailo website - make sure to select the correct Python version.
- Install whl:
pip install hailort-X.X.X-cpXX-cpXX-linux_x86_64.whl
-
Clone the repository:
git clone https://github.com/hailo-ai/hailo-apps.git cd hailo-apps/python/standalone_apps/lane_detection -
Install dependencies:
pip install -r requirements.txt
If you installed the full repository:
git clone https://github.com/hailo-ai/hailo-apps.git
cd hailo-apps
sudo ./install.sh
source setup_env.shThen the app is already ready for usage:
cd hailo-apps/python/standalone_apps/lane_detectionTo avoid compatibility issues, it's recommended to use a clean virtual environment.
-
Install HailoRT (MSI) + PyHailoRT
-
Download and install the HailoRT Windows MSI from the Hailo website.
-
During the installation, make sure PyHailoRT is selected (in the MSI “Custom Setup” tree).
-
After installation, the PyHailoRT wheel is located under:
C:\Program Files\HailoRT\python -
Create and activate a virtual environment:
python -m venv wind_venv .\wind_venv\Scripts\Activate.ps1- Install the PyHailoRT wheel from the MSI installation folder:
pip install "C:\Program Files\HailoRT\python\hailort-*.whl" -
-
Clone the repository:
git clone https://github.com/hailo-ai/hailo-apps.git cd hailo-apps\hailo_apps\python\standalone_apps\lane_detection
-
Install dependencies:
pip install -r requirements.txt
After completing either installation option, run from the application folder:
python .\lane_detection.py -n <model_path> -i <input_video_path> -o <output_path>--hef-path, -n:- A model name (e.g.,
ufld_v2_tu) → the script will automatically download and resolve the correct HEF for your device. - A file path to a local HEF → the script will use the specified network directly.
- A model name (e.g.,
-i, --input:- An input source such as an image (
bus.jpg), a video (video.mp4), a directory of images. - A predefined input name from
resources_config.yaml(e.g.,bus,street).- If you choose a predefined name, the input will be automatically downloaded if it doesn't already exist.
- Use
--list-inputsto display all available predefined inputs.
- An input source such as an image (
-o, --output: Path to save the output video with annotated lanes.--list-models: [optional] Print all supported models for this application (fromresources_config.yaml) and exit.--list-inputs: [optional] Print the available predefined input resources (images/videos) defined inresources_config.yamlfor this application, then exit.
For more information:
./lane_detection.py -hList supported networks
./lane_detection.py --list-netsList available input resources
./lane_detection.py --list-inputsInference
./lane_detection.py -n ./ufld_v2_tu.hef -i input_video.mp4- The example was only tested with:
- 4.23.0 (for Hailo-8 devices)
- 5.3.0 (for Hailo-10H devices)
- The postprocessed video will be saved as output_video.mp4.
- The list of supported detection models is defined in
networks.json. - For any issues, open a post on the Hailo Community
This code example is provided by Hailo solely on an “AS IS” basis and “with all faults”. No responsibility or liability is accepted or shall be imposed upon Hailo regarding the accuracy, merchantability, completeness or suitability of the code example. Hailo shall not have any liability or responsibility for errors or omissions in, or any business decisions made by you in reliance on this code example or any part of it. If an error occurs when running this example, please open a ticket in the "Issues" tab.
This example was tested on specific versions and we can only guarantee the expected results using the exact version mentioned above on the exact environment. The example might work for other versions, other environment or other HEF file, but there is no guarantee that it will.
