Facial recognition & room presence using Double Take & Frigate

@Eelco_Anneveldt lol - you best shut it all down now then :rofl: Alternatively, if you don’t need images of your ex in DT, remove her and force update to all attached facial recognition systems?

Its actually more simpler than that to swap versions.
So what I did was installed the new version while the old was one running, shutdown the old version, repointed the add-on configuration for new version to the same locations as old version (see pic below), then shut down old version, turned on new version and it all worked - no need to mess with DT yaml config :slight_smile:
For clarity, my DT add-on config is the following:


With these settings, I can delve into the images and image folders without any issue and even setup notifications from HA to companion app and view the notification with the correct image when away from home.

If it helps at all, my DT config is:

# Double Take
# Learn more at https://github.com/jakowenko/double-take/#configuration



# "Snapshot" -- frame from frigate, saved then frigate detect an event (motion, for example)
# "Latest" -- frame from camera, on the moment then double-take trying to make an recognition (Usually, the difference between them is 1-2 seconds)
# "MQTT" -- The frame that the frigate transmitted with the event by MQTT protocol. It's usually equivalent to "snapshot", but depends on frigate settings

# If u use double-take in conjunction with frigate, the "snapshot" method will be enough

# Want either MQTT or Snapshot. MQTT does not include zone

home_assistant:
  url: http://192.168.1.198:8123
  token: %TOKEN_VALUE%

frigate:
  url: http://192.168.1.158:5000
  update_sub_labels: True
  # stop the processing loop if a match is found
  # if set to false all image attempts will be processed before determining the best match
  stop_on_match: True
  # ignore detected areas so small that face recognition would be difficult
  # quadrupling the min_area of the detector is a good start
  # does not apply to MQTT events
  #min_area: 1600

  # object labels that are allowed for facial recognition
  labels:
    - person
    
  attempts:
    # number of times double take will request a frigate latest.jpg for facial recognition
    latest: 0
    # number of times double take will request a frigate snapshot.jpg for facial recognition
    snapshot: 10
    # process frigate images from frigate/+/person/snapshot topics
    mqtt: false
    # add a delay expressed in seconds between each detection loop
 #   delay: 0
 
  # only process images from specific zones
  zones:
    - camera: doorbell
      zone: garden_doorbell
    - camera: car-port
      zone: driveway_carport
  
mqtt:
  host: 192.168.1.198
  username: %MQTT_USERNAME_VALUE%
  password: %MQTT_PASSWORD_VALUE%
  
detectors:

#If you want no match then increase det_prob_threshold: 80 a little at a time and re-test your matches… it will return nothing if it fails this test. I have been creeping this value up and it has really reduced the number of images accepted and false positives from blurry movement shots etc.

#detectors:
  #compreface:
    # minimum required confidence that a recognized face is actually a face
   # det_prob_threshold: 0.98
  compreface:
    url: http://192.168.1.158:8000
    # recognition api key
    key: %KEY_VALUE%
    # number of seconds before the request times out and is aborted
    timeout: 15
    # minimum required confidence that a recognized face is actually a face
    # value is between 0.0 and 1.0
    det_prob_threshold: 0.8
    # require opencv to find a face before processing with detector
    opencv_face_required: false
    # comma-separated slugs of face plugins
    # https://github.com/exadel-inc/CompreFace/blob/e1ee791cac6cd9b1d3a9ea2cb129c78cb00a9083/docs/Face-services-and-plugins.md)
    # face_plugins: mask,gender,age
    # only process images from specific cameras, if omitted then all cameras will be processed
    # cameras:
    #   - front-door
    #   - garage
#  aiserver:
#    url: http://192.168.1.158:32168
    # number of seconds before the request times out and is aborted
 #   timeout: 15
    # require opencv to find a face before processing with detector
#    opencv_face_required: false
telemetry: false


    
      
detect:
  match:
    # save match images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    # minimum confidence needed to consider a result a match
    confidence: 85
    # hours to keep match images until they are deleted
    purge: 24
    # minimum area in pixels to consider a result a match
    min_area: 2500
    #when using substream image, 3600

  unknown:
    # save unknown images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    # minimum confidence needed before classifying a name as unknown
    confidence: 85
    # hours to keep unknown images until they are deleted
    purge: 8
    # minimum area in pixels to keep an unknown result
    min_area: 64

With this I don’t get false positives that often and people the system doesn’t know shows up as Unknown

3 Likes

Did you ever get this figured out? - I am having the same issue

I would like to try out Double Take. Which branch is the preferred one to use? The old jakowenko/double-take or the newer skrashevich/double-take? Thanks!

I’m using the latter. Works.

1 Like

I’ve been using jakowenko version since more or less day one. I had noticed there had been few updates recently. Has jakowenko confirmed he is no longer developing his branch hence people moving over too skrashevich?

If you check the repositorie on github you can see the maintenance of it.
jakowenko → Latest update 9 months ago
skrashevich → Latest update 5 hours ago

1 Like

And from the docs page of frigate there is a link to it.

Deleted post. Found the solution myself.

I’m an autor of double-take fork (skrashevich/double-take)
if you have any questions or issues – please, wrote it to GitHub: Issues · skrashevich/double-take · GitHub , I’ll to try to answer to it as soon as possible
also, you can use my double-take fork as hassio add-on by adding this repo: GitHub - skrashevich/hassio-addons

5 Likes

Hello! Tell me why Frigate mistakenly recognizes objects.

  camera_4: 
    mqtt:
      crop: True
      height: 500
    rtmp:
      enabled: false
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/1 
          roles:
            - detect
            - record
            - clips
    detect:
      width: 1280 
      height: 720 
      fps: 5
      
    objects:
      track:
        - person
        - car
        - bird
        - cat
        - dog
      filters:
        person:
          threshold: 0.8 
        car:
          threshold: 0.7
        bird:
          threshold: 0.7 
        cat:
          threshold: 0.7
        dog:
          threshold: 0.7 
          
    record:
      enabled: True
      retain:
        days: 3
        mode: all
        
      events:
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - bird
          - cat
          - dog
        retain:
            default: 10
            mode: active_objects

1 Like

same problem

1 Like

Use the min_area parameter.

min_area: 5000
# Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
    objects:
      track:
        - person
      filters:
        person:
          min_area: 5000
1 Like

Or add a person mask to the area (the wooden border for example)

    objects:
      track:
        - person
      filters:
        person:
          min_area: 5000
          mask:
            - 411,0,461,467,423,467,380,0
            - 1280,0,1280,164,191,83,302,720,0,720,0,0
            - 1280,720,1280,0,757,720

fine tuning. I will try. Thanks

it doesn’t work

I think the preferred method of doing this is to mask an area where you wouldn’t expect to see a person. So you’ll need to add the masking as well.
That’s what woempiej did for you.
Also see:

With this advice, I will have to create a full-screen mask. :rofl: :rofl: :rofl:

Very nice comment :slight_smile:
Read the docs of frigate and do it by yourself then.

Oké I took a deep breath…

Mask the wooden border like shown below (And like I said before!). I have simular camera setups with complex surroundings and I can tell you it works.

2 Likes

I have found a solution by moving the “secret path” folder into /config/double-take. So copy the “secrets.yaml” file (or just section that is required - mqtt info & compreface key) you have in the default “config” location of homeassistant to this folder where everything else is located (storage/config) then it won’t crash . It must be a permission error ?

image

image

1 Like