blakeblackshear / frigate

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

[Support]: Bug with Frigate+ upload #5515

Closed DubhAd closed 1 year ago

DubhAd commented 1 year ago

Describe the problem you are having

Attempting to upload a snapshot that has no object (tagged) in it generates an error and a failure to upload.

Uploading a snapshot with a tagged object works 100% of the time.

Version

0.12.0-27A31E7 (beta8)

Frigate config file

ffmpeg:
  hwaccel_args: preset-vaapi

go2rtc:
  streams:
    front: rtsp://192.168.0.42/ISAPI/Streaming/channels/101/
    front_low: rtsp://192.168.0.42/ISAPI/Streaming/channels/102/
  webrtc:
    listen: ":8555"
    candidates:
      - 192.168.0.16:8555
      - stun:8555
  log:
    format: text

mqtt:
  host: 192.168.0.16
  user: frigate
  password: password

detectors:
  coral:
    type: edgetpu
    device: usb

cameras:
  front:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://localhost:8554/front?video=copy&audio=copy
          input_args: preset-rtsp-restream-low-latency
          roles:
            - record
            - detect
    live:
      stream_name: front_low
    detect:
      width: 2688
      height: 1520
      fps: 20
    record:
      events:
        required_zones:
          - front_path
          - drive
          - road
    snapshots:
      required_zones:
        - front_path
        - drive
        - road
    motion:
      mask:
        - 0,0,2688,0,2688,1520,1565,1520,1528,1062,1207,1085,859,1094,474,1075,70,1035,78,1267,90,1520,0,1520
    zones:
      front_path:
        coordinates: 1220,1370,1536,1395,1546,1520,88,1520,65,1303,884,1335
      drive:
        coordinates: 1220,1370,1536,1395,1546,1273,884,1335
      road:
        coordinates: 62,796,1491,929,1546,1278,1440,1258,1428,1057,809,1057,824,1307,1248,1278,1440,1257,1546,1273,884,1335,65,1303

objects:
  track:
    - person
    - car
    - bus
    - motorcycle
    - bicycle
    - dog

record:
  enabled: True
  retain:
    days: 7
    mode: all
  events:
    retain:
      default: 90
      mode: active_objects
    pre_capture: 15
    post_capture: 30

Relevant log output

16/02/2023 14:44:32 2023-02-16 14:44:32.830810534  [2023-02-16 14:44:32] frigate.http                   ERROR   : 'NoneType' object has no attribute 'shape'
16/02/2023 14:44:32 2023-02-16 14:44:32.830814795  Traceback (most recent call last):
16/02/2023 14:44:32 2023-02-16 14:44:32.830818986    File "/opt/frigate/frigate/http.py", line 206, in send_to_plus
16/02/2023 14:44:32 2023-02-16 14:44:32.830824294      plus_id = current_app.plus_api.upload_image(image, event.camera)
16/02/2023 14:44:32 2023-02-16 14:44:32.830827717    File "/opt/frigate/frigate/plus.py", line 92, in upload_image
16/02/2023 14:44:32 2023-02-16 14:44:32.830831559      files = {"file": get_jpg_bytes(image, 1920, 85)}
16/02/2023 14:44:32 2023-02-16 14:44:32.830835330    File "/opt/frigate/frigate/plus.py", line 16, in get_jpg_bytes
16/02/2023 14:44:32 2023-02-16 14:44:32.830840150      if image.shape[1] >= image.shape[0]:
16/02/2023 14:44:32 2023-02-16 14:44:32.830844341  AttributeError: 'NoneType' object has no attribute 'shape'

FFprobe output from your camera

ffprobe version 4.3.5-0+deb11u1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://192.168.0.42/ISAPI/Streaming/channels/101/':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.300000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 2688x1520, 20 fps, 20 tbr, 90k tbn, 40 tbc

Frigate stats

{"cpu_usages":{"%Cpu(s):":{"cpu":"id,","mem":"0.0"},"1":{"cpu":"0.0","mem":"0.0"},"102":{"cpu":"2.3","mem":"2.0"},"112":{"cpu":"0.0","mem":"0.0"},"128":{"cpu":"0.0","mem":"0.0"},"129":{"cpu":"0.0","mem":"0.0"},"130":{"cpu":"0.0","mem":"0.0"},"131":{"cpu":"0.0","mem":"0.0"},"132":{"cpu":"0.0","mem":"0.0"},"141":{"cpu":"0.0","mem":"0.3"},"15":{"cpu":"0.0","mem":"0.0"},"156":{"cpu":"0.0","mem":"0.0"},"16":{"cpu":"0.0","mem":"0.0"},"180":{"cpu":"0.0","mem":"0.0"},"218":{"cpu":"0.0","mem":"0.0"},"24":{"cpu":"0.0","mem":"0.0"},"25":{"cpu":"0.0","mem":"0.0"},"26":{"cpu":"0.0","mem":"0.0"},"267":{"cpu":"0.0","mem":"0.0"},"27":{"cpu":"0.0","mem":"0.0"},"28":{"cpu":"0.0","mem":"0.0"},"29":{"cpu":"0.0","mem":"0.0"},"30":{"cpu":"0.0","mem":"0.0"},"304":{"cpu":"0.0","mem":"0.0"},"31":{"cpu":"0.0","mem":"0.0"},"322":{"cpu":"0.0","mem":"0.0"},"40":{"cpu":"0.0","mem":"0.0"},"41":{"cpu":"0.0","mem":"0.0"},"554":{"cpu":"0.0","mem":"0.2"},"560":{"cpu":"0.3","mem":"0.0"},"561":{"cpu":"0.0","mem":"0.3"},"562":{"cpu":"2.0","mem":"0.3"},"569":{"cpu":"3.7","mem":"0.6"},"570":{"cpu":"0.0","mem":"0.0"},"571":{"cpu":"19.3","mem":"0.3"},"575":{"cpu":"0.0","mem":"0.1"},"576":{"cpu":"25.3","mem":"0.8"},"69225":{"cpu":"0.0","mem":"0.0"},"78":{"cpu":"0.0","mem":"0.0"},"80":{"cpu":"0.0","mem":"0.0"},"81":{"cpu":"0.0","mem":"0.0"},"88":{"cpu":"10.0","mem":"0.2"},"MiB":{"cpu":"9084.7","mem":"avail"},"PID":{"cpu":"%CPU","mem":"%MEM"},"Tasks:":{"cpu":"stopped,","mem":"0"},"top":{"cpu":"0","mem":"users,"}},"detection_fps":0.0,"detectors":{"coral":{"detection_start":0.0,"inference_speed":8.2,"pid":561}},"front":{"camera_fps":20.0,"capture_pid":571,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":576,"pid":569,"process_fps":20.0,"skipped_fps":0.0},"gpu_usages":{"amd-vaapi":{"gpu":"5.83 %","mem":"7.82 %"}},"service":{"last_updated":1676558943,"latest_version":"0.11.1","storage":{"/dev/shm":{"free":260.9,"mount_type":"tmpfs","total":268.4,"used":7.5},"/media/frigate/clips":{"free":115922.3,"mount_type":"ext4","total":471371.7,"used":331429.8},"/media/frigate/recordings":{"free":115922.3,"mount_type":"ext4","total":471371.7,"used":331429.8},"/tmp/cache":{"free":910224.5,"mount_type":"ext4","total":983424.2,"used":23172.8}},"temperatures":{},"uptime":166287,"version":"0.12.0-27a31e7"}}

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

HiWatch IPC-T140

Any other information that may be helpful

Frigate 0.11.1 has the same error.

6/02/2023 14:49:55 [2023-02-16 14:49:55] frigate.http                   ERROR   : 'NoneType' object has no attribute 'shape'
16/02/2023 14:49:55 Traceback (most recent call last):
16/02/2023 14:49:55   File "/opt/frigate/frigate/http.py", line 180, in send_to_plus
16/02/2023 14:49:55     plus_id = current_app.plus_api.upload_image(image, event.camera)
16/02/2023 14:49:55   File "/opt/frigate/frigate/plus.py", line 92, in upload_image
16/02/2023 14:49:55     files = {"file": get_jpg_bytes(image, 1920, 85)}
16/02/2023 14:49:55   File "/opt/frigate/frigate/plus.py", line 16, in get_jpg_bytes
16/02/2023 14:49:55     if image.shape[1] >= image.shape[0]:
16/02/2023 14:49:55 AttributeError: 'NoneType' object has no attribute 'shape'
NickM-27 commented 1 year ago

Sorry I don't 100% understand, are you using the "Upload to Frigate+" button? What do you mean by tagged?

DubhAd commented 1 year ago

Yes, I'm using that button with an image that Frigate found nothing in - no objects are tagged. Frigate did find an object to trigger the event, but the snapshot chosen was clear of all tags. It happens sometimes for events still in progress.

If I come back to it when the event ends (which sometimes takes a while - ( 2h 52m 41s ) for example) then a new snapshot will have been chosen, with objects tagged.

NickM-27 commented 1 year ago

Yes, I'm using that button with an image that Frigate found nothing in - no objects are tagged. Frigate did find an object to trigger the event, but the snapshot chosen was clear of all tags. It happens sometimes for events still in progress.

If I come back to it when the event ends (which sometimes takes a while - ( 2h 52m 41s ) for example) then a new snapshot will have been chosen, with objects tagged.

I think there's some slight confusion, for in progress events frigate does not include bounding boxes showing that imagine in the UI. The snapshot will always be from when frigate saw that object. In any case, that makes sense and I'll take a look.

blakeblackshear commented 1 year ago

There is a bug when uploading an in progress event because the clean snapshot is not available on disk.