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.51k stars 155 forks source link

Requested feature to use a `custom_model` per camera? #700

Open wjbridge opened 5 months ago

wjbridge commented 5 months ago

First off, let me say that this opensouce project is amazing! This has streamlined my AI processing integration with HA a ton! I was experimenting with the Codeproject AI block. I have one camera that I want to detect a cat object and another camera that I want to detect a postal package so I can get a notification.

Using the default dataset coco, I can detect the cat as this model has been trained to do this. I separately trained a custom model to detect postal packages but I realized that you can't configure Viseron to use this model for a particular camera. I know I can train a custom model with all objects but I don't have the hw resources to do this easily. This led me to the question if it would be possible to map the custom_model to a camera for the codeprojectai component?

Proposed Config:

codeprojectai:
  host: !secret host
  port: !secret port
  object_detector:
    cameras:
      basement_cat:  # Attach detector to the configured camera_1 above
        fps: 1
        custom_model: ip_general
        scan_on_motion_only: true  # Scan for objects even when there is no motion
        zones:
          - name: cat_litter_box
            coordinates:
              - x: 134
                y: 504
              - x: 794
                y: 488
              - x: 794
                y: 1080
              - x: 134
                y: 1080
            labels:
              - label: cat
                confidence: 0.75
                trigger_recorder: true
      front_door_package:
        fps: 1
        custom_model: parcel
        scan_on_motion_only: true  # Scan for objects even when there is no motion
        labels:
          - label: parcel
            confidence: 0.7
            trigger_recorder: true
roflcoopter commented 5 months ago

Great to hear! Yes I think that should be possible, will investigate further

aliyoge commented 2 months ago

Any progress?

roflcoopter commented 2 months ago

Sadly not had the time to look at this just yet!