Local realtime person detection for RTSP cameras

prob solved by changing to 2nd stream rtsp but with 640x480 resolution 10 fps . variable bit rate. . all 4 cams now working perfectly with good detection. tqvm. i`ll monitor for long term implementation.

Is there any way to improve night detection when there is low contrast difference between object and background? I was googling on it a bit but you may already have some idea. https://www.sciencedirect.com/science/article/pii/S0031320307002579
Is there a way to train with own photos? As security system, the night mode is lot more important than the daytime mode.

Alright, so iā€™ve received the mini PCIe card and since I donā€™t have a mini slot, iā€™m using a mini PCIe to PCIe adapter.

I have it showing up in my PCIe devices:

IOMMU group 8:	[1ac1:089a] 01:00.0 Non-VGA unclassified device: Global Unichip Corp. Coral Edge TPU

Does not show up in VM device options.

Also not seeing anything useful in /dev/:

Anyone have ideas?

Which adapter are you using? I am considering buying one too.

This is still very much a work in progress, but here is a preview of the new media browser integration: https://youtu.be/fXQZeI1-hms

12 Likes
1 Like

Looks awesome! Excited to see it integrated.

does the detection only cover person and car? i got few cats moving around my house but apparently no detection occurred. but i could see detection fps on the camera when cats move around

Thank you so much for this, have just setup the hass.io addon while trying to decide what to have for breakfast. 2 cameraā€™s working, objects working, saved clips working!

also the NVR preview above looks amazing, thank you so much for this

It covers many other objects. Go look at: https://github.com/blakeblackshear/frigate/blob/a1cc9ad1f0a3ea3e3a1c8163c5ff3c27065a9be4/labelmap.txt

As far as the detection in progress, you can see whatā€™s going on with the detections if you pull the webpage that frigate provides. Its well documented on the github page.

1 Like

Well that looks fu#*&$^ amazing! I think I saw something on github, but is there anyway to support the work(easiest way?)

Iā€™m am unfortunately still having issues with Frigate crashing my host. Even with ā€œsave clipsā€ set as false. I am hoping to pull some real data this week/end from the system, as I REALLY want to go all out with it.

I seem to be stuck at some a fundamental (and embarrassing) level. Hereā€™s where I am: Iā€™ve added the cited repository to the add-on store, downloaded the Frigate integration, copied and modified the config.yml from the README.md and started it all. docker ps says it is running, as does port 5000. But no cameras show up at ...:5000/debug_stats nor at :5000/<camera_name>. Itā€™s almost like the config.yml is not being read. I placed it at ...hassio/homeassistant/addons/data/ccab4aaf_frigate/config.yml (is that right?). Also docker inspect addon_ccab4aaf_frigate | grep CONFIG_FILE says "CONFIG_FILE=/data/options.json" further leading me to believe I have config.yml in the wrong place (and the wrong format?!? yml or json??). Where does config.yml go on hassio?

With the addon, you donā€™t need to worry about where the config is. Just paste your desired config directly in the addon configuration tab and it will handle the rest.

Has anyone had an issue where some cameras recorded clips play fine through hass media browser while others do not play at all? Currently my amcrest cameras play back recordings, and my hikvision cameras do not. Im not finding anything helpful in the in the hass logs.

Im interested to see how this turns out. Im currently running vmware with 2 docker vms, and a usb coral device passed through to both. I bought the mpcie coral tpu so I can free up 2 pci-e slots on my server and consolidate the 2 vms down to 1. Just havent had the time to configure everything yet.

Try running each clip through ffprobe to see what is different.

wasnā€™t able to get it recognized in unraid docker container. I ended up using the usb device. I feel like it may need drivers in order to work properly.

hello! how can I setup frigate integration?


what should I fill there?

Donā€™t. It isnā€™t ready for testing yet.

This works so well with the USB device!

I use node-red to do a http request to save best image w/ crop to /www folder in HA config directory. Then I use that remotely accessible file to send a actionable notification. Thumbnail is the person detected. When you force-touch that notification you get the live stream. The cam stream is pulled from Unifi camera and fed into motion eye for no delay stream. I also use the same person detection after dark to turn on the front lights.

Node-Red notification

[{"id":"87284e69.66663","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Notify PS: Porch Motion","server":"9abddab9.60bd38","version":1,"service_domain":"notify","service":"mobile_app_patrick_iphone11","entityId":"","data":"{\"data\":{\"attachment\":{\"content-type\":\"jpeg\",\"url\":\"https://ha.patricklfs.com/local/porch_best.jpg\"},\"entity_id\":\"camera.porch_camera_2\",\"push\":{\"category\":\"camera\"}},\"message\":\"Person detected. Front lights turned on\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":690,"y":1180,"wires":[[]]},{"id":"b014e4e3.1344b8","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Front Lights On","server":"9abddab9.60bd38","version":1,"service_domain":"switch","service":"turn_on","entityId":"group.front_lights_group","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":1120,"wires":[["a1003706.70f0f8","87284e69.66663"]]},{"id":"a0dfa845.742f18","type":"api-current-state","z":"bdfe9594.94e5b8","name":"Toggle","server":"9abddab9.60bd38","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.test_switch_1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":310,"y":1120,"wires":[["b014e4e3.1344b8"],[]]},{"id":"a1003706.70f0f8","type":"trigger","z":"bdfe9594.94e5b8","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"10","extend":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":670,"y":1120,"wires":[["4e2e07a9.aa9da8"]]},{"id":"d3406d90.6f28d","type":"switch","z":"bdfe9594.94e5b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":1060,"wires":[["d768563c.6d16c8","a0dfa845.742f18"],[]]},{"id":"4e2e07a9.aa9da8","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Front Lights Off","server":"9abddab9.60bd38","version":1,"service_domain":"switch","service":"turn_off","entityId":"group.front_lights_group","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":860,"y":1120,"wires":[["3b521855.523408"]]},{"id":"3b521855.523408","type":"change","z":"bdfe9594.94e5b8","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":1120,"wires":[["a1003706.70f0f8"]]},{"id":"504c51c6.32cdb","type":"rbe","z":"bdfe9594.94e5b8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":310,"y":1060,"wires":[["d3406d90.6f28d"]]},{"id":"d768563c.6d16c8","type":"api-current-state","z":"bdfe9594.94e5b8","name":"Toggle","server":"9abddab9.60bd38","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.porch_motion_notif","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":590,"y":1060,"wires":[["f2e12594.8e6ce8"],[]]},{"id":"c16cf7b5.ad7128","type":"server-state-changed","z":"bdfe9594.94e5b8","name":"Porch Motion Sensor","server":"9abddab9.60bd38","version":1,"entityidfilter":"binary_sensor.porch_person","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":120,"y":1060,"wires":[["504c51c6.32cdb"]]},{"id":"f2e12594.8e6ce8","type":"trigger","z":"bdfe9594.94e5b8","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":760,"y":1060,"wires":[["fac13895.6b52e8"]]},{"id":"622fcff5.dd5ed","type":"change","z":"bdfe9594.94e5b8","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1300,"y":1120,"wires":[["f2e12594.8e6ce8","a4f17696.b3d578"]]},{"id":"fac13895.6b52e8","type":"delay","z":"bdfe9594.94e5b8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":940,"y":1060,"wires":[["1c8f1c61.19d164"]]},{"id":"a4f17696.b3d578","type":"trigger","z":"bdfe9594.94e5b8","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1680,"y":1060,"wires":[["622fcff5.dd5ed"]]},{"id":"1c8f1c61.19d164","type":"http request","z":"bdfe9594.94e5b8","name":"HTTP REQ","method":"GET","ret":"bin","paytoqs":"ignore","url":"http://192.168.1.87:5001/porch/person/best.jpg?h=300&crop=1","tls":"","persist":false,"proxy":"","authType":"","x":1110,"y":1060,"wires":[["b2b384ff.5ba8b8"]]},{"id":"751f49c4.63df08","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Notify PS: Porch Motion","server":"9abddab9.60bd38","version":1,"service_domain":"notify","service":"sarah_and_patrick","entityId":"","data":"{\"data\":{\"attachment\":{\"content-type\":\"jpeg\",\"url\":\"https://ha.patricklfs.com/local/porch_best_crop.jpg\"},\"entity_id\":\"camera.porch_camera_2\",\"push\":{\"category\":\"camera\"}},\"message\":\"AI Porch Motion Detected!\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1470,"y":1060,"wires":[["a4f17696.b3d578"]]},{"id":"b2b384ff.5ba8b8","type":"file","z":"bdfe9594.94e5b8","name":"SAVE","filename":"/best_snapshot/porch_best_crop.jpg","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1270,"y":1060,"wires":[["751f49c4.63df08"]]},{"id":"9abddab9.60bd38","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Node-Red lights

[{"id":"e6822216.f7c7e","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Front Lights On","server":"9abddab9.60bd38","version":1,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.test_switch_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":280,"y":1246,"wires":[[]]},{"id":"f6149caf.fcc13","type":"switch","z":"bdfe9594.94e5b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":90,"y":1246,"wires":[["e6822216.f7c7e"],["fdf7cdda.0961c"]]},{"id":"20d99a0b.30deb6","type":"rbe","z":"bdfe9594.94e5b8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":290,"y":1206,"wires":[["f6149caf.fcc13"]]},{"id":"fdf7cdda.0961c","type":"api-call-service","z":"bdfe9594.94e5b8","name":"Front Lights Off","server":"9abddab9.60bd38","version":1,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.test_switch_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":280,"y":1286,"wires":[[]]},{"id":"98d682d2.2f86c","type":"bigtimer","z":"bdfe9594.94e5b8","outtopic":"","outpayload1":"","outpayload2":"","name":"Sunset Front Lights","comment":"","lat":"39.866890","lon":"-105.202209","starttime":"5001","endtime":"5000","starttime2":"0","endtime2":"0","startoff":"0","endoff":"0","startoff2":"","endoff2":0,"offs":0,"outtext1":"On","outtext2":"Off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":110,"y":1186,"wires":[[],[],["20d99a0b.30deb6"]]},{"id":"9abddab9.60bd38","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Thereā€™s some additional logic to debounce somewhat, stopping it from triggering too often. Also some booleans to see if the flow is on with a toggle or input_boolean.