From fb56444ed110f5e1261957eca9d3d0d2e3b4baaa Mon Sep 17 00:00:00 2001
From: "michael.divia" <michael.divia@etu.hesge.ch>
Date: Wed, 9 Apr 2025 21:37:17 +0200
Subject: [PATCH] Call 911

---
 python/pokedex_rpi.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/pokedex_rpi.py b/python/pokedex_rpi.py
index cc31896..34dca02 100644
--- a/python/pokedex_rpi.py
+++ b/python/pokedex_rpi.py
@@ -58,8 +58,9 @@ with Hailo(hef_path) as hailo:
     
     # --- Preprocess image ---
     image = frame.astype(np.float32) / 255.0  # Normalize to [0, 1]
-    image = np.expand_dims(image, axis=0)     # Add batch dimension
-    image = np.transpose(image, (0, 3, 1, 2))  # NHWC ? NCHW if required (check your model)
+    image = np.expand_dims(image, axis=0)     # Add batch dimension → (1, H, W, C)
+    image = np.transpose(image, (0, 3, 1, 2))  # NHWC → NCHW
+    image = np.ascontiguousarray(image)       # Ensure buffer is C-contiguous
 
 
     print("-- Running inference...")
-- 
GitLab