How do I resolve HailoAsyncInference related errors?

When I run the sample example below, an error occurs. I would like to ask for your advice.

(hailo8) pi@CM3588:~/Hailo-Application-Code-Examples-main/runtime/python/object_detection$ python object_detection.py -n /home/ubuntu/workspace/project/hailo/model/yolov8n.hef -i ./zidane.jpg -l coco.txt
Traceback (most recent call last):
File “object_detection.py”, line 2, in
from utils import HailoAsyncInference, load_input_images, validate_images, divide_list_to_batches
ImportError: cannot import name ‘HailoAsyncInference’ from ‘utils’ (/home/pi/miniconda3/envs/hailo8/lib/python3.8/site-packages/utils/init.py)

Hi @hcpark,

Welcome to the Hailo Community!

The HailoAsyncInference class is imported from the utils.py file, which is in the runtime/python/ folder.
It seems there is an issue in the object_detection.py file.
You have two options:

  • Move the following line after line #17 (sys.path.append…)
    from utils import HailoAsyncInference, load_input_images, 
    validate_images, divide_list_to_batches
    
  • Copy utils.py in the object_detection folder.

The file in the repository will be fixed after the weekend. Please let me know if this works.

1 Like