* Only keep 2x detect fps frames in SHM
* Don't delete previous shm frames in output
* Catch case where images do not exist
* Ensure files are closed
* Clear out all frames when shutting down
* Correct the number of frames saved
* Simplify empty shm error handling
* Improve frame safety
* intentionally handle queues during shutdown and carefully manage shutdown order
* more carefully manage shutdown to avoid threadlocks
* use debug for signal logging
* ensure disabled cameras dont break shutdown
* typo
* Add config pub / sub pattern
* remove recording from feature metrics
* remove audio and feature metrics
* Check for updates from all cameras
* remove birdseye from camera metrics
* remove motion and detection camera metrics
* Ensure that all processes are stopped
* Stop communicators
* Detections
* Cleanup video output queue
* Use select for time sensitive polls
* Use ipc instead of tcp
* Use zmq for inter process communication
* Use localhost for reply and request
* Use pyobj instead of json and Need to use separate requestors for each audio listener
* Cleanup port defining
* Smarter Regions
* Formatting
* Cleanup
* Fix motion region checking logic
* Add database table and migration for regions
* Update region grid on startup
* Revert init delay change
* Fix mypy
* Move object related functions to util
* Remove unused
* Fix tests
* Remove log
* Update the region daily at 2
* Fix logic
* Formatting
* Initialize grid before starting processing frames
* Move back to creating grid in main process
* Formatting
* Fixes
* Formating
* Fix region check
* Accept all but true
* Use regions grid for startup scan
* Add clarifying comment
* Fix new grid requests
* Add tests
* Delete stale region grids from DB
* don't zoom if camera doesn't support it
* basic zooming
* make zooming configurable
* zooming docs
* optional zooming in camera status
* Use absolute instead of relative zooming
* increase edge threshold
* zoom considering object area
* bugfixes
* catch onvif zooming errors
* relative zooming option for dahua/amcrest cams
* docs
* docs
* don't make small movements
* remove old logger statement
* fix small movements
* use enum in config for zooming
* fix formatting
* empty move queue first
* clear tracked object before waiting for stop
* use velocity estimation for movements
* docs updates
* add tests
* typos
* recalc every 50 moves
* adjust zoom based on estimate box if calibrated
* tweaks for fast objects and large movements
* use real time for calibration and add info logging
* docs updates
* remove area scale
* Add example video to docs
* zooming font header size the same as the others
* log an error if a ptz doesn't report a MoveStatus
* debug logging for onvif service capabilities
* ensure camera supports ONVIF MoveStatus
* much improved motion estimation and tracking
* docs updates
* move ptz specific mp values to ptz_metrics dict
* only check if moving at frame time
* pass full dict instead of individual values
* Basic functionality
* Threaded motion estimator
* Revert "Threaded motion estimator"
This reverts commit 3171801607.
* Don't detect motion when ptz is moving
* fix motion logic
* fix mypy error
* Add threaded queue for movement for slower ptzs
* Move queues per camera
* Move autotracker start to app.py
* iou value for tracked object
* mqtt callback
* tracked object should be initially motionless
* only draw thicker box if autotracking is enabled
* Init if enabled when initially disabled in config
* Fix init
* Thread names
* Always use motion estimator
* docs
* clarify fov support
* remove size ratio
* use mp event instead of value for ptz status
* update autotrack at half fps
* fix merge conflict
* fix event type for mypy
* clean up
* Clean up
* remove unused code
* merge conflict fix
* docs: update link to object_detectors page
* Update docs/docs/configuration/autotracking.md
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* clarify wording
* pass actual instances directly
* default return preset
* fix type
* Error message when onvif init fails
* disable autotracking if onvif init fails
* disable autotracking if onvif init fails
* ptz module
* verify required_zones in config
* update util after dev merge
---------
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* reduce contention on frame_queue
don't check if the queue is full, just attempt to add the frame
in a non-blocking manner, and then if it fails, skip it
* don't check if the frame queue is empty, just try and get from it
* Update frigate/video.py
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
---------
Co-authored-by: Blake Blackshear <blakeb@blakeshome.com>
* Refactored queues to use faster_fifo instead of mp.Queue
* Refactored LimitedQueue to include a counter for the number of items in the queue and updated put and get methods to use the counter
* Refactor app.py and util.py to use a custom Queue implementation called LQueue instead of the existing Queue
* Refactor put and get methods in LimitedQueue to handle queue size and blocking behavior more efficiently
* code format
* remove code from other branch (merging fuckup)
* configurable ffmpeg timeout
* configurable ffmpeg healthcheck interval
rename timeout to healthcheck_interval
only grab config value once
* configurable ffmpeg retry interval
rename healthcheck_interval to retry_interval
* add retry_interval to docs
- update retry_interval text in config.py
* Load labels dynamically to include custom events and audio, do not include attribute labels
* Formatting
* Fix sorting
* Also filter tracked object list on camera page
* isort
* Don't fail before load
* pass attribute labels as attributes
* add label attrs to events and snapshots
* incorporate area of license_plate and face into snapshot selection
* populate sublabels for cars with logos
* refactor existing motion detector
* implement and use cnt bgsub
* pass fps to motion detector
* create a simplified motion detector
* lightning detection
* update default motion config
* lint imports
* use estimated boxes for regions
* use improved motion detector
* update test
* use a different strategy for clustering motion and object boxes
* increase alpha during calibration
* simplify object consolidation
* add some reasonable constraints to the estimated box
* adjust cluster boundary to 10%
* refactor
* add disabled debug code
* fix variable scope
* Add isort and ruff linter
Both linters are pretty common among modern python code bases.
The isort tool provides stable sorting and grouping, as well as pruning
of unused imports.
Ruff is a modern linter, that is very fast due to being written in rust.
It can detect many common issues in a python codebase.
Removes the pylint dev requirement, since ruff replaces it.
* treewide: fix issues detected by ruff
* treewide: fix bare except clauses
* .devcontainer: Set up isort
* treewide: optimize imports
* treewide: apply black
* treewide: make regex patterns raw strings
This is necessary for escape sequences to be properly recognized.
* dont wait so long for queues
* implement stop methods for comms
* set the detection events on exit and return early from processing
* handle the stop event in the broadcast threads
* short circuit the detection process exit code if it already exited
* some logging for stats thread
* just keep the log process alive 1 second after the last log message
* ensure the multiprocessing queues are emptied and closed
* Update frigate/log.py
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* Update frigate/log.py
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* mypy fixes
---------
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* Restart ffmpeg if process exceeds detect fps by 10
* Update frigate/video.py
Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
* spelling
---------
Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
* Catch when recording segments are not being written to cache and restart ffmpeg responsible for record
* Ensure this check is only run for role with record
* Fix formatting
* Redo recordings validator to watch segments time and restart if no segment for 30 seconds
* Formatting
* Increase wait time to 120 seconds and improve error message
* Add more config checks for record args and add test
* Formatting
* Specify output args.
* Move to images specific folder
* Send error image when camera stream is not available
* Immediately set camera_fps to 0 if camera crashes
* Cache error image so it is not read from file system on each run
* Move camera fps set
* Refactor EdgeTPU and CPU model handling to detector submodules.
* Fix selecting the correct detection device type from the config
* Remove detector type check when creating ObjectDetectProcess
* Fixes after rebasing to 0.11
* Add init file to detector folder
* Rename to detect_api
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* Add unit test for LocalObjectDetector class
* Add configuration for model inputs
Support transforming detection regions to RGB or BGR.
Support specifying the input tensor shape. The tensor shape has a standard format ["BHWC"] when handed to the detector, but can be transformed in the detector to match the model shape using the model input_tensor config.
* Add documentation for new model config parameters
* Add input tensor transpose to LocalObjectDetector
* Change the model input tensor config to use an enumeration
* Updates for model config documentation
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
* -1 so ensure indexes are correct
* Catch case of zero division
* Due to the -1, it may be negative
* Ignore source of error
The error is occurring due to a detections bounding box starting beyond the frame, this should be immediately ignored
* Formatting
* Check horizontal placement as well
* Remove original frame clamping