Frigate with MemryX on Proxmox LXC

Introduction

This guide is intended for Frigate users interested in integrating the MemryX detector into Proxmox-hosted Linux containers (LXCs). Follow along to create your LXC in Proxmox and enable passthrough for the MemryX detector.

Proxmox Host Setup

To begin, you will need to install the MemryX drivers on the Proxmox host. Please follow the instructions on the Developer Hub to install SDK 2.1 drivers until steps 1 through 6 have been completed.

Create a Privileged LXC

Use pct to create a privileged Ubuntu 24.04 LXC configured to your preference. The config file located at /etc/pve/lxc/<container_id>.conf will need to resemble the following:

In particular, to the config file, add the following lines:

mp0: /run/mxa_manager,mp=/mnt/mxa_manager,backup=0
lxc.cap.drop:
lxc.cgroup2.devices.allow: a
lxc.mount.entry: /dev/memx0 /dev/memx0 none bind,create=file,optional 0 0
lxc.mount.entry: /dev/memx0_feature /dev/memx0_feature none bind,create=file,optional 0 0

Enter the LXC and Verify Passthrough

Enter the LXC using pct enter <container_id> and verify that all MemryX mounts from the <container_id>.conf file on the Proxmox host are showing up. In particular, the below commands should return the following:

Next, you can create the following three directories and navigate to /opt/frigate:

mkdir -p /opt/frigate/config
mkdir -p /opt/frigate/media
mkdir -p /opt/frigate/cache
cd /opt/frigate

Create docker-compose.yml

Create the docker-compose.yml file as follows and paste the content that appears below:

nano docker-compose.yml

version: "3.9"

services:
  frigate:
    container_name: frigate
    image: ghcr.io/blakeblackshear/frigate:stable
    privileged: true
    restart: unless-stopped
    shm_size: "512mb"

    devices:
      - /dev/memx0:/dev/memx0

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - ./media:/media/frigate
      - ./cache:/tmp/cache
      - /mnt/mxa_manager:/run/mxa_manager

    ports:
      - "5000:5000"
      - "8971:8971"
      - "8554:8554"
      - "8555:8555/tcp"
      - "8555:8555/udp"

Create config/config.yml for Frigate

Next, you can create the Frigate config.yml file and paste the content below (of course, the cameras/model selection will have to be adjusted to your preferences):

nano config/config.yml

mqtt:
  enabled: false

detectors:
  memx0:
    type: memryx
    device: PCIe:0

model:
  model_type: yolo-generic
  width: 320
  height: 320
  input_tensor: nchw
  input_dtype: float
  labelmap_path: /labelmap/coco-80.txt

cameras:
   camera_1:
    ffmpeg:
      inputs:
        - path: 
            rtsp://your-camera-url
          roles:
            - detect
    detect:
      enabled: true
version: 0.17-0

Start the Frigate Docker Container

Start the container by running docker-compose up -d and verify things are working as expected with docker logs -f frigate. To stop the container and clean up its resources, run docker-compose down.

Final Thoughts

We hope this guide is helpful to the Frigate community. As always, we are here to help with any questions that may arise, and we would love to hear from you!

1 Like