diff --git a/config/config.yaml b/config/config.yaml index 39696ba95..4f8cccde9 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -10,36 +10,29 @@ detectors: # model_type: yolov9 # width: 640 # height: 640 -# path: /config/model_cache/memryx_cache/YOLO_v9_small_640_640_3_onnx.dfp -# labelmap_path: /config/model_cache/memryx_cache/labelmap.txt - -# model: -# model_type: yolov8 -# width: 640 -# height: 640 -# path: /config/model_cache/memryx_cache/YOLO_v8_small_640_640_3_onnx.dfp -# labelmap_path: /config/model_cache/memryx_cache/labelmap.txt +# path: /memryx_models/yolov9/YOLO_v9_small_640_640_3_onnx.dfp +# labelmap_path: /memryx_models/yolov9/labelmap.txt # model: # model_type: yolonas # width: 320 # height: 320 -# path: /config/model_cache/memryx_cache/yolo_nas_s.dfp -# labelmap_path: /config/model_cache/memryx_cache/labelmap.txt - -model: - model_type: yolox - width: 640 - height: 640 - path: /config/model_cache/memryx_cache/YOLOX_640_640_3_onnx.dfp - labelmap_path: /config/model_cache/memryx_cache/labelmap.txt +# path: /memryx_models/yolo_nas/yolo_nas_s.dfp +# labelmap_path: /memryx_models/yolo_nas/labelmap.txt # model: -# model_type: ssd -# width: 320 -# height: 320 -# path: /config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx.dfp -# labelmap_path: /config/model_cache/memryx_cache/labelmap.txt +# model_type: yolox +# width: 640 +# height: 640 +# path: /memryx_models/yolox/YOLOX_640_640_3_onnx.dfp +# labelmap_path: /memryx_models/yolox/labelmap.txt + +model: + model_type: ssd + width: 320 + height: 320 + path: /memryx_models/ssdlite/SSDlite_MobileNet_v2_320_320_3_onnx.dfp + labelmap_path: /memryx_models/ssdlite/labelmap.txt cameras: Cam1: diff --git a/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx.dfp b/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx.dfp deleted file mode 100644 index 2925f6a6c..000000000 Binary files a/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx.dfp and /dev/null differ diff --git a/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx_post.onnx b/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx_post.onnx deleted file mode 100644 index 123d76a79..000000000 Binary files a/config/model_cache/memryx_cache/SSDlite_MobileNet_v2_320_320_3_onnx_post.onnx and /dev/null differ diff --git a/config/model_cache/memryx_cache/YOLOX_640_640_3_onnx.dfp b/config/model_cache/memryx_cache/YOLOX_640_640_3_onnx.dfp deleted file mode 100644 index 941a6a798..000000000 Binary files a/config/model_cache/memryx_cache/YOLOX_640_640_3_onnx.dfp and /dev/null differ diff --git a/config/model_cache/memryx_cache/YOLO_v8_small_640_640_3_onnx.dfp b/config/model_cache/memryx_cache/YOLO_v8_small_640_640_3_onnx.dfp deleted file mode 100644 index a32bbc5b3..000000000 Binary files a/config/model_cache/memryx_cache/YOLO_v8_small_640_640_3_onnx.dfp and /dev/null differ diff --git a/config/model_cache/memryx_cache/YOLO_v9_small_640_640_3_onnx.dfp b/config/model_cache/memryx_cache/YOLO_v9_small_640_640_3_onnx.dfp deleted file mode 100644 index b0eccf32b..000000000 Binary files a/config/model_cache/memryx_cache/YOLO_v9_small_640_640_3_onnx.dfp and /dev/null differ diff --git a/config/model_cache/memryx_cache/_model_22_Constant_10_output_0.npy b/config/model_cache/memryx_cache/_model_22_Constant_10_output_0.npy deleted file mode 100644 index db2228469..000000000 Binary files a/config/model_cache/memryx_cache/_model_22_Constant_10_output_0.npy and /dev/null differ diff --git a/config/model_cache/memryx_cache/_model_22_Constant_12_output_0.npy b/config/model_cache/memryx_cache/_model_22_Constant_12_output_0.npy deleted file mode 100644 index 051d51c93..000000000 Binary files a/config/model_cache/memryx_cache/_model_22_Constant_12_output_0.npy and /dev/null differ diff --git a/config/model_cache/memryx_cache/_model_22_Constant_9_output_0.npy b/config/model_cache/memryx_cache/_model_22_Constant_9_output_0.npy deleted file mode 100644 index db2228469..000000000 Binary files a/config/model_cache/memryx_cache/_model_22_Constant_9_output_0.npy and /dev/null differ diff --git a/config/model_cache/memryx_cache/labelmap.txt b/config/model_cache/memryx_cache/labelmap.txt deleted file mode 100644 index 51dba82b4..000000000 --- a/config/model_cache/memryx_cache/labelmap.txt +++ /dev/null @@ -1,80 +0,0 @@ -0 person -1 bicycle -2 car -3 motorcycle -4 airplane -5 bus -6 train -7 truck -8 boat -9 traffic light -10 fire hydrant -11 stop sign -12 parking meter -13 bench -14 bird -15 cat -16 dog -17 horse -18 sheep -19 cow -20 elephant -21 bear -22 zebra -23 giraffe -24 backpack -25 umbrella -26 handbag -27 tie -28 suitcase -29 frisbee -30 skis -31 snowboard -32 sports ball -33 kite -34 baseball bat -35 baseball glove -36 skateboard -37 surfboard -38 tennis racket -39 bottle -40 wine glass -41 cup -42 fork -43 knife -44 spoon -45 bowl -46 banana -47 apple -48 sandwich -49 orange -50 broccoli -51 carrot -52 hot dog -53 pizza -54 donut -55 cake -56 chair -57 couch -58 potted plant -59 bed -60 dining table -61 toilet -62 tv -63 laptop -64 mouse -65 remote -66 keyboard -67 cell phone -68 microwave -69 oven -70 toaster -71 sink -72 refrigerator -73 book -74 clock -75 vase -76 scissors -77 teddy bear -78 hair drier -79 toothbrush \ No newline at end of file diff --git a/config/model_cache/memryx_cache/model_22_dfl_conv_weight.npy b/config/model_cache/memryx_cache/model_22_dfl_conv_weight.npy deleted file mode 100644 index 3348cca5b..000000000 Binary files a/config/model_cache/memryx_cache/model_22_dfl_conv_weight.npy and /dev/null differ diff --git a/config/model_cache/memryx_cache/yolo_nas_s.dfp b/config/model_cache/memryx_cache/yolo_nas_s.dfp deleted file mode 100644 index 96716131c..000000000 Binary files a/config/model_cache/memryx_cache/yolo_nas_s.dfp and /dev/null differ diff --git a/config/model_cache/memryx_cache/yolo_nas_s_post.onnx b/config/model_cache/memryx_cache/yolo_nas_s_post.onnx deleted file mode 100644 index f246f028e..000000000 Binary files a/config/model_cache/memryx_cache/yolo_nas_s_post.onnx and /dev/null differ diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 95664e302..8e11b6d74 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -279,6 +279,18 @@ RUN apt-get install -y --no-install-recommends memx-accl # Debug messages RUN echo "Hello from inside MemryX Docker image!" +# Set the working directory for model files +WORKDIR /memryx_models + +# Download and extract MemryX model files +RUN wget -O yolox.zip https://developer.memryx.com/example_files/1p2_frigate/yolox.zip && unzip yolox.zip && \ + wget -O ssdlite.zip https://developer.memryx.com/example_files/1p2_frigate/ssdlite.zip && unzip ssdlite.zip && \ + wget -O yolo_nas.zip https://developer.memryx.com/example_files/1p2_frigate/yolo_nas.zip && unzip yolo_nas.zip && \ + wget -O yolov9.zip https://developer.memryx.com/example_files/1p2_frigate/yolov9.zip && unzip yolov9.zip + +# Set permissions for the models directory +RUN chmod -R 755 /memryx_models + RUN ldconfig EXPOSE 5000 @@ -354,4 +366,4 @@ COPY --from=web-build /work/dist/ web/ FROM deps AS frigate WORKDIR /opt/frigate/ -COPY --from=rootfs / / +COPY --from=rootfs / / \ No newline at end of file diff --git a/frigate/detectors/plugins/memryx.py b/frigate/detectors/plugins/memryx.py index 947807a47..05372164d 100644 --- a/frigate/detectors/plugins/memryx.py +++ b/frigate/detectors/plugins/memryx.py @@ -57,18 +57,18 @@ class MemryXDetector(DetectionApi): self.memx_model_width = detector_config.model.width self.memx_model_type = detector_config.model.model_type - self.cache_dir = "/config/model_cache/memryx_cache" + self.cache_dir = "/memryx_models" if self.memx_model_type == ModelTypeEnum.yolov9: self.model_url = "https://developer.memryx.com/model_explorer/1p2/YOLO_v9_small_640_640_3_onnx.zip" # self.expected_post_model = "YOLO_v9_small_640_640_3_onnx_post.onnx" - self.const_A = np.load("/config/model_cache/memryx_cache/_model_22_Constant_9_output_0.npy") - self.const_B = np.load("/config/model_cache/memryx_cache/_model_22_Constant_10_output_0.npy") - self.const_C = np.load("/config/model_cache/memryx_cache/_model_22_Constant_12_output_0.npy") + self.const_A = np.load("/memryx_models/yolov9/_model_22_Constant_9_output_0.npy") + self.const_B = np.load("/memryx_models/yolov9/_model_22_Constant_10_output_0.npy") + self.const_C = np.load("/memryx_models/yolov9/_model_22_Constant_12_output_0.npy") elif self.memx_model_type == ModelTypeEnum.yolonas: self.model_url = "" - self.expected_post_model = "yolo_nas_s_post.onnx" + self.expected_post_model = "yolo_nas/yolo_nas_s_post.onnx" elif self.memx_model_type == ModelTypeEnum.yolox: self.model_url = "https://developer.memryx.com/model_explorer/1p2/YOLOX_640_640_3_onnx.zip" @@ -77,7 +77,7 @@ class MemryXDetector(DetectionApi): elif self.memx_model_type == ModelTypeEnum.ssd: self.model_url = "https://developer.memryx.com/model_explorer/1p2/SSDlite_MobileNet_v2_320_320_3_onnx.zip" - self.expected_post_model = "SSDlite_MobileNet_v2_320_320_3_onnx_post.onnx" + self.expected_post_model = "ssdlite/SSDlite_MobileNet_v2_320_320_3_onnx_post.onnx" self.check_and_prepare_model() logger.info(f"Initializing MemryX with model: {self.memx_model_path} on device {self.memx_device_path}") @@ -110,6 +110,7 @@ class MemryXDetector(DetectionApi): else: post_model_file_path = os.path.join(self.cache_dir, self.expected_post_model) + # model_file_path_tflite = os.path.join(self.cache_dir, self.expected_model_filename_tflite) # Check if both required model files exist