blakeblackshear / frigate

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

[Detector Support]: No EdgeTPU was detected #8811

Closed cliffburdick closed 9 months ago

cliffburdick commented 9 months ago

Describe the problem you are having

I got a new USB Coral, followed their instructions, modified by config from my old TRT one, and tried the container. I also tried both adding it as a device and a volume in the compose config, but neither worked. I did verify that the coral is detected as a USB device with the Google name, which I think that means it got enough power:

Bus 004 Device 004: ID 18d1:9302 Google Inc.

Version

0.13.0-614a36a

Frigate config file

mqtt:
  enabled: False

detectors:
  coral:
    type: edgetpu
    device: usb

model:
  path: /config/model_cache/tensorrt/yolov7-320.trt
  input_tensor: nchw
  input_pixel_format: rgb
  width: 416
  height: 416

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - car
    - dog
    - cat
    - motorcycle
    - horse
    - bicycle

cameras:
  lower_wb: # <------ Name the camera
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-aac        
      hwaccel_args: preset-nvidia-h264
      inputs:
        - path: rtsp://admin:pass!@192.168.1.170:554/cam/realmonitor?channel=1&subtype=2 # <----- The stream you want to use for detection
          roles:
            - detect
        - path: rtsp://admin:pass!@192.168.1.170:554 # <----- The stream you want to use for detection
          roles:
            - record
    detect:
      enabled: True # <---- disable detection until you have a working camera feed
      width: 1920 # <---- update for your camera's resolution
      height: 1080 # <---- update for your camera's resolution
      fps: 5
      stationary:
        # Optional: Frequency for confirming stationary objects (default: shown below)
        # When set to 0, object detection will not confirm stationary objects until movement is detected.
        # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
        interval: 10
        # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
        threshold: 50              
    record:
      enabled: True
      retain:
        days: 1
        mode: all
      events:
        retain:
          default: 10
          mode: active_objects
    motion:
      mask:    
        - 1280,398,1121,212,852,0,383,0,292,94,191,145,140,200,0,251,26,458,199,720,1280,720 
    zones:  
      front_and_street:
        coordinates: 1428,161,922,150,739,411,651,480,490,560,517,632,478,707,342,821,373,881,234,1013,258,1080,1920,1080,1920,251
        objects:
          - person
          - car
          - cat
          - bicycle
          - dog
          - motorcycle

  upper_wb: # <------ Name the camera
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-aac        
      hwaccel_args: preset-nvidia-h264
      inputs:
        - path: rtsp://admin:pass!@192.168.1.172:554/cam/realmonitor?channel=1&subtype=2 # <----- The stream you want to use for detection
          roles:
            - detect
        - path: rtsp://admin:pass!@192.168.1.172:554 # <----- The stream you want to use for detection
          roles:
            - record            
    detect:
      enabled: True # <---- disable detection until you have a working camera feed
      width: 1920 # <---- update for your camera's resolution
      height: 1080 # <---- update for your camera's resolution
      fps: 5
      stationary:
        # Optional: Frequency for confirming stationary objects (default: shown below)
        # When set to 0, object detection will not confirm stationary objects until movement is detected.
        # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
        interval: 10
        # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
        threshold: 50 
    record:
      enabled: True
      retain:
        days: 1
        mode: all
      events:
        retain:
          mode: active_objects
          default: 10
    motion:
      mask:    
        - 1243,535,1280,183,1118,73,877,68,854,0,185,0,43,89,65,192,0,251,0,720,1147,720
    zones:  
      driveway_and_street:
        coordinates:  391,0,1868,0,1968,137,2358,127,2375,261,2238,527,2575,657,2688,1520,0,1520,0,277
        objects:
          - person
          - car
          - bicycle
          - cat
          - dog
          - motorcycle
  porch: # <------ Name the camera
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-aac        
      hwaccel_args: preset-nvidia-h264
      inputs:
        - path: rtsp://admin:pass@192.168.1.171:554/cam/realmonitor?channel=1&subtype=2 # <----- The stream you want to use for detection
          roles:
            - detect      
        - path: rtsp://admin:pass@192.168.1.171:554 # <----- The stream you want to use for detection
          roles:
            - record
    record:
      enabled: True
      retain:
        days: 1
        mode: all
      events:
        retain:
          mode: active_objects
          default: 10            
    detect:
      enabled: True # <---- disable detection until you have a working camera feed
      width: 1920 # <---- update for your camera's resolution
      height: 1080 # <---- update for your camera's resolution
      fps: 5
      stationary:
        # Optional: Frequency for confirming stationary objects (default: shown below)
        # When set to 0, object detection will not confirm stationary objects until movement is detected.
        # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
        interval: 10
        # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
        threshold: 50        
    motion:
      mask:    
        - 1280,117,1161,95,1089,165,805,131,530,97,387,147,334,0,0,0,0,720,1280,720
    zones:  
      porch_and_lawn:
        coordinates: 2688,0,2381,244,2315,347,1945,261,1618,244,1178,187,931,267,735,0,0,0,0,1520,2688,1520
        objects:
          - person
          - car
          - bicycle
          - cat
          - dog
          - motorcycle

docker-compose file or Docker CLI command

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:0.13.0-beta6
    shm_size: "512mb" # 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/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/cburdick/frigate/config:/config
      - /mnt/media/frigate:/media/frigate
      - /dev/bus/usb:/dev/bus/usb
        #- /home/cburdick/frigate/trt-models:/trt-models
      - 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:
      FRIGATE_RTSP_PASSWORD: "pw"
      YOLO_MODELS: "yolov7-tiny-416,yolov7-320"
      PLUS_API_KEY: "key"
    deploy:    # <------------- Add this section
      resources:
        reservations:
          devices:
            - driver: nvidia
              #              device_ids: ['0'] # this is only needed when using multiple GPUs
              count: 1 # number of GPUs
              capabilities: [gpu]

Relevant log output

frigate  | 2023-11-30 20:52:01.453821113  [2023-11-30 20:51:58] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
frigate  | 2023-11-30 20:52:01.455252596  Process detector:coral:
frigate  | 2023-11-30 20:52:01.455284095  [2023-11-30 20:52:01] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found
frigate  | 2023-11-30 20:52:01.455563673  [2023-11-30 20:52:01] frigate.detectors.plugins.edgetpu_tfl ERROR   : No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors.
frigate  | 2023-11-30 20:52:01.456891231  Traceback (most recent call last):
frigate  | 2023-11-30 20:52:01.456898913    File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
frigate  | 2023-11-30 20:52:01.456903732      self.run()
frigate  | 2023-11-30 20:52:01.456908132    File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
frigate  | 2023-11-30 20:52:01.456915256      self._target(*self._args, **self._kwargs)
frigate  | 2023-11-30 20:52:01.456919936    File "/opt/frigate/frigate/object_detection.py", line 102, in run_detector
frigate  | 2023-11-30 20:52:01.456926012      object_detector = LocalObjectDetector(detector_config=detector_config)
frigate  | 2023-11-30 20:52:01.456951853    File "/opt/frigate/frigate/object_detection.py", line 53, in __init__
frigate  | 2023-11-30 20:52:01.456956044      self.detect_api = create_detector(detector_config)
frigate  | 2023-11-30 20:52:01.456984540    File "/opt/frigate/frigate/detectors/__init__.py", line 18, in create_detector
frigate  | 2023-11-30 20:52:01.456988730      return api(detector_config)
frigate  | 2023-11-30 20:52:01.456992990    File "/opt/frigate/frigate/detectors/plugins/edgetpu_tfl.py", line 43, in __init__
frigate  | 2023-11-30 20:52:01.456997251      self.interpreter = Interpreter(
frigate  | 2023-11-30 20:52:01.457002070    File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 348, in __init__
frigate  | 2023-11-30 20:52:01.457004933      _interpreter_wrapper.CreateWrapperFromFile(
frigate  | 2023-11-30 20:52:01.457009333  ValueError: Model provided has model identifier '
frigate  | 2023-11-30 20:52:07.864273129  [INFO] Starting go2rtc healthcheck service...
frigate  | 2023-11-30 20:52:19.064686870  [2023-11-30 20:52:19] frigate.watchdog               INFO    : Detection appears to have stopped. Exiting Frigate...
frigate  | s6-rc: info: service legacy-services: stopping
frigate  | s6-rc: info: service legacy-services successfully stopped


### Operating system

Debian

### Install method

Docker Compose

### Coral version

USB

### Any other information that may be helpful

_No response_
NickM-27 commented 9 months ago

You are still trying to run a tensorrt model, this is not compatible with the coral

cliffburdick commented 9 months ago

Thanks @NickM-27. I understood that the model is wrong and I was going to update that, but this message was telling me that the hardware is not found. Are you saying I'll get this error if the model type is wrong and the device is found?

NickM-27 commented 9 months ago

The device is not able to load the model, the error will be the same because in both cases the device didn't respond

cliffburdick commented 9 months ago

Thanks @NickM-27 , that fixed it.