roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.5k stars 154 forks source link

Mask is completely being ignored... #734

Closed BliXem1 closed 2 months ago

BliXem1 commented 2 months ago

First my config:

mqtt:
  broker: 192.168.0.125
  port: 1883
  username: user
  password: pass
  home_assistant:

## Start by adding some cameras
ffmpeg:
  camera:
    camera_1:  # This value has to be unique across all cameras
      name: Voordeur
      host: 192.168.0.7
      port: 554
      path: h264Preview_01_main
      fps: 15
      protocol: rtsp
      username: hacs
      password: pass

    camera_2:  # This value has to be unique across all cameras
      name: Oprit
      host: 192.168.0.210
      port: 554
      path: h264Preview_01_main
      fps: 15
      protocol: rtsp
      username: hacs
      password: pass

    camera_3:  # This value has to be unique across all cameras
      name: Tuin
      host: 192.168.0.211
      port: 554
      path: h264Preview_01_main
      fps: 15
      protocol: rtsp
      username: hacs
      password: pass

    camera_4:  # This value has to be unique across all cameras
      name: Garage
      host: 192.168.0.212
      port: 554
      path: h264Preview_01_main
      fps: 15
      protocol: rtsp
      username: hacs
      password: pass

## Then add an object detector
codeprojectai:
  host: 192.168.0.125
  port: 32168
  object_detector:
    cameras:
      camera_1:  # Attach detector to the configured camera_1 above
        fps: 1
        scan_on_motion_only: false  # Scan for objects even when there is no motion
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true
      camera_2:  # Attach detector to the configured camera_1 above
        fps: 1
        scan_on_motion_only: false  # Scan for objects even when there is no motion
        mask:
          - coordinates:
              - x: 0
                y: 0
              - x: 0
                y: 122
              - x: 336
                y: 53
              - x: 739
                y: 60
              - x: 751
                y: 0
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true
          - label: vehicle
            confidence: 0.6
            trigger_recorder: true
          - label: cat
            confidence: 0.65
            trigger_recorder: true
          - label: dog
            confidence: 0.65
            trigger_recorder: true
          - label: sports ball
            confidence: 0.65
            trigger_recorder: true
      camera_3:  # Attach detector to the configured camera_1 above
        fps: 1
        scan_on_motion_only: false  # Scan for objects even when there is no motion
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true
      camera_4:  # Attach detector to the configured camera_1 above
        fps: 1
        scan_on_motion_only: false  # Scan for objects even when there is no motion
        labels:
          - label: person
            confidence: 0.7
            trigger_recorder: true
          - label: dog
            confidence: 0.65
            trigger_recorder: true
          - label: cat
            confidence: 0.65
            trigger_recorder: true
  license_plate_recognition:
    cameras:
      camera_2:
    labels:
      - vehicle
    known_plates:
      - plate
    min_confidence: 0.5
    expire_after: 1

mog2:
  motion_detector:
    cameras:
      camera_1:  # Attach detector to the configured camera_2 above
        fps: 1
      camera_2:  # Attach detector to the configured camera_2 above
        fps: 1
      camera_3:  # Attach detector to the configured camera_2 above
        fps: 1
      camera_4:  # Attach detector to the configured camera_2 above
        fps: 1

## To tie everything together we need to configure one more component.
nvr:
  camera_1:  # Run NVR for camera_1
  camera_2:
  camera_3:
  camera_4:
# Now you can restart Viseron and you should be good to go!

I set this up with my camera 2: (this is a screenshot of the live view I copied to "Free online image map" so I can draw what must be ignored. https://ibb.co/VtNFSVs

And still it's detecting the cars:

https://ibb.co/TBfT4W0

Can you tell me what I am doing wrong?

I can't remove the vihicle detection for my garage. Garagedoor opening if license plate has been detected.

BliXem1 commented 2 months ago

fixt, did some changes with the confidance.

bsyomov commented 2 months ago

You can see and debug masks, motion detection, object detection on live view by adding following string to live view URI:

?draw_objects=1&draw_object_mask=1&draw_motion=1&draw_motion_mask=1&draw_zones=1

Something like:

https://somedomain.tld/cam_name/mjpeg-stream?draw_objects=1&draw_object_mask=1&draw_motion=1&draw_motion_mask=1&draw_zones=1