ai-inference-hailo.py
Example of integrating a Hailo AI accelerator via the M.2 port for real-time inference on the display.
Requires a Hailo AI accelerator inserted into the M.2 port of the Smart Display Module. Install HailoRT drivers and Python libraries. The code uses the Hailo pipeline to process images and display results. Ideal for visual recognition on SDM screens.
ai-inference-hailo.py
import hailo
import numpy as np
import cv2
# Chargement du modèle compilé pour Hailo
# Assurez-vous que le HailoRT est installé et le module M.2 détecté
model_path = "./models/resnet50.hef"
try:
# Initialisation du pipeline Hailo
pipeline = hailo.create_pipeline()
pipeline.add_input_source("camera") # Ou un flux vidéo
pipeline.add_hailo_infer(model_path)
pipeline.add_output_sink("display") # Sortie vers le framebuffer SDM
print("Démarrage de l'inférence IA...")
pipeline.run()
except Exception as e:
print(f"Erreur: {e}")
print("Vérifiez la connexion du module M.2 et les drivers Hailo.")