blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.03k stars 1.74k forks source link

[Bug]: [OpenVino:] Intel compute runtime required for Frigate #12266

Closed NickM-27 closed 1 month ago

NickM-27 commented 4 months ago

Discussed in https://github.com/blakeblackshear/frigate/discussions/12260

Originally posted by **Redsandro** July 2, 2024 ### Describe the problem you are having When starting from scratch: - new hardware - latest Proxmox 8.2 - latest Ubuntu 24.04 LXC - latest Frigate 0.14.0-beta3 .. the OpenVino detector does not work with the Intel iGPU until the latest [Intel Compute Runtime](https://github.com/intel/compute-runtime/releases) is installed _inside the Frigate container_: ```bash docker exec -ti frigate bash cd $(mktemp -d) wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.16900.23/intel-igc-core_1.0.16900.23_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.16900.23/intel-igc-opencl_1.0.16900.23_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/intel-level-zero-gpu_1.3.29735.20_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/intel-opencl-icd_24.22.29735.20_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/libigdgmm12_22.3.19_amd64.deb dpkg -i *.deb ``` I am aware that [none of the maintainers use OpenVino](https://github.com/blakeblackshear/frigate/discussions/10785#discussioncomment-9035425). The problem and the solution have been observed by [myself](https://github.com/blakeblackshear/frigate/discussions/12238) and at least one [other person](https://github.com/blakeblackshear/frigate/discussions/12012). If I understand correctly, Intel Compute is a dependency for OpenVino in Frigate, and it needs to be updated to the latest version in order to use the latest kernel. I did a search and believe this is not being tracked as a bug yet. My apologies if I missed something. ### Steps to reproduce 1. Freshen your image (i.e. `docker compose down && docker compose up -d`) 2. Observe crash (e.g. `docker compose logs -f --tail=100`) `[GPU] Context was not initialized for 0 device` 3. Change detector device to `CPU` in config 4. Bring up new config (e.g. `docker compose restart`) 5. Observe no crash 6. Install latest [Intel Compute Runtime](https://github.com/intel/compute-runtime/releases) (see above) 7. Change detector device back to `GPU` in config 8. Bring up new config (e.g. `docker compose restart`) 9. Observe no crash ### Version 0.14.0-beta3 ### Frigate config file ```yaml # https://docs.frigate.video/configuration/detectors detectors: ov: type: openvino device: GPU model: path: /openvino-model/ssdlite_mobilenet_v2.xml model: width: 300 height: 300 input_tensor: nhwc input_pixel_format: bgr labelmap_path: /openvino-model/coco_91cl_bkgr.txt ``` ### Relevant log output ```shell Process detector:ov: Traceback (most recent call last): File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector object_detector = LocalObjectDetector(detector_config=detector_config) File "/opt/frigate/frigate/object_detection.py", line 53, in __init__ self.detect_api = create_detector(detector_config) File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector return api(detector_config) File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 38, in __init__ self.interpreter = self.ov_core.compile_model( File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 521, in compile_model super().compile_model(model, device_name, {} if config is None else config), RuntimeError: Exception from src/inference/src/cpp/core.cpp:123: Exception from src/inference/src/dev/plugin.cpp:59: Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:204: [GPU] Context was not initialized for 0 device ``` ### Operating system Proxmox ### Install method Docker Compose ### Network connection Wired ### Camera make and model irrelevant ### Any other information that may be helpful This is relevant for both Ubuntu 22.04 and 24.04. Running `dpkg -i *.deb` above throws an error or two due to certain packages already being installed, but these can safely be ignored. [Here is a fix](https://github.com/blakeblackshear/frigate/discussions/10785#discussioncomment-9258468) for one package, but I didn't use it. **Added:** I thought I was creating an `issue` but the issue wizard redirected this back to `discussions`. At least it has the `bug` label now. :slightly_smiling_face:
johnmmcgee commented 3 months ago

Hoping this gets fixed in the next RC. seems like a simple fix. Lots of users use openvino with igpu configurations.

NickM-27 commented 3 months ago

this doesn't affect all or even a majority of users though, from what has been shared this is a bug in the proxmox kernel and we have only gotten reports of issues from users running proxmox. Also, it appears that an ENV var can be set to fix the issue and they are already working on a fix for a future kernel.

Doing changes here risk the chance that it causes problems for other users so I would not expect such a change to take place now that we are deep into the release candidate process

johnmmcgee commented 3 months ago

Reporting this error from Fedora Core 40.

6.8.11-300.fc40.x86_64

NickM-27 commented 3 months ago

Good to know, for now I would suggest following https://github.com/blakeblackshear/frigate/discussions/10785#discussioncomment-9284397

johnmmcgee commented 3 months ago

Also to note, I have set the env variables but i am still getting the following error which seems related to the driver:

2024-08-03 21:39:04.875111273 [2024-08-03 21:39:04] ffmpeg.doorbell.detect ERROR : [AVHWDeviceContext @ 0x55c93b2abf80] Error setting child device handle: -17

https://github.com/blakeblackshear/frigate/issues/6078

NickM-27 commented 3 months ago

that error is entirely unrelated to what is being discussed here

DeltaTango69 commented 2 months ago

Unfortunately I have the same problem. Before Update to Ver. 14 ist was no problem. The installation of the intel compute runtime seems not to work to me. I am under windows with WSL. Maybe therefore it didn't work. Any Suggestion?

Logs:
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.210531266  Traceback (most recent call last):
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.211113110    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.211115810      self.run()
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.212769335    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.212773135      self._target(*self._args, **self._kwargs)
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.213745609    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.213749109      object_detector = LocalObjectDetector(detector_config=detector_config)
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.215159116    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.215162516      self.detect_api = create_detector(detector_config)
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216579323    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216742436      return api(detector_config)
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216791740    File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 43, in __init__
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216793740      self.interpreter = self.ov_core.compile_model(
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216822142    File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 521, in compile_model
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216824142      super().compile_model(model, device_name, {} if config is None else config),
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216898248  RuntimeError: Exception from src/inference/src/cpp/core.cpp:123:
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216900248  Exception from src/inference/src/dev/plugin.cpp:59:
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216901848  Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:204:
2024-08-21 17:32:38 frigate  | 2024-08-21 15:32:38.216906148  [GPU] Context was not initialized for 0 device
DeltaTango69 commented 2 months ago

I have tried to install in docker desktop via terminal. But I got some errors....

# ls
intel-igc-core_1.0.16900.23_amd64.deb  intel-igc-opencl_1.0.16900.23_amd64.deb  intel-level-zero-gpu_1.3.29735.20_amd64.deb  intel-opencl-icd_24.22.29735.20_amd64.deb  libigdgmm12_22.3.19_amd64.deb
# dpkg -i *.deb
Selecting previously unselected package intel-igc-core.
(Reading database ... 13120 files and directories currently installed.)
Preparing to unpack intel-igc-core_1.0.16900.23_amd64.deb ...
Unpacking intel-igc-core (1.0.16900.23) ...
Selecting previously unselected package intel-igc-opencl.
Preparing to unpack intel-igc-opencl_1.0.16900.23_amd64.deb ...
Unpacking intel-igc-opencl (1.0.16900.23) ...
Selecting previously unselected package intel-level-zero-gpu.
Preparing to unpack intel-level-zero-gpu_1.3.29735.20_amd64.deb ...
Unpacking intel-level-zero-gpu (1.3.29735.20) ...
dpkg: error processing archive intel-level-zero-gpu_1.3.29735.20_amd64.deb (--install):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libze_intel_gpu.so.1', which is also in package intel-opencl-icd 22.43.24595.41-1
Preparing to unpack intel-opencl-icd_24.22.29735.20_amd64.deb ...
Unpacking intel-opencl-icd (24.22.29735.20) over (22.43.24595.41-1) ...
dpkg-deb: error: archive 'libigdgmm12_22.3.19_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive libigdgmm12_22.3.19_amd64.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Setting up intel-igc-core (1.0.16900.23) ...
Setting up intel-igc-opencl (1.0.16900.23) ...
dpkg: dependency problems prevent configuration of intel-opencl-icd:
 intel-opencl-icd depends on libigdgmm12 (>= 22.3.19); however:
  Version of libigdgmm12:amd64 on system is 22.3.3+ds1-1.

dpkg: error processing package intel-opencl-icd (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.36-9+deb12u7) ...
Errors were encountered while processing:
 intel-level-zero-gpu_1.3.29735.20_amd64.deb
 libigdgmm12_22.3.19_amd64.deb
 intel-opencl-icd
wernerb commented 2 months ago

The problem occurs for me as well. Unfortunately because I am on Kubernetes I cannot persist container filesystem changes easily so that workaround is not really feasible.

The environment variable workaround also does not work.

This is on 24.04 and I tested multiple mainline kernels 5.8.0 6.8.0, 6.8.12 all with the same result. I am running a Skylake Intel CPU and openvino with auto used to work correctly with 0.13.

Is there an image that has these commands run on the container available? Would a PR that modifies the image with these commands (with errors fixed) be the proper solution or is this a bug that's expected to be solved upstream?

NickM-27 commented 2 months ago

@DeltaTango69 this does not seem like the issue discussed here, what is your docker config

@wernerb The issue that this is referring to will be fixed upstream, but from your description it is not clear if you are actually experiencing the issue being discussed here

DeltaTango69 commented 2 months ago

The discussion is about that openvino is not working with version 0.14, or not? At version 13.2 there were no problem. I am also with Intel Skylake! I didn't change my configuration.

services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "80mb" # update for your cameras based on calculation above
    devices:
      #- /dev/bus/usb:/dev/bus/usb  # Passes the USB Coral, needs to be modified for other versions
      #- /dev/apex_0:/dev/apex_0    # Passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
      #- /dev/video11:/dev/video11  # For Raspberry Pi 4B
      - /dev/dri/renderD128:/dev/dri/renderD128 # For intel hwaccel, needs to be updated for your hardware
      - /dev/dri/card0:/dev/dri/card0
      - /dev/dri:/dev/dri # For intel hwaccel, needs to be updated for your hardware

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - ./media:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      - TZ=Europe/Berlin
      #- NEOReadDebugKeys=1
      #- OverrideGpuAddressSpace=48
      #- LD_LIBRARY_PATH=/usr/lib/wsl/lib
      #- FRIGATE_RTSP_PASSWORD: "password"
mqtt:
  enabled: true
  host: 192.168.178.5 # <---- same mqtt broker that home assistant uses
  user: vcc
  password: ccc

cameras:
  Haustuer: # <--- this will be changed to your actual camera later
    enabled: true
    ffmpeg:
      # hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://test:test@192.168.178.50:554/live/ch1
          roles:
            - detect
        - path: rtsp://test:test@192.168.178.50:554/live/ch0
          roles:
            - record
            - audio

#ffmpeg:
#  hwaccel_args: preset-vaapi

#detectors:
#  ov:
#    type: openvino
#    device: auto

#model:
#  width: 300
#  height: 300
#  input_tensor: nhwc
#  input_pixel_format: bgr
#  path: /openvino-model/ssdlite_mobilenet_v2.xml
#  labelmap_path: /openvino-model/coco_91cl_bkgr.txt

record:
  enabled: true
  retain:
    days: 7
    mode: motion
  events:
    retain:
      default: 30
      mode: motion

snapshots:
  enabled: true
  retain:
    default: 30
version: 0.14

Detector commented out due to error.

NickM-27 commented 2 months ago

It's about a specific error message that occurs due to this missing package. You should make your own support request

DeltaTango69 commented 2 months ago

It's about a specific error message that occurs due to this missing package. You should make your own support request

As I understand this is only a temporary solution.The solution should be in my opinion the integration of the new openvino update in the frigate image.

fouticus commented 2 months ago

I'm unclear on how to apply the temporary solution. The stable image uses Debian 11, which doesn't have zst support, so I get an error when trying to install the intel compute runtime: e.g. I get the error message:

dpkg-deb: error: archive 'libigdgmm12_22.3.19_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up

Am I missing something obvious? I'm running the container inside Ubuntu 22.04 w/ Meteor-Lake (Intel Core 5 Ultra)

docker-compose.yml:

services:
  frigate:
    devices:
      - /dev/dri/:/dev/dri/ # For intel hwaccel, needs to be updated for your hardware
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: always
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "64mb" # update for your cameras based on calculation above
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/frigate_user/frigate_docker/config:/config
      - /home/frigate_user/media/Security/frigate:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "8971:8971"
      # - "5000:5000" # Internal unauthenticated access. Expose carefully.
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
    environment:
      FRIGATE_RTSP_PASSWORD: <secret>

frigate config.yml:

mqtt:
  enabled: false

#detectors:
#  npu_detector:
#    type: openvino
#    device: GPU

#model: 
#  width: 300
#  height: 300
#  input_tensor: nhwc
#  input_pixel_format: bgr
#  path: /openvino-model/ssdlite_mobilenet_v2.xml
#  labelmap_path: /openvino-model/coco_91cl_bkgr.txt

logger:
  default: info

ffmpeg:
  global_args: -hide_banner -loglevel info
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128

cameras:
  duck_enclosure_1: # <------ Name the camera
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://<user>:<secret>@<ip>/Preview_01_sub
          roles:
            - detect
            - audio
        - path: rtsp://<user>:<secret>@<ip>/Preview_01_main
          roles:
            - record
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      width: 1280
      height: 720
version: 0.14
github59173 commented 2 months ago

Same problem, different install. AMD CPU, Intel ARC 380 GPU. Using the helper script installed fine Frigate 14.1 LXC (default settings), CPU is used as detector but when switching to the GPU it errors out. Error: " 2024-09-03 15:02:36.064242 Process detector:ov: 2024-09-03 15:02:36.065743 Traceback (most recent call last): 2024-09-03 15:02:36.065764 File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap 2024-09-03 15:02:36.065779 self.run() 2024-09-03 15:02:36.065794 File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run 2024-09-03 15:02:36.065808 self._target(*self._args, **self._kwargs) 2024-09-03 15:02:36.065823 File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector 2024-09-03 15:02:36.065837 object_detector = LocalObjectDetector(detector_config=detector_config) 2024-09-03 15:02:36.065851 File "/opt/frigate/frigate/object_detection.py", line 53, in init 2024-09-03 15:02:36.065865 self.detect_api = create_detector(detector_config) 2024-09-03 15:02:36.065880 File "/opt/frigate/frigate/detectors/init.py", line 18, in create_detector 2024-09-03 15:02:36.065894 return api(detector_config) 2024-09-03 15:02:36.065908 File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 43, in init 2024-09-03 15:02:36.065922 self.interpreter = self.ov_core.compile_model( 2024-09-03 15:02:36.065937 File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 543, in compile_model 2024-09-03 15:02:36.065951 super().compile_model(model, device_name, {} if config is None else config), 2024-09-03 15:02:36.065966 RuntimeError: Exception from src/inference/src/cpp/core.cpp:121: 2024-09-03 15:02:36.065980 Exception from src/inference/src/dev/plugin.cpp:58: 2024-09-03 15:02:36.065994 Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:205: 2024-09-03 15:02:36.066009 [GPU] Context was not initialized for 0 device " I have tried many suggested fixes but can't seem to get past this error. Has there be a definitive fix for this?

mic-s commented 2 months ago

@fouticus try to repack it with this script below. I have done it on Ubuntu 24.04 in LXC container in proxmox with 6.8.4-2-pve kernel and with Intel arc a380, it is from memory so it could need some tweaks. I suggest to create folder with packages to install in frigate docker in same folder as docker-compose.yml file such as packages. It allow to reinstall packages after recreation of container with ease, with onlu last steps (running bash in container and installing packages in container). After that we have to add mount it in docker by adding to docker compose line in volumes section: - ./packages:/media/packages then we have to download packages to packages folder:

cd packages 
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-core_1.0.17384.11_amd64.deb
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-opencl_1.0.17384.11_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-level-zero-gpu-dbgsym_1.3.30508.7_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-level-zero-gpu_1.3.30508.7_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd-dbgsym_24.31.30508.7_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd_24.31.30508.7_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/libigdgmm12_22.4.1_amd64.deb

Now we have to repack packages that are packed with zst, I suggest to use script, copy it to file repack.sh This script propably would need some packages to install

#!/bin/bash

# base on:
# https://gist.github.com/the-robot/c1ab9325c0a51736dc6cefab6737ba51

Original=$1
OriginalPath=$(realpath $Original)
Repackage=$Original     

cd $(mktemp -d)
cp $OriginalPath .
ar x $Original
zstd -d < control.tar.zst| xz > control.tar.xz
zstd -d < data.tar.zst| xz > data.tar.xz  
ar -m -c -a sdsd $Repackage debian-binary control.tar.xz data.tar.xz
rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst 
ls
mv $OriginalPath "${OriginalPath%.*}.deb_bckp"
mv $Repackage $(dirname "$OriginalPath")
realpath $Repackage

make it executable chmod +x repack.sh this script need installed zstd apt install zstd Now run to repack ./repack.sh libigdgmm12_22.4.1_amd64.deb I am not sure it it is only package that need repacking, if there is more then you should repack them as well. Next is to run bash in frigate docker: docker exec -it frigate bash and then install packages in docker: cd /media/packages/; dpkg -i *.deb this command if I remember correctly should be run twice. Now after container restart it should be working.

papaf76 commented 1 month ago

Hi, I tried using your method, unfortunately when trying to install the debs they all return this error: dpkg-deb: error: file 'libigdgmm12_22.4.1_amd64.deb' is not a Debian binary archive (try dpkg-split?) Since I'm running an Alpine LXC with docker I used your script into another Ubuntu 20.04 LXC to repack the debs. Does it have to be 24.04?

Thanks

ctml91 commented 1 month ago

I tried to build a local container images with the workaround and running using that but it doesn't seem to be working for me, any ideas? when I switch device to CPU it works, and GPU usage shows in the container

image
2024-09-22 18:40:47.628280235  Traceback (most recent call last):
2024-09-22 18:40:47.628334587    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-09-22 18:40:47.628336372      self.run()
2024-09-22 18:40:47.628350667    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-09-22 18:40:47.628352233      self._target(*self._args, **self._kwargs)
2024-09-22 18:40:47.628364489    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-09-22 18:40:47.628366007      object_detector = LocalObjectDetector(detector_config=detector_config)
2024-09-22 18:40:47.628377816    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-09-22 18:40:47.628379266      self.detect_api = create_detector(detector_config)
2024-09-22 18:40:47.628390949    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-09-22 18:40:47.628392238      return api(detector_config)
2024-09-22 18:40:47.628403728    File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 43, in __init__
2024-09-22 18:40:47.628405123      self.interpreter = self.ov_core.compile_model(
2024-09-22 18:40:47.628417114    File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 521, in compile_model
2024-09-22 18:40:47.628418634      super().compile_model(model, device_name, {} if config is None else config),
2024-09-22 18:40:47.628443059  RuntimeError: Exception from src/inference/src/cpp/core.cpp:123:
2024-09-22 18:40:47.628444633  Exception from src/inference/src/dev/plugin.cpp:59:
2024-09-22 18:40:47.628445991  Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:204:
2024-09-22 18:40:47.628450325  [GPU] Context was not initialized for 0 device
2024-09-22 18:40:47.628451568

Dockerfile

FROM ghcr.io/blakeblackshear/frigate:0.14.1

RUN cd $(mktemp -d)
RUN wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.16900.23/intel-igc-core_1.0.16900.23_amd64.deb \
 https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.16900.23/intel-igc-opencl_1.0.16900.23_amd64.deb \
 https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/intel-level-zero-gpu_1.3.29735.20_amd64.deb \
 https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/intel-opencl-icd_24.22.29735.20_amd64.deb \
 https://github.com/intel/compute-runtime/releases/download/24.22.29735.20/libigdgmm12_22.3.19_amd64.deb
RUN dpkg -i *.deb || echo "done"

And I create the container using the local image, but it still throws the same error

$ podman build -f /tmp/Dockerfile -t localhost/frigate:local

NickM-27 commented 1 month ago

This should be fixed in dev images

ctml91 commented 1 month ago

This should be fixed in dev images

Thanks, unfortunately it didn't help in my case.

ghcr.io/blakeblackshear/frigate:12e2c04-amd64

2024-09-22 18:53:29.300733214  Process detector:ov:
2024-09-22 18:53:29.303357869  Traceback (most recent call last):
2024-09-22 18:53:29.304195481    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-09-22 18:53:29.304199524      self.run()
2024-09-22 18:53:29.304229842    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-09-22 18:53:29.304231386      self._target(*self._args, **self._kwargs)
2024-09-22 18:53:29.304247272    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-09-22 18:53:29.304248806      object_detector = LocalObjectDetector(detector_config=detector_config)
2024-09-22 18:53:29.304266972    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-09-22 18:53:29.304268407      self.detect_api = create_detector(detector_config)
2024-09-22 18:53:29.304282809    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-09-22 18:53:29.304284138      return api(detector_config)
2024-09-22 18:53:29.304298460    File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 37, in __init__
2024-09-22 18:53:29.304299876      self.interpreter = self.ov_core.compile_model(
2024-09-22 18:53:29.304318638    File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 543, in compile_model
2024-09-22 18:53:29.304320166      super().compile_model(model, device_name, {} if config is None else config),
2024-09-22 18:53:29.304358465  RuntimeError: Exception from src/inference/src/cpp/core.cpp:121:
2024-09-22 18:53:29.304360088  Exception from src/inference/src/dev/plugin.cpp:58:
2024-09-22 18:53:29.304361478  Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:205:
2024-09-22 18:53:29.304363730  [GPU] Context was not initialized for 0 device
2024-09-22 18:53:29.304364919
2024-09-22 18:53:29.304365955
2024-09-22 18:53:29.304388587
2024-09-22 18:53:30.161154556  [INFO] Starting go2rtc healthcheck service...
2024-09-22 18:53:49.584643003  [2024-09-22 18:53:49] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting Frigate..
detectors:
  ov:
    type: openvino
    device: GPU
    model:
      path: /openvino-model/ssdlite_mobilenet_v2.xml
model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  path: /openvino-model/ssdlite_mobilenet_v2.xml
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt
version: 0.15-0
root@6c4b6aa98750:/opt/frigate# ls -lth /dev/dri
total 0
crw-rw----. 1 root irc 226,   1 Sep 22 18:54 card1
crw-rw-rw-. 1 root 105 226, 128 Sep 22 18:54 renderD128
NickM-27 commented 1 month ago

you might be seeing a different issue then, the latest dev builds have the latest libraries from intel as marked in the OP

DeltaTango69 commented 1 month ago

I can confirm that openvino works - thank you!

darnmason commented 1 month ago

Any chance of getting a patch release on 0.14 for this?

Otherwise would there be a recommended most-stable dev image to use in the meantime?

NickM-27 commented 1 month ago

No, it's a big change that requires beta testing

darnmason commented 4 weeks ago

Just wanted to note that I'm not experiencing this issue anymore after a kernel update in proxmox to 6.8.12-2. I upgraded from 6.8.4-2.

aeozyalcin commented 4 days ago

This should be fixed in dev images

Thanks, unfortunately it didn't help in my case.

ghcr.io/blakeblackshear/frigate:12e2c04-amd64

2024-09-22 18:53:29.300733214  Process detector:ov:
2024-09-22 18:53:29.303357869  Traceback (most recent call last):
2024-09-22 18:53:29.304195481    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
2024-09-22 18:53:29.304199524      self.run()
2024-09-22 18:53:29.304229842    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
2024-09-22 18:53:29.304231386      self._target(*self._args, **self._kwargs)
2024-09-22 18:53:29.304247272    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
2024-09-22 18:53:29.304248806      object_detector = LocalObjectDetector(detector_config=detector_config)
2024-09-22 18:53:29.304266972    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
2024-09-22 18:53:29.304268407      self.detect_api = create_detector(detector_config)
2024-09-22 18:53:29.304282809    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
2024-09-22 18:53:29.304284138      return api(detector_config)
2024-09-22 18:53:29.304298460    File "/opt/frigate/frigate/detectors/plugins/openvino.py", line 37, in __init__
2024-09-22 18:53:29.304299876      self.interpreter = self.ov_core.compile_model(
2024-09-22 18:53:29.304318638    File "/usr/local/lib/python3.9/dist-packages/openvino/runtime/ie_api.py", line 543, in compile_model
2024-09-22 18:53:29.304320166      super().compile_model(model, device_name, {} if config is None else config),
2024-09-22 18:53:29.304358465  RuntimeError: Exception from src/inference/src/cpp/core.cpp:121:
2024-09-22 18:53:29.304360088  Exception from src/inference/src/dev/plugin.cpp:58:
2024-09-22 18:53:29.304361478  Check 'contexts.count(device_id)' failed at src/plugins/intel_gpu/src/plugin/plugin.cpp:205:
2024-09-22 18:53:29.304363730  [GPU] Context was not initialized for 0 device
2024-09-22 18:53:29.304364919
2024-09-22 18:53:29.304365955
2024-09-22 18:53:29.304388587
2024-09-22 18:53:30.161154556  [INFO] Starting go2rtc healthcheck service...
2024-09-22 18:53:49.584643003  [2024-09-22 18:53:49] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting Frigate..
detectors:
  ov:
    type: openvino
    device: GPU
    model:
      path: /openvino-model/ssdlite_mobilenet_v2.xml
model:
  width: 300
  height: 300
  input_tensor: nhwc
  input_pixel_format: bgr
  path: /openvino-model/ssdlite_mobilenet_v2.xml
  labelmap_path: /openvino-model/coco_91cl_bkgr.txt
version: 0.15-0
root@6c4b6aa98750:/opt/frigate# ls -lth /dev/dri
total 0
crw-rw----. 1 root irc 226,   1 Sep 22 18:54 card1
crw-rw-rw-. 1 root 105 226, 128 Sep 22 18:54 renderD128

@ctml91 what CPU do you have? I am having the same issue with J5005, even on the latest dev Frigate images.