blakeblackshear / frigate

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

Stop sign not detected #1682

Closed backslashV closed 3 years ago

backslashV commented 3 years ago

Describe the bug Hi, I have a stop sign in my garage that I am trying to detect. Sometimes, in frigate's web UI, I can see a blue box around the stop sign showing above 80% probability when the door is moving. However, it isn't ultimately detected. I am using a mask to only monitor the top right corner. Is there a way to fix this?

Photos: https://imgur.com/a/yHplu0t

Version of frigate Output from /api/version 1.13

Config file Include your full config file wrapped in triple back ticks.

  cpu1:
    type: cpu
  cpu2:
    type: cpu

mqtt:
  host: 192.168.1.119
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: myusername
  password: mypass
  stats_interval: 60

cameras:
  garage_cam:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
      inputs:
        - path: rtsp://192.168.1.119:8554/garage-cam
          roles:
            - detect
    width: 1920
    height: 1080
    fps: 5
    objects:
      track:
        - stop sign
    motion:
      mask:
        - 1362,0,1375,450,1920,440,1920,1080,0,1080,0,0

Frigate container logs

 * Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.app                    WARNING : Camera garage_cam has rtmp enabled, but rtmp is not assigned to an input.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
frigate.app                    INFO    : Camera processor started for garage_cam: 43
detector.cpu2                  INFO    : Starting detection process: 39
frigate.app                    INFO    : Capture process started for garage_cam: 44
detector.cpu1                  INFO    : Starting detection process: 38

Frigate stats

Output from frigate's /api/stats endpoint

not sure where to get this!

FFprobe from your camera

Run the following command and paste output below

ffprobe <stream_url>

ffprobe not available in HA terminal

Screenshots If applicable, add screenshots to help explain your problem.

Computer Hardware

Camera Info:

Additional context Add any other context about the problem here.

lawm commented 3 years ago

Maybe there are not enough frames and scores so the average score is not high enough? See https://blakeblackshear.github.io/frigate/configuration/false_positives

Are you trying to use this to detect whether your garage door is open or closed?

backslashV commented 3 years ago

Maybe there are not enough frames and scores so the average score is not high enough? See https://blakeblackshear.github.io/frigate/configuration/false_positives

Are you trying to use this to detect whether your garage door is open or closed?

Yes, I'm trying to detect just that. Unfortunately, I don't quite understand that part of the documentation. Is there a way I can see the scores so I can adjust the threshold accordingly?

lawm commented 3 years ago

At least on 0.8.4, you can go to the camera view, see the live mjpeg view, and click Show Options, and enable the bounding box. I think that shows the scores for each frame, live.

Using RPi and no coral, it will take longer to detect the object. Try about 1-2 seconds of motion because you'll need minimum 3 frames * inference_time to get an average score.

What I would do is just lower the threshold and min score first, then you can see what the average score is in the Events page. Then raise the values back up.

backslashV commented 3 years ago

Thanks. I lowered those and it is now detecting it. For some reason the object count sensor goes from 1 to 0 even when the stop sign is in the stream. Shouldn't it stay at 1 for as long as the sign is visible?

lawm commented 3 years ago

My guess is that if there's no more motion, plus some delay, it stops detecting.

backslashV commented 3 years ago

Oh. I guess I cannot use it for the purpose of detecting the door status after all.

lawm commented 3 years ago

You could try setup a zone at the bottom half when the door is closed. Then, you can get a notification when the stop sign enters or exits that zone. Entering that zone would mean the door is closing. Exiting that zone would mean the door is opening.

https://blakeblackshear.github.io/frigate/usage/mqtt#frigateevents Look at entered_zones to see what zones the object has entered

https://blakeblackshear.github.io/frigate/usage/home-assistant#notifications It's like the 2nd notification example, "When a person enters a zone named yard"

But if there's any missed detection and the door opened/closed, you wouldn't know.

lawm commented 3 years ago

Or you could use other software, like DeepStack, to do object detection on demand, even when there's no movement.

backslashV commented 3 years ago

Thanks. It seems it's still not detecting the sign well at all, maybe 1/10 times. I even tried min_score of 0 and threshold of 0.1. frigate/events are also not sent all the time. I think the latter is because of no detection.

stale[bot] commented 3 years 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.

backslashV commented 3 years ago

Moved the camera closer and that solved the issue.