From 49c378d706f1005bf81cdb964a8c1269896763de Mon Sep 17 00:00:00 2001
From: Fynn Petersen-Frey <10599762+fyfrey@users.noreply.github.com>
Date: Mon, 12 Feb 2024 19:29:55 +0100
Subject: [PATCH] fix(ml): re-enable ARMNN integration (#7053)

---
 machine-learning/Dockerfile                       | 3 ++-
 machine-learning/app/models/facial_recognition.py | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/machine-learning/Dockerfile b/machine-learning/Dockerfile
index 5b6cc9b6d8..ad22e9f3ee 100644
--- a/machine-learning/Dockerfile
+++ b/machine-learning/Dockerfile
@@ -52,7 +52,8 @@ ENV LD_LIBRARY_PATH=/opt/armnn
 RUN apt-get update && apt-get install -y --no-install-recommends ocl-icd-libopencl1 mesa-opencl-icd && \
     rm -rf /var/lib/apt/lists/* && \
     mkdir --parents /etc/OpenCL/vendors && \
-    echo "/usr/lib/libmali.so" > /etc/OpenCL/vendors/mali.icd
+    echo "/usr/lib/libmali.so" > /etc/OpenCL/vendors/mali.icd && \
+    mkdir /opt/armnn
 
 COPY --from=builder-armnn \
       /opt/armnn/libarmnn.so.?? \
diff --git a/machine-learning/app/models/facial_recognition.py b/machine-learning/app/models/facial_recognition.py
index 072fc807f9..894f5ec726 100644
--- a/machine-learning/app/models/facial_recognition.py
+++ b/machine-learning/app/models/facial_recognition.py
@@ -28,7 +28,10 @@ class FaceRecognizer(InferenceModel):
 
     def _load(self) -> None:
         self.det_model = RetinaFace(session=self._make_session(self.det_file))
-        self.rec_model = ArcFaceONNX(self.rec_file.as_posix(), session=self._make_session(self.rec_file))
+        self.rec_model = ArcFaceONNX(
+            self.rec_file.with_suffix(".onnx").as_posix(),
+            session=self._make_session(self.rec_file),
+        )
 
         self.det_model.prepare(
             ctx_id=0,