blakeblackshear / frigate

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

[Support]: Person count = 1 when night mode activated on camera #5311

Closed krustophenia closed 1 year ago

krustophenia commented 1 year ago

Describe the problem you are having

When the night mode starts, the camera entity person_count increases to 1 for a random period of time (it can be a couple of hours, 6...) and even checking on debug mode there's no person detected anywhere.

Version

0.11.1-2eada21

Frigate config file

mqtt:
  host: 192.168.1.250
  user: xesqui
  password: XXXXXXXXXX
detectors:
  coral:
    type: edgetpu
    device: usb
cameras:
  Cam_Piscina:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXXXXXX@192.168.1.240:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - detect
        - path: rtsp://admin:mXXXXXXXX@192.168.1.240:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
    motion:
      improve_contrast: true
    zones:  
      piscina_exterior:
        coordinates: 440,173,644,84,976,31,989,0,519,0,0,108,0,436  
      piscina_interior:
        coordinates: 0,848,452,926,1142,960,1230,730,1209,315,1015,33,855,57,650,93,560,120,0,437
    objects:
      track:
        - person
        - dog
        - bird
      filters:
        person:
          threshold: 0.65
          min_score: 0.60
  Cam_Passadis:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.242:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - detect
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.242:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
    motion:
      improve_contrast: true
    zones:  
      passadis_exterior:
        coordinates: 916,412,381,181,208,182,294,0,1280,0,1280,611  
      passadis_interior:
        coordinates: 820,469,1280,751,1280,960,224,960,138,681,133,548,165,347,191,272,200,184,368,194
    objects:
      track:
        - person
        - dog
        - bird
      filters:
        person:
          threshold: 0.65
          min_score: 0.60
  Cam_Parking:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.243:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - detect
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.243:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
    motion:
      improve_contrast: true
    zones:  
      parking_exterior:
        coordinates: 219,103,0,256,0,59,2,0,441,0,448,60  
      parking_interior:
        coordinates: 0,960,1280,960,1280,0,465,0,448,55,199,108,2,260
    objects:
      track:
        - person
        - dog
        - bird
      filters:
        person:
          threshold: 0.65
          min_score: 0.60
  Cam_Frontal:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.244:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - detect
        - path: rtsp://admin:XXXXXXXX!!@192.168.1.244:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
    motion:
      improve_contrast: true
    zones:  
      frontal_exterior:
        coordinates: 1280,627,623,282,266,143,83,135,75,110,235,95,681,152,708,195,1280,381  
      frontal_interior:
        coordinates: 592,272,356,175,278,148,66,136,17,289,0,507,48,740,180,960,1280,960,1280,960,1280,960,1280,630
    objects:
      track:
        - person
        - dog
        - bird
      filters:
        person:
          threshold: 0.65
          min_score: 0.60
  Cam_Menjador:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.241/live0
          roles:
            - detect
            - record
    motion:
      improve_contrast: true
    objects:
      track:
        - person
        - dog
      filters:
        person:
          threshold: 0.65
          min_score: 0.60

detect:
  width: 1280
  height: 960
  fps: 5
  enabled: True
  max_disappeared: 25

record:
  enabled: True
  events:
    retain:
      default: 10

snapshots:
  enabled: true
  timestamp: true
  bounding_box: true
  retain:
    default: 10

timestamp_style:
  position: "br"
  format: "%d/%m/%Y %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2

birdseye:
  enabled: True
  width: 1280
  height: 720
resources.
  quality: 15
  mode: motion

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2023-01-30 20:23:15] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
[2023-01-30 20:23:16] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2023-01-30 20:23:16] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2023-01-30 20:23:16] peewee_migrate                 INFO    : There is nothing to migrate
[2023-01-30 20:23:16] frigate.app                    INFO    : Output process started: 217
[2023-01-30 20:23:16] detector.coral                 INFO    : Starting detection process: 216
[2023-01-30 20:23:16] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2023-01-30 20:23:16] ws4py                          INFO    : Using epoll
[2023-01-30 20:23:16] frigate.app                    INFO    : Camera processor started for Cam_Piscina: 224
[2023-01-30 20:23:16] frigate.app                    INFO    : Camera processor started for Cam_Passadis: 227
[2023-01-30 20:23:16] frigate.app                    INFO    : Camera processor started for Cam_Parking: 229
[2023-01-30 20:23:16] frigate.app                    INFO    : Camera processor started for Cam_Frontal: 231
[2023-01-30 20:23:16] frigate.app                    INFO    : Camera processor started for Cam_Menjador: 233
[2023-01-30 20:23:16] frigate.app                    INFO    : Capture process started for Cam_Piscina: 235
[2023-01-30 20:23:16] frigate.app                    INFO    : Capture process started for Cam_Passadis: 239
[2023-01-30 20:23:16] frigate.app                    INFO    : Capture process started for Cam_Parking: 250
[2023-01-30 20:23:16] frigate.app                    INFO    : Capture process started for Cam_Frontal: 253
[2023-01-30 20:23:16] frigate.app                    INFO    : Capture process started for Cam_Menjador: 259
[2023-01-30 20:23:16] ws4py                          INFO    : Using epoll
[2023-01-30 20:23:21] frigate.edgetpu                INFO    : TPU found
[2023-01-30 20:25:24] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:56752]
[2023-01-30 20:25:36] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:56752]

FFprobe output from your camera

root@ccab4aaf-frigate:/opt/frigate# ffprobe rtsp://admin:'XXXXXXX!!'@192.168.1.243:554/cam/realmonitor?channel=1&subtype=0
[1] 818
root@ccab4aaf-frigate:/opt/frigate# ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[rtsp @ 0x55b60fcf7140] method DESCRIBE failed: 404 Not Found
rtsp://admin:XXXXXXX!!@192.168.1.243:554/cam/realmonitor?channel=1: Server returned 404 Not Found

Frigate stats

{"Cam_Frontal":{"camera_fps":5.0,"capture_pid":241,"detection_fps":0.1,"pid":229,"process_fps":5.1,"skipped_fps":0.0},"Cam_Menjador":{"camera_fps":5.1,"capture_pid":243,"detection_fps":0.1,"pid":231,"process_fps":5.3,"skipped_fps":0.0},"Cam_Parking":{"camera_fps":5.0,"capture_pid":238,"detection_fps":0.1,"pid":228,"process_fps":5.0,"skipped_fps":0.0},"Cam_Passadis":{"camera_fps":5.0,"capture_pid":234,"detection_fps":0.1,"pid":225,"process_fps":5.0,"skipped_fps":0.0},"Cam_Piscina":{"camera_fps":5.0,"capture_pid":232,"detection_fps":2.0,"pid":223,"process_fps":3.9,"skipped_fps":0.0},"detection_fps":2.4,"detectors":{"coral":{"detection_start":1675108125.17917,"inference_speed":163.68,"pid":216}},"service":{"latest_version":"0.11.1","storage":{"/dev/shm":{"free":2505.0,"mount_type":"tmpfs","total":2523.9,"used":19.0},"/media/frigate/clips":{"free":143447.8,"mount_type":"ext4","total":209230.8,"used":55080.1},"/media/frigate/recordings":{"free":143447.8,"mount_type":"ext4","total":209230.8,"used":55080.1},"/tmp/cache":{"free":2509.6,"mount_type":"tmpfs","total":2523.9,"used":14.4}},"temperatures":{},"uptime":22,"version":"0.11.1-2eada21"}}

Operating system

Debian

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

amcrest ‎IP5M-B1186EW-28MM

Any other information that may be helpful

When setting the switch from day to night mode automatically the error popped on one of the cameras. Switching it to schedule fixed it. The other camera that showed this same behaviour had the same configuration (auto switch) (profile management > Day/night). Is maybe an issue with the way the cameras switch the modes?

NickM-27 commented 1 year ago

night mode itself won't affect this, most likely it saw a person. What did you do to check the debug live view? (what switches are enabled)

more info is needed to help with this, but I'd say this is most likely just a false positive

krustophenia commented 1 year ago

Screenshot_2023-01-30-19-51-56-655_io homeassistant companion android minimal

IMG_20230128_010459 IMG_20230128_010517

There you can see one of the cameras on debug when that was happening and the two entities (the cuts on the graph are because I tried to restart HA, frigate and the cameras). Trust me, nobody was there for that amount of time.

NickM-27 commented 1 year ago

Your debug screenshot is not helpful in terms of knowing if frigate sees a person or not. That screen is just for editing the zones and masks.

Trust me, nobody was there for that amount of time.

Sure, but it could easily be a false positive where frigate thinks it sees a person. I still think this is the case as nothing has been shown to show otherwise.

krustophenia commented 1 year ago

I've done a test and it was detecting a person where there was a chair on the patio. I removed the chair and the person count was still 1. Is there a way to make it update faster? Is it still a false positive?

krustophenia commented 1 year ago

Just found out that if I restart home assisstant, those entities go back to 0... Any idea?

NickM-27 commented 1 year ago

I've done a test and it was detecting a person where there was a chair on the patio. I removed the chair and the person count was still 1. Is there a way to make it update faster? Is it still a false positive?

It updates immediately so if it shows 1 then it still sees something as a person

Just found out that if I restart home assisstant, those entities go back to 0... Any idea?

Right... because restarting it makes it lose current detections and then it restarts it doesn't see the false positive anymore

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

renorg commented 7 months ago

Hi, i would like to come back on this problem, as i got exactly the same. Like krustophenia, this happens only in night mode. I'm sure there is no false positive detection because frigate makes records for all person detection, and in this case, there's no record. I would like to use this detection to switch on a light, but in this case, the light is always on 😅 Don't you have an idea about this ghost presence? 😁 Thanks a lot