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.66k stars 171 forks source link

Darknet zones and labels #807

Open ceewanna opened 2 weeks ago

ceewanna commented 2 weeks ago

I have recently explored darknet and observed that using zones with labels under each zone without any label specified under camera resulted in recording but there was no objects shown in log file. The logging of objects will only appear when there are labels specified under camera.

In the past I only made use of labels under camera and mask. However, when I look in the document about zones I wonder what would be the appropriate setting of labels for zones and cameras (which to me seems to be a higher level). How do we set Zone/Label and Camera/Label? What if there are conflicts between the setting of Camera/Label and Zone/Label?

  cam2:
    fps: !secret cam2_fps
    scan_on_motion_only: !secret default_scan_on_motion_only
    # labels:
    #   - label: car
    #     confidence: 0.1
    #     trigger_recorder: true
    #     require_motion: true
    #   - label: person
    #     confidence: 0.1
    #     trigger_recorder: true
    #     require_motion: true
    #   - label: truck
    #     confidence: 0.1
    #     trigger_recorder: true
    #     require_motion: true
    #   - label: bicycle
    #     confidence: 0.1
    #     trigger_recorder: true
    #     require_motion: true
    #   - label: motorcycle
    #     confidence: 0.1
    #     trigger_recorder: true
    #     require_motion: true
    mask:
      - coordinates:  # upper area
        - x: 1
          y: 1
        - x: 640
          y: 1
        - x: 640
          y: 140
        - x: 0
          y: 140
    zones:
      - name: road
        coordinates:  # 187,140,190,227,534,234,534,141
          - x: 187
            y: 140
          - x: 190
            y: 227
          - x: 534
            y: 234
          - x: 534
            y: 141
        labels:
          - label: car
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
          - label: person
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
          - label: truck
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
          - label: bicycle
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
          - label: motorcycle
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
      - name: offroad
        coordinates:  # 3,357,0,156,636,157,639,355
          - x: 0
            y: 360
          - x: 0
            y: 156
          - x: 640
            y: 156
          - x: 640
            y: 360
        labels:
          - label: person
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
            # width_max: 0.2
            # height_max: 0.3
            # width_min: 0.01
            # height_min: 0.04
          - label: cat
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
          - label: dog
            confidence: 0.1
            trigger_recorder: true
            require_motion: true
roflcoopter commented 2 weeks ago

I have recently explored darknet and observed that using zones with labels under each zone without any label specified under camera resulted in recording but there was no objects shown in log file. The logging of objects will only appear when there are labels specified under camera.

Interesting, will take a look at that.

In the past I only made use of labels under camera and mask. However, when I look in the document about zones I wonder what would be the appropriate setting of labels for zones and cameras (which to me seems to be a higher level). How do we set Zone/Label and Camera/Label? What if there are conflicts between the setting of Camera/Label and Zone/Label?

Not sure i understand the question fully. The camera labels and the zone labels are completely separate so if there is overlap both will trigger recordings (essentially making the zone redundant)

ceewanna commented 2 weeks ago

The camera labels and the zone labels are completely separate so if there is overlap both will trigger recordings (essentially making the zone redundant)

My use case so far are 1) labels under cameras + (optional) some masks and 2) labels under zones + (optional) some masks (without any labels under cameras).

Case 1) everything seemed to work fine with labels and motion detected, including "End event" Case 2) resulted in no labels shown in log file but it seemed to perform recordings fine. Only motion detected and "End event" shown in log.

On case 2) when some labels are added under camera, the log file will contains labels of object detected (which looked similar to in case 1).