Facial recognition & room presence using Double Take & Frigate

I’ve deployed the configuration changes to the beta build. README updated to show the configurable options in the updated format. If you don’t want to override any of the default values, you don’t need to pass those options in the config.yml file.

I’ve added partial HA integration via their REST API

If you’re using the beta build you can now pass a Home Assistant config object.

home_assistant:
  url: http://192.168.1.1:8123
  token: xxx.xxx-xxx

It doesn’t look like this method officially registers the entity within HA, since it disappears via a restart, but the next time a detection is found it is recreated. So for the time being, I’m using this and dropping the Node-Red → HA flow I had before on my personal setup.

Curious if others would find this useful.

1 Like

Sounds good, I’ve just updated my config to use this, will let you know if I run into any issues. The automatic creation of entities is really useful!

I’ve stopped using Deepstack now as it is much slower than Compreface and less accurate. Also, I was using an automation (below) that wasn’t firing because Deepstack brought back a lower confidence percentage and so not all the conditions were met:

- alias: Doorbell face detected
  trigger:
  - platform: mqtt
    topic: double-take/cameras/doorbell
  condition:
  - '{{ trigger.payload_json[''matches''][0][''confidence''] > 80 }}'    
  - '{{ ( as_timestamp(now()) - as_timestamp(state_attr(''automation.person_face_detected'',
    ''last_triggered'')) |int(0) ) > 30 }}'  
  action:
  - service: notify.mobile
    data_template:
      message: '{{ now().strftime(''%H:%M'') }} - {{trigger.payload_json[''matches''][0][''name'']}}
        detected with confidence of {{trigger.payload_json[''matches''][0][''confidence'']}}%'
      data:
        image: /local/doubletake/matches/{{ trigger.payload_json['matches'][0]['filename']
          }}
        priority: high

I store my matches in the www folder of HA so that I can send notifications with the image. I tried this with the /media folder but I couldn’t get it to work!

hopefully someone will find the above automation useful.

2 Likes

@Jako - Huge kudos for double-take! I’ve just got everything installed successfully and thought I’d share a happy user over here. Getting successfully recognized and presence detection following.

Regarding your question about preferred integration to HA, the direct config using token as opposed to linking thru Node Red certainly caught my attention. Either way though, awesome work and highly grateful for your innovations from here in Charlotte!

-AP

1 Like

@rfsurfr thank you for the kind works, that really means a lot. Happy to hear you are finding the HA setup useful, I’ve been using that on my main home setup as well and it’s been working great. It’s allowed me to drop Node-Red for the entity creation step completely.

If you have any feature requests or suggestions feel free to drop them in here. Happy to keep making this as useful as possible for everyone.

Hi, I want to give this a go… I have:

Home assistant (with MQTT)
frigate with coral running on separate docker container on separate machine form home assistant.

Both work “well”

Now I wanted to start another container on a separate machine with double take and I think I need another container (deepstack?) to run alongside.

I wish to run double take separate from home assistant and frigate but i can run along with other containers.

What I tried:
I have a machine with docker installed and I am trying to use docker compose to start double take container.

I installed docker-compose:

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

I follow docker compose manual from here:

Created this:

ofcourse with my credentials but not with deepstack correctly as I do no have that yet…

And when I try it it come with:

root@dockerhost ~/doubletake# ls
Dockerfile  app.py  docker-compose.yml  requirements.txt
root@dockerhost ~/doubletake# docker-compose -up
-bash: /usr/local/bin/docker-compose: Permission denied
root@dockerhost ~/doubletake#

So… you can see I am a beginner… what do I need to do :slight_smile:

Hey @sender, the best place to start would be the docker compose section in the README. The configuration has changed quite a bit in the last few weeks and the example quoted in your reply won’t work anymore. Everything is handled through a mounted config.yml file now. I have an example of this in the README too.

Try running docker-compose -v and see what comes back. Seems like there’s issues with your Docker compose install.

Let me know if you’re still having issues.

Wow this is a great project and has so many possibilities. I think you’re right in facial recognition being the best type of room presence. Custom actions per user, etc.

My question is, how do the others in your household feel about camera inside the house? Most people are used to motion sensors for alarms but a camera looks significantly different can feel a lot more intrusive.

Curious what you’ve done to overcome this? Do you disguise them or hide them? Do you find others in your household become accustomed?

I realize this isn’t within the scope of your project but having two cameras on each entry/exit from the room counting how many and who enters and exits would be next level for home automation and truly make a real time “smart home” possible.

Hey @mwolter thanks for the feedback. You bring up some great questions. My girlfriend wasn’t the biggest fan of the cameras inside the house at first, but I’ve slowly been working her over with various home automation projects. Her favorite is a simple motion sensor in the hallway that turns on the lights haha.

I have a few of my cameras placed where they are hard to see, but some are also more visible. None of them are in super private areas though, the one in my bedroom only looks at the stairs to see who is walking up them.

Ideally I’d have the cameras and other IoT devices on a different VLAN or something to lock them down a bit more or buy better cameras that only work locally. Currently I’m using Eufy and Wyze cameras inside my house. I’ve got two Nest cameras on the outside and unfortunately I can’t do anything cool with them yet. I really wish I could pipe my doorbell video feed into Frigate and Double Take.

1 Like

Thanks for the insight. This is definitely one of the hurdles to be navigated. My goal would be to use your project and have two cameras on each entrance to key rooms. Preferably they would be mounted high on the doorway, pointed downward to only video people entering and exiting. Then use that to keep track of room occupancy and trigger automations. Most likely node red will be integrated somehow. One hurdle to overcome will be running Ethernet to the cameras as I distain Wifi.

Thanks again and good luck with the project!

1 Like

Just published v0.6.0 which includes these additions.

  • UI: /config route to make live config changes
  • UI: /files route to view currently trained images
  • API: process Frigate snapshot MQTT messages (#18)
  • API: support for CompreFace plugins (#47)

Hi, may I ask a stupid question:-).

I read you github multiple times and see what you have done. But although it looks very promising and handy I do not know where to start with installation. Is that something you can give some guidance for?

Hey @sender, I can help you with any installation issues you have. Do you have Docker installed on your machine? If so, I’d go with a docker-compose.yml file and put this in it.

version: "3.7"

services:
  double-take:
    container_name: double-take
    image: jakowenko/double-take
    restart: unless-stopped
    volumes:
      - ${PWD}/config.yml:/double-take/config.yml
      - ${PWD}/.storage:/.storage
    ports:
      - 3000:3000

From here, create a config.yml file in the same directory and setup the configuration similar to this.

If you want to keep it basic and use the defaults you can do something like this. If you’re using a different detector then replace compreface with one of the other supported detectors.

mqtt:
  host: 192.168.1.1

home_assistant:
  url: http://192.168.1.1:8123
  token: xxx.xxx-xxx

frigate:
  url: http://192.168.1.1:5000

detectors:
  compreface:
    url: http://192.168.1.1:8000
    key: xxx-xxx-xxx-xxx-xxx

Once you’ve done that you should be able to go to localhost:3000 and view the UI.

Think I am stuck here:

@sender Did you get Docker installed?

Yes, docker is installed

Then you should be able to follow my post to get it running. I think before you had issues with docker compose.

Yes done that but how do I fire up that container via docker compose?

docker-compose up -d

But I would refer to Overview of Docker Compose | Docker Documentation

Soory, I need some help…

root@dockerhost ~/doubletake# ls
Dockerfile  app.py  docker-compose.yml  requirements.txt
root@dockerhost ~/doubletake# docker-compose up -d
-bash: /usr/local/bin/docker-compose: Permission denied
root@dockerhost ~/doubletake#

found this:
chmod +rwx /usr/local/bin/docker-compose

now downloading

got it running:

root@dockerhost ~/doubletake# docker ps
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                            NAMES
eeac25c13094        jakowenko/double-take    "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        0.0.0.0:3333->3000/tcp                           double-take
8c842eb889eb        portainer/portainer-ce   "/portainer"             10 days ago         Up 9 minutes        0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp   portainer

next step: no reply on ip:3000 ?