Hailo8L Async Inference issue - invalid operation (

Hey @natsayin_nahin ,

The error you’re encountering:

Output buffer size 1002 is different than expected 4008 for output 'yolo11n_visdrone/yolov8_nms_postprocess'

indicates a mismatch between the expected output shape by HailoRT and the allocated buffer shape in your Python code.

You’re using this line to allocate the output buffer:

buffer = np.empty(infer_model.output().shape).astype(np.uint8)

But infer_model.output().shape returns the shape in elements, not in bytes. This causes incorrect memory allocation because the actual output size (in bytes) depends on the data type (e.g., float32 vs uint8), not just the number of elements.

This is especially critical when using post-processed models (like NMS) that return float32 or other non-uint8 types.

Use .shape and .dtype together to compute the correct buffer:

output_info = infer_model.output()
output_shape = output_info.shape
output_dtype = output_info.dtype

# Allocate the correct buffer based on shape * dtype
buffer = np.empty(output_shape, dtype=output_dtype)
bindings.output().set_buffer(buffer)

This ensures the buffer is the correct size in bytes, avoiding the error.

1 Like