Error in Hailo Application Code Examples

In the Hailo Application Code Examples Repo, there is an example of how to use the hailo api to stream video.

On line 67 there is this statement
layer_from_shape: dict = {infer_results[key].shape:key for key in infer_results.keys()}
This throws an error because the data type of infer_results[key] is a list (not a numpy array).

Actually, I dont get what this is supposed to do.
It is going to return a dictionary where they keys are the tensor shape, and the values are the model name (in this case “yolox_s_leaky/yolox_nms_postprocess”). It iterates over all the keys, but there is only one key in infer_results

Given that there is only one key in infer_results, I dont see how the code

endnodes = [infer_results[layer_from_shape[1, 80, 80, 4]],  # stride 8 
                    infer_results[layer_from_shape[1, 80, 80, 1]],  # stride 8 ...

is supposed to work.

Maybe the .hef file has been changes since this code was written (???). I am using the .hef file specified in the get_resource.sh file
(“https://hailo-model-zoo.s3.eu-west-2.amazonaws.com/ModelZoo/Compiled/v2.6.1/yolox_s_leaky.hef”)

Has anyone got this to work?

Hi! For me, the example is also broken, but for a different reason:

Traceback (most recent call last):
  File "/local/workspace/Hailo-Application-Code-Examples/runtime/python/streaming/./yolox_stream_inference.py", line 87, in <module>
    hailo_preds = yolox_post_proc.yolo_postprocessing(endnodes)
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/core/postprocessing/detection/yolo.py", line 139, in yolo_postprocessing
    detection_boxes, detection_scores = tf.numpy_function(
  File "/local/workspace/hailo_virtualenv/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/local/workspace/hailo_model_zoo/hailo_model_zoo/core/postprocessing/detection/yolo.py", line 209, in yolo_postprocess_numpy
    pred = net_out.transpose((0, 3, 1, 2))  # now dims are: [N,C,H,W] as in Gluon.
ValueError: axes don't match array

Is it correct to assume that for now, this example is simply broken?

Hey @Nils-Oliver, @mgreiner79,

I’ll investigate and update the implementation. For now, please assume it’s not working until I provide an updated version. Unlike our stable RPi examples repository, this repo is still being stabilized and we’re working on adding more examples.

I’ll keep you updated on the progress.