blakeblackshear / frigate

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

Bug: wrong camera dimension calculation for birdseye #6802

Closed skrashevich closed 1 year ago

skrashevich commented 1 year ago

Describe the problem you are having

2023-06-14 21:37:08.347713182  Traceback (most recent call last):
2023-06-14 21:37:08.347717528    File "/opt/frigate/frigate/output.py", line 549, in update
2023-06-14 21:37:08.347718362      updated_frame = self.update_frame()
2023-06-14 21:37:08.347719160    File "/opt/frigate/frigate/output.py", line 525, in update_frame
2023-06-14 21:37:08.347719827      self.copy_to_position(
2023-06-14 21:37:08.347720573    File "/opt/frigate/frigate/output.py", line 251, in copy_to_position
2023-06-14 21:37:08.347721350      copy_yuv_to_position(
2023-06-14 21:37:08.347722078    File "/opt/frigate/frigate/util.py", line 481, in copy_yuv_to_position
2023-06-14 21:37:08.347722667      destination_frame[
2023-06-14 21:37:08.347723383  ValueError: could not broadcast input array from shape (1080,1920) into shape (1080,1280)

this bug introduced in PR #6734 if I comment out this lines:

 if camera_aspect < canvas_aspect:
                    camera_dims[0] *= camera_aspect / canvas_aspect
                    camera_dims[1] *= camera_aspect / canvas_aspect

always will work again

Version

dev-ff1b5c8

Frigate config file

detectors:
  deepstack:      
    type: deepstack
    api_url: http://192.168.88.50:5500/v1/vision/custom/ipcam-yolov5x6
    api_timeout: 0.5

go2rtc:
  ffmpeg:
    h264_nvenc: "-codec:v h264_nvenc -preset:v medium -b:v 4096k -maxrate 4096k -bufsize 4096k -r 24 -pix_fmt yuv420p -g 48"

  rtsp:
    default_query: "video&audio"

  webrtc:
    listen: ":8555"
    candidates:
      - 192.168.88.60:8555

  streams:
    kitchen: "rtsp://192.168.88.18:8080/video/h264#audio=aac#audio=pcm"
    livingroom: "rtsp://192.168.88.178:8080/video/h264#audio=aac"
    yard: rtsp://192.168.88.50:8554/yard
    secondfloor: rtsp://192.168.88.50:8554/secondfloor
    welcome: rtsp://192.168.88.50:8554/welcome

birdseye:
  enabled: True
  mode: continuous
  restream: True

ffmpeg:
  global_args: -hide_banner -loglevel debug
  hwaccel_args: preset-nvidia-h264
  #input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  input_args: preset-rtsp-restream
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v hevc_nvenc -tag:v hvc1 -c:a copy

record:
  enabled: True
  expire_interval: 60
  retain:
    days: 10
    mode: motion
  events:
    pre_capture: 30
    post_capture: 120
    retain:
      default: 7
      mode: motion
      objects:
        person: 180
        bottle: 1
        car: 7

snapshots:
  enabled: True
  height: 1080

cameras:
  livingroom:
    ffmpeg:
      inputs:
        - path: rtsp://localhost:8554/livingroom
          roles:
            - detect
            - record
    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      height: 1080
      quality: 100
    detect:
      fps: 10
      width: 1920
      height: 1080
    motion:
      mask:
        - 1763,0,1920,368,1268,506,924,530,789,509,695,509,686,537,680,633,659,899,0,886,0,0

  kitchen:
    ffmpeg:
      inputs:

        - path: rtsp://localhost:8554/kitchen
          roles:
            - detect
            - record

    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      height: 960
      quality: 100
    detect:
      fps: 10
      width: 1280
      height: 960
  yard:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.88.50:8554/yard
          roles:
            - detect
            - record

    detect:
      width: 1920
      height: 1080
      fps: 5
    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      height: 1080
      quality: 100

    motion:
      mask:
        - 0,0,0,720,273,720,262,535,410,518,647,477,662,236,966,253,972,0
        - 1280,0,1280,692,1103,607,1058,602,1054,720,943,720,965,0
    zones:
      gates:
        coordinates: 783,278,775,337,694,327,696,269
    record:
      events:
        pre_capture: 30
        post_capture: 120
        retain:
          default: 7
          mode: motion

  secondfloor:
    ffmpeg:
      inputs:

        - path: rtsp://192.168.88.50:8554/secondfloor
          roles:
            - detect
            - record

      hwaccel_args: preset-nvidia-h264
    detect:
      width: 1920
      height: 1080
      fps: 10
    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      height: 1080
      quality: 100

  welcome:
    ffmpeg:
      inputs:

        - path: rtsp://192.168.88.50:8554/welcome
          roles:
            - detect
            - record
      hwaccel_args: preset-nvidia-h264

    detect:
      width: 1920
      height: 1080
      fps: 10
    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 1080
  terasse:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.88.50:8554/terasse?mp4 #rtsp://192.168.88.50:8554/terasse?mp4
          roles:
            - detect
            - record
              #- path: "rtsp://192.168.88.195:554/user=admin_password=QuuOEfOI_channel=0_stream=0.sdp?real_stream#hardware=cuda"
              #roles:
              #- restream
      hwaccel_args: preset-nvidia-h264

    mqtt:
      enabled: True
      timestamp: False
      bounding_box: False
      crop: True
      height: 1288
      quality: 100
    detect:
      width: 2288
      height: 1288
      fps: 10

Relevant log output

2023-06-14 21:37:08.347713182  Traceback (most recent call last):
2023-06-14 21:37:08.347717528    File "/opt/frigate/frigate/output.py", line 549, in update
2023-06-14 21:37:08.347718362      updated_frame = self.update_frame()
2023-06-14 21:37:08.347719160    File "/opt/frigate/frigate/output.py", line 525, in update_frame
2023-06-14 21:37:08.347719827      self.copy_to_position(
2023-06-14 21:37:08.347720573    File "/opt/frigate/frigate/output.py", line 251, in copy_to_position
2023-06-14 21:37:08.347721350      copy_yuv_to_position(
2023-06-14 21:37:08.347722078    File "/opt/frigate/frigate/util.py", line 481, in copy_yuv_to_position
2023-06-14 21:37:08.347722667      destination_frame[
2023-06-14 21:37:08.347723383  ValueError: could not broadcast input array from shape (1080,1920) into shape (1080,1280)

Frigate stats

No response

Operating system

UNRAID

Install method

Docker CLI

Coral version

USB

Any other information that may be helpful

No response

skrashevich commented 1 year ago

fixed in #6818