Commit Graph

1368 Commits

Author SHA1 Message Date
Blake Blackshear
bf93fbb357 add ability to draw bounding boxes/timestamps on snapshots 2020-10-18 13:47:13 -05:00
Blake Blackshear
4363623c45 reduce zone filter bouncing 2020-10-18 13:47:13 -05:00
Blake Blackshear
c960914ec3 prevent the camera process from hanging 2020-10-18 13:47:13 -05:00
Blake Blackshear
76befc1249 only draw during debug 2020-10-18 13:47:13 -05:00
Blake Blackshear
e4da3822b1 cleanup detection shms 2020-10-18 13:47:13 -05:00
Blake Blackshear
12c4cd77c5 only convert pix_fmt when necessary 2020-10-18 13:47:13 -05:00
Blake Blackshear
a611cbb942 use yuv420p pixel format for motion 2020-10-18 13:47:13 -05:00
Blake Blackshear
f946813ccb support multiple coral devices (fixes #100) 2020-10-18 13:47:13 -05:00
Blake Blackshear
54cb4a2180 prevent frame from being deleted while in use 2020-10-18 13:47:13 -05:00
Blake Blackshear
efdcfcef97 cleanup 2020-10-18 13:47:13 -05:00
Blake Blackshear
574ee2a46f update detection handoff to use shared memory 2020-10-18 13:47:13 -05:00
Blake Blackshear
ec4d048905 upgrade to python3.8 and switch from plasma store to shared_memory 2020-10-18 13:47:13 -05:00
Blake Blackshear
b063099b2a fix zone filters fixes #218 2020-10-11 11:38:32 -05:00
Blake Blackshear
b35cc01035 allow the best image timeout to be configurable 2020-09-18 07:14:44 -05:00
Blake Blackshear
7880d24b29 prevent the cache from growing indefinitely 2020-09-17 07:37:27 -05:00
Blake Blackshear
fdc8bbf72d move zone config under each camera 2020-09-17 07:37:27 -05:00
Blake Blackshear
005e188d38 continue if frames not in frame manager 2020-09-17 07:37:27 -05:00
Blake Blackshear
adcc3e9b98 copy obj so crop doesnt change 2020-09-17 07:37:27 -05:00
Blake Blackshear
5fe201da25 avoid processing broken frames 2020-09-17 07:37:27 -05:00
Blake Blackshear
974f7bd0df fix mqtt snapshot 2020-09-17 07:37:27 -05:00
Blake Blackshear
780ae7cd4f allow specifying labels to save clips for 2020-09-17 07:37:27 -05:00
Blake Blackshear
50e568b84c allow setting size and cropping of snapshots and best.jpg endpoint 2020-09-17 07:37:27 -05:00
Blake Blackshear
1ce993051e add support for polygon masks 2020-09-17 07:37:27 -05:00
Blake Blackshear
69406343ee allow setting the camera fps if needed 2020-09-17 07:37:27 -05:00
Blake Blackshear
1c33b8acb2 handle mask files that failed to read 2020-09-17 07:37:27 -05:00
Blake Blackshear
5e77436d39 fix coral fps value 2020-09-17 07:37:27 -05:00
Blake Blackshear
c16ee3186f fix masks 2020-09-17 07:37:27 -05:00
Blake Blackshear
bfcaabecfa fix var name 2020-09-17 07:37:27 -05:00
Blake Blackshear
606fa6f6d5 once a true positive always a true positive 2020-09-17 07:37:27 -05:00
Blake Blackshear
6a8d8bf53d dont trigger zones for false positives 2020-09-17 07:37:27 -05:00
Blake Blackshear
1f81cba706 only save a clip if its not a false positive 2020-09-17 07:37:27 -05:00
Blake Blackshear
5db7b242aa another fix 2020-09-17 07:37:27 -05:00
Blake Blackshear
0b7f65e227 fixes 2020-09-17 07:37:27 -05:00
Blake Blackshear
2f758af097 allow setting specific edgetpu in config 2020-09-17 07:37:27 -05:00
Blake Blackshear
f64320a464 remove invalid tests 2020-09-17 07:37:27 -05:00
Blake Blackshear
acb75fa02d refactor and reduce false positives 2020-09-17 07:37:27 -05:00
Blake Blackshear
ea4ecae27c Refactor with a working false positive test 2020-09-17 07:37:27 -05:00
Carl Elkins
a8556a729b Added support for PCIe TPU, as well as USB
Also added message showing which found
2020-09-04 20:56:16 -05:00
Ryan Press
df2aae5169 Fix zone filters 2020-08-19 09:58:53 -05:00
Blake Blackshear
469259d663 dont refresh cache if exiting 2020-08-08 07:40:48 -05:00
Blake Blackshear
f3db69d975 update docs 2020-08-08 07:40:48 -05:00
Blake Blackshear
0ae2806eb4 fix overwriting variable 2020-08-08 07:40:48 -05:00
Blake Blackshear
adcfe699c2 ensure frigate can exit gracefully 2020-08-08 07:40:48 -05:00
Blake Blackshear
e6c6338266 allow mask to be base64 encoded into the config file 2020-08-08 07:40:48 -05:00
Blake Blackshear
69f5249788 initial implementation of zones 2020-08-08 07:40:48 -05:00
Blake Blackshear
3a1f1c946b better camera name handling 2020-08-01 18:20:44 -05:00
Blake Blackshear
709d917f0c update snapshot with better scores 2020-08-01 18:20:44 -05:00
Blake Blackshear
918386bdc1 use a random string in the object id instead of the index 2020-08-01 18:20:44 -05:00
Blake Blackshear
a8c0fadf95 make pre_capture time configurable 2020-08-01 18:20:44 -05:00
Blake Blackshear
3d2f1437e4 filter objects before triggering events 2020-08-01 18:20:44 -05:00
Blake Blackshear
7383db60b0 save clips for tracked objects 2020-08-01 18:20:44 -05:00
Blake Blackshear
c1f522ff54 fix box merging 2020-07-26 12:00:46 -05:00
Blake Blackshear
760e1ffe1d skip frames in the capture thread instead 2020-06-02 05:25:02 -05:00
Blake Blackshear
15b4024715 expose frame time at each step of processing 2020-06-02 05:25:02 -05:00
Blake Blackshear
918112a793 ensure the previous frame is deleted when the new one is stored 2020-06-02 05:25:02 -05:00
Blake Blackshear
4ee200a81c move ffmpeg capture to a separate thread and use a queue 2020-06-02 05:25:02 -05:00
Blake Blackshear
e37eba49ff make object processor resilient to plasma failures 2020-06-02 05:25:02 -05:00
Blake Blackshear
6de8e3bd1f remove sharedarray references 2020-06-02 05:25:02 -05:00
Blake Blackshear
3a9781c4f8 handle various scenarios with external process failures 2020-06-02 05:25:02 -05:00
Blake Blackshear
8e9110f42e if the detections dont come back in 10s, give up 2020-03-03 20:26:53 -06:00
Blake Blackshear
c80137e059 call the restart function and handle errors better in the detection process 2020-03-03 20:26:53 -06:00
Blake Blackshear
a5bef89123 improve detection processing and restart when stuck 2020-03-03 20:26:53 -06:00
Blake Blackshear
d8aa73d26e handle ffmpeg process failures in the camera process itself 2020-03-03 20:26:53 -06:00
Blake Blackshear
791409d5e5 add a few print statements for debugging 2020-03-03 20:26:53 -06:00
Blake Blackshear
8e73c7e95e increase the buffer size a bit 2020-03-03 20:26:53 -06:00
Blake Blackshear
2e8c7ec225 cleanup the plasma store when finished with a frame 2020-03-03 20:26:53 -06:00
Blake Blackshear
dfabff3846 dont change dictionary while iterating 2020-03-03 20:26:53 -06:00
Blake Blackshear
76a7a3bad5 allow specifying the frame size in the config instead of detecting 2020-03-03 20:26:53 -06:00
Blake Blackshear
a3fa97dd52 ensure missing objects are expired even when other object types are in the frame 2020-03-03 20:26:53 -06:00
Blake Blackshear
1d2a41129c Fix watchdog last_frame calculation 2020-03-03 20:26:53 -06:00
Blake Blackshear
e6892d66b8 update docs and add back benchmark 2020-03-03 20:26:53 -06:00
Blake Blackshear
3e6f6edf7e check avg wait before dropping frames 2020-03-03 20:26:53 -06:00
Blake Blackshear
6f6d202c99 improve watchdog and coral fps tracking 2020-03-03 20:26:53 -06:00
Blake Blackshear
05951aa7da cleanup 2020-03-03 20:26:53 -06:00
Blake Blackshear
bb8e4621f5 add models and convert speed to ms 2020-03-03 20:26:53 -06:00
Blake Blackshear
04e9ab5ce4 add watchdog for camera processes 2020-03-03 20:26:53 -06:00
Blake Blackshear
1089a40943 cleanup old code 2020-03-03 20:26:53 -06:00
Blake Blackshear
68c3a069ba add a min_fps option 2020-03-03 20:26:53 -06:00
Blake Blackshear
80b9652f7a check plasma store and consolidate frame drawing 2020-03-03 20:26:53 -06:00
Blake Blackshear
569e07949f split into separate processes 2020-03-03 20:26:53 -06:00
Blake Blackshear
c539993387 refactor some classes into new files 2020-03-03 20:26:53 -06:00
Blake Blackshear
cd057370e1 fallback to opencv to detect resolution and allow config to specify 2020-02-22 09:03:00 -06:00
Blake Blackshear
6263912655 use ffprobe to get frame shape (fixes #87) 2020-02-22 09:03:00 -06:00
Blake Blackshear
af247275cf make timestamp on snapshots configurable (fixes #88) 2020-02-22 09:03:00 -06:00
Blake Blackshear
1198c29dac make watchdog timeout configurable per camera (fixes #95) 2020-02-22 09:03:00 -06:00
Blake Blackshear
169603d3ff attempt to fix regions in process key error 2020-02-22 09:03:00 -06:00
Blake Blackshear
ebcf1482f8 remove region in process when skipping 2020-02-22 09:03:00 -06:00
Blake Blackshear
38efbd63ea add camera name to ffmpeg log messages 2020-02-22 09:03:00 -06:00
Blake Blackshear
50bcad8b77 skip regions when the queue is too full and add more locks 2020-02-22 09:03:00 -06:00
Blake Blackshear
cfffb219ae switch back to stretch for hwaccel issues 2020-02-22 09:03:00 -06:00
Blake Blackshear
382d7be50a check correct object 2020-02-22 09:03:00 -06:00
Blake Blackshear
38e7fa07d2 add a label position arg for bounding boxes 2020-02-22 09:03:00 -06:00
Blake Blackshear
e261c20819 let the queues get as big as needed 2020-02-22 09:03:00 -06:00
Blake Blackshear
3a66e672d3 notify mqtt when objects deregistered 2020-02-22 09:03:00 -06:00
Blake Blackshear
2aada930e3 fix multiple object type tracking 2020-02-22 09:03:00 -06:00
Blake Blackshear
d87f4407a0 switch everything to run off of tracked objects 2020-02-22 09:03:00 -06:00
Blake Blackshear
be5a114f6a group by label before tracking objects 2020-02-22 09:03:00 -06:00
Blake Blackshear
32b212c7b6 fix mask filtering 2020-02-22 09:03:00 -06:00
Blake Blackshear
76c8e3a12f make a copy 2020-02-22 09:03:00 -06:00
Blake Blackshear
16f7a361c3 fix object filters 2020-02-22 09:03:00 -06:00
Blake Blackshear
634b87307f group by label before suppressing boxes 2020-02-22 09:03:00 -06:00
Blake Blackshear
1d4fbbdba3 update all obj props 2020-02-22 09:03:00 -06:00
Blake Blackshear
65579e9cbf add thread to write frames to disk 2020-02-22 09:03:00 -06:00
Blake Blackshear
49dc029c43 merge boxes by label 2020-02-22 09:03:00 -06:00
Blake Blackshear
5199242a68 remove unused current frame variable 2020-02-22 09:03:00 -06:00
Blake Blackshear
10dc56f6ea revamp dockerfile 2020-02-22 09:03:00 -06:00
Blake Blackshear
cc2abe93a6 track objects and add config for tracked objects 2020-02-22 09:03:00 -06:00
Blake Blackshear
0c6717090c implement filtering and switch to NMS with OpenCV 2020-02-22 09:03:00 -06:00
Blake Blackshear
f5a2252b29 cleanup imports 2020-02-22 09:03:00 -06:00
Blake Blackshear
02efb6f415 fixing a few things 2020-02-22 09:03:00 -06:00
Blake Blackshear
5b4c6e50bc dedupe detected objects 2020-02-22 09:03:00 -06:00
Blake Blackshear
9cc46a71cb working dynamic regions, but messy 2020-02-22 09:03:00 -06:00
Blake Blackshear
be1673b00a process detected objects in a queue 2020-02-22 09:03:00 -06:00
Blake Blackshear
b6130e77ff label threads and implements stats endpoint 2020-02-22 09:03:00 -06:00
Blake Blackshear
4180c710cd refactor resizing into generic priority queues 2020-02-22 09:03:00 -06:00
Blake Blackshear
ab3e70b4db check to see if we have a frame before trying to send 2020-01-02 07:39:57 -06:00
Blake Blackshear
d90e408d50 set the current object status to off when expired 2020-01-02 07:39:57 -06:00
Blake Blackshear
6c87ce0879 cache the computed jpg bytes to reduce cpu usage 2020-01-02 07:39:57 -06:00
Blake Blackshear
480175d70f add color map to use different colors for different objects 2020-01-02 07:39:57 -06:00
Blake Blackshear
bee99ca6ff track and report all detected object types 2020-01-02 07:39:57 -06:00
Blake Blackshear
3a3afe14bf change the ffmpeg config for global defaults and overrides 2019-12-08 16:03:23 -06:00
Blake Blackshear
d899ef158e fix datestamp positioning 2019-12-08 16:03:23 -06:00
Blake Blackshear
e818744d81 print the frame time on the image 2019-12-08 08:55:54 -06:00
Blake Blackshear
ceedfae993 add max person area 2019-12-08 07:17:18 -06:00
Blake Blackshear
e13563770d allow full customization of input 2019-12-08 07:06:52 -06:00
blakeblackshear
ba71927d53 allow setting custom output params and setting the log level for ffmpeg 2019-08-25 08:54:19 -05:00
blakeblackshear
04fed31eac increase watchdog timeout to 10 seconds 2019-08-25 08:54:19 -05:00
blakeblackshear
ebaa8fac01 tweak input params and gracefully kill ffmpeg 2019-08-25 08:54:19 -05:00
blakeblackshear
2ec45cd1b6 send the best person frame over mqtt for faster updates in homeassistant 2019-08-25 08:54:19 -05:00
blakeblackshear
700bd1e3ef use a thread to capture frames from the subprocess so it can be killed properly 2019-07-30 19:11:22 -05:00
Alexis Birkill
c9e9f7a735 Fix comparison of object x-coord against mask (#52) 2019-07-30 19:11:22 -05:00
blakeblackshear
aea4dc8724 a few fixes 2019-07-30 19:11:22 -05:00
blakeblackshear
4a58f16637 tweak the label position 2019-07-30 19:11:22 -05:00
blakeblackshear
436b876b24 add support for ffmpeg hwaccel params and better mask handling 2019-07-30 19:11:22 -05:00
blakeblackshear
806acaf445 update dockerignore and debug option 2019-07-30 19:11:22 -05:00
Kyle Niewiada
c653567cc1 Add area labels to bounding boxes (#47)
* Add object size to the bounding box

Remove script from Dockerfile

Fix framerate command

Move default value for framerate

update dockerfile

dockerfile changes

Add person_area label to surrounding box


Update dockerfile


ffmpeg config bug


Add `person_area` label to `best_person` frame


Resolve debug view showing area label for non-persons


Add object size to the bounding box


Add object size to the bounding box

* Move object area outside of conditional to work with all object types
2019-07-30 19:11:22 -05:00
blakeblackshear
59a4b0e650 add ability to process every nth frame 2019-07-30 19:11:22 -05:00
blakeblackshear
c41b104997 extra ffmpeg params to reduce latency 2019-07-30 19:11:22 -05:00
blakeblackshear
2d22a04391 reduce verbosity of ffmpeg 2019-07-30 19:11:22 -05:00
blakeblackshear
baa587028b use a regular subprocess for ffmpeg, refactor bounding box drawing 2019-07-30 19:11:22 -05:00
blakeblackshear
2b51dc3e5b experimental: running ffmpeg directly and capturing raw frames 2019-07-30 19:11:22 -05:00
blakeblackshear
9f8278ea8f working odroid build, still needs hwaccel 2019-07-30 19:11:22 -05:00
blakeblackshear
3019b0218c make the threshold configurable per region. fixes #31 2019-05-11 07:39:27 -05:00
blakeblackshear
6900e140d5 add a watchdog to the capture process to detect silent failures. fixes #27 2019-05-11 07:16:15 -05:00
blakeblackshear
dbcfd109f6 fix missing import 2019-05-10 06:19:39 -05:00
blakeblackshear
4dacf02ef9 add the ability to mask the standing location of a person 2019-04-30 20:35:22 -05:00
blakeblackshear
e0b9b616ce cleanup and update readme 2019-03-30 07:58:31 -05:00
blakeblackshear
edf0cd36df add back flask endpoints 2019-03-29 21:02:40 -05:00
blakeblackshear
0279121d77 WIP: convert to camera class 2019-03-29 20:49:27 -05:00
blakeblackshear
0514eeac03 switch to a thread for object detection 2019-03-27 20:44:57 -05:00
blakeblackshear
a26d2217d4 implement min person size again 2019-03-27 06:45:27 -05:00
blakeblackshear
200d769003 removing motion detection 2019-03-27 06:17:00 -05:00
blakeblackshear
ada8ffccf9 fix for queue size growing too large 2019-03-25 20:35:44 -05:00
blakeblackshear
bca4e78e9a use a queue instead 2019-03-25 06:24:36 -05:00
blakeblackshear
7d3027e056 looping over all regions with motion. ugly, but working 2019-03-20 07:11:38 -05:00
blakeblackshear
c406fda288 fixes 2019-03-19 06:29:58 -05:00
blakeblackshear
8ff9a982b6 start the detection process 2019-03-18 07:48:04 -05:00
blakeblackshear
f2c205be99 prep frames for object detection in a separate process 2019-03-18 07:24:24 -05:00
blakeblackshear
862aa2d3f0 only resize when needed 2019-03-17 20:12:31 -05:00
blakeblackshear
8bae05cfe2 first working version, single region and motion detection disabled 2019-03-17 09:03:52 -05:00
blakeblackshear
de9c3f4d74 wait 5 seconds to clear the motion flag 2019-03-15 20:16:19 -05:00
blakeblackshear
c12e19349e only cleanup old objects when motion is detected so stationary objects are still detected 2019-03-15 20:15:41 -05:00
blakeblackshear
afb70f11a8 switch mqtt to a binary on/off instead of sending a message for each score 2019-03-12 20:54:43 -05:00
blakeblackshear
e597a08a66 prevent unnecessary early exit from loop 2019-03-02 15:20:53 -06:00
blakeblackshear
5dc76803d6 cleanup 2019-02-28 06:49:27 -06:00
blakeblackshear
df7b90e367 store the best recent person image and reconnect the RTSP stream if unable to grab several consecutive frames 2019-02-27 20:55:07 -06:00
blakeblackshear
2e3c9da650 manage 2 seconds worth of motion frames for processing 2019-02-26 20:29:52 -06:00
blakeblackshear
86f5d8128d initial refactoring 2019-02-25 20:27:02 -06:00