Commit Graph

4263 Commits

Author SHA1 Message Date
Nicolas Mowen
0250db70d0 Cleanup detections updater 2025-07-18 12:28:30 -06:00
Nicolas Mowen
107007a636 Cleanup event metadata updater 2025-07-18 12:28:30 -06:00
Nicolas Mowen
87efebde19 Cleanup event metadata updater 2025-07-18 12:28:29 -06:00
Nicolas Mowen
d6f2d55525 Make publisher have a generic type 2025-07-18 12:23:28 -06:00
Nicolas Mowen
de7238df7f Cleanup recordings updator 2025-07-18 12:23:28 -06:00
Nicolas Mowen
cdec93d45a Cleanup config updater 2025-07-18 12:23:28 -06:00
Nicolas Mowen
629e04105b Cleanup embeddings typing 2025-07-18 12:23:28 -06:00
Nicolas Mowen
81d52bcec6 Cleanup inter process typing issues 2025-07-18 12:23:28 -06:00
Nicolas Mowen
aabab5e5ef Make zmq data types consistent 2025-07-18 12:23:28 -06:00
Nicolas Mowen
ad2664b488 Enable mypy for comms 2025-07-18 12:23:28 -06:00
Nicolas Mowen
21d3476bd9
Require setting process priority for FrigateProcess (#19207) 2025-07-18 12:23:06 -05:00
Nicolas Mowen
b88fa9ece6
Object attribute classification (#19205)
* Add enum for type of classification for objects

* Update recognized license plate topic to be used as attribute updater

* Update attribute for attribute type object classification

* Cleanup
2025-07-18 09:28:02 -05:00
Nicolas Mowen
7ea288fe32
Classification train updates (#19173)
* Improve model train button

* Add filters for classification

* Cleanup

* Don't run classification on false positives

* Cleanup filter

* Fix icon color
2025-07-16 21:46:59 -05:00
Josh Hawkins
99885b4bdc
Dynamically enable/disable GenAI (#19139)
* config

* dispatcher and mqtt

* docs

* use config updater

* add switch to frontend
2025-07-14 07:58:43 -05:00
Josh Hawkins
d97b451d12
Optionally show tracked object paths in debug view (#19025) 2025-07-07 09:33:19 -05:00
Josh Hawkins
57bb0cc397
Semantic Search Triggers (#18969)
* semantic trigger test

* database and model

* config

* embeddings maintainer and trigger post-processor

* api to create, edit, delete triggers

* frontend and i18n keys

* use thumbnail and description for trigger types

* image picker tweaks

* initial sync

* thumbnail file management

* clean up logs and use saved thumbnail on frontend

* publish mqtt messages

* webpush changes to enable trigger notifications

* add enabled switch

* add triggers from explore

* renaming and deletion fixes

* fix typing

* UI updates and add last triggering event time and link

* log exception instead of return in endpoint

* highlight entry in UI when triggered

* save and delete thumbnails directly

* remove alert action for now and add descriptions

* tweaks

* clean up

* fix types

* docs

* docs tweaks

* docs

* reuse enum
2025-07-07 09:03:57 -05:00
Nicolas Mowen
2b4a773f9b
Classification improvements (#19020)
* Move classification training to full process

* Sort class images
2025-07-07 07:36:06 -06:00
Nicolas Mowen
0f4cac736a
Improve classification UI (#18910)
* Move threhsold to base model config

* Improve score handling

* Add back button
2025-06-27 09:35:02 -05:00
Nicolas Mowen
bd6dee5b38 Remove TFLite init logs 2025-06-27 06:54:02 -06:00
Nicolas Mowen
53315342c0
Improve object classification (#18908)
* Ui improvements

* Improve image cropping and model saving

* Improve naming

* Add logs for training

* Improve model labeling

* Don't set sub label for none object classification

* Cleanup
2025-06-27 06:28:40 -06:00
Nicolas Mowen
4b18d54d3d
0.17 tweaks (#18892)
* Set version

* Cleanup more logs

* Don't log matplotlib
2025-06-26 07:32:48 -06:00
Josh Hawkins
71df5ad058
Add ONVIF focus support (#18883)
* backend

* frontend and i18n
2025-06-25 16:45:36 -05:00
Nicolas Mowen
add68b8860
Improve logging (#18867)
* Ignore numpy get limits warning

* Add function wrapper to redirect stdout and stderr to logpipe

* Save stderr too

* Add more to catch

* run logpipe

* Use other logging redirect class

* Use other logging redirect class

* add decorator for redirecting c/c++ level output to logger

* fix typing

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2025-06-25 07:24:45 -06:00
Josh Hawkins
32f82a947d
Don't try to close or join mp manager queues (#18866)
Multiprocessing Manager queues don't have a close() or join_thread() method, and the Manager will clean it up appropriately after we empty it. This prevents an infinite loop when an AttributeError exception fires for Manager AutoProxy queue objects.
2025-06-24 15:19:09 -06:00
Nicolas Mowen
47a0097e95
Handle SIGINT with forkserver (#18860)
* Pass stopevent from main start

* Share stop event across processes

* preload modules

* remove explicit os._exit call

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2025-06-24 11:41:11 -06:00
Nicolas Mowen
a22e24f24b Fix process name 2025-06-23 15:55:57 -06:00
Nicolas Mowen
23cc1803a1
Classification model cover images (#18843)
* Move to separate component

* Add cover images for clssification models
2025-06-23 08:40:28 -06:00
Josh Hawkins
93a3cf8fb9
Catch invalid character index in lpr CTC decoder (#18825) 2025-06-21 21:44:37 -05:00
Josh Hawkins
55c6008ff0
Fix birdseye crash when dynamically adding a camera (#18821) 2025-06-21 14:38:34 -06:00
Nicolas Mowen
20dac9d05e Catch unpickling error 2025-06-20 06:44:48 -06:00
Nicolas Mowen
98232af0fc Don't fail on unicode debug for config updates 2025-06-17 12:11:11 -06:00
Nicolas Mowen
907e351dff Don't use staticmethod 2025-06-14 09:27:50 -06:00
Nicolas Mowen
13e90f7f49 Reduce tf initialization 2025-06-13 18:22:13 -06:00
Nicolas Mowen
c3ba834a1c
Fix go2rtc init (#18708)
* Cleanup process handling

* Adjust process name
2025-06-13 12:09:51 -05:00
Josh Hawkins
d7a446e0f6
Ensure logging config is propagated to forked processes (#18704)
* Move log level initialization to log

* Use logger config

* Formatting

* Fix config order

* Set process names

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2025-06-13 09:43:38 -05:00
Josh Hawkins
8a8fd4ca8e
Add basic camera settings to UI for testing (#18690)
* add basic camera add/edit pane to the UI for testing

* only init model runner if transcription is enabled globally

* fix role checkboxes
2025-06-12 13:34:45 -06:00
Nicolas Mowen
8485023442
Use Fork-Server As Spawn Method (#18682)
* Set runtime

* Use count correctly

* Don't assume camera sizes

* Use separate zmq proxy for object detection

* Correct order

* Use forkserver

* Only store PID instead of entire process reference

* Cleanup

* Catch correct errors

* Fix typing

* Remove before_run from process util

The before_run never actually ran because:

You're right to suspect an issue with before_run not being called and a potential deadlock. The way you've implemented the run_wrapper using __getattribute__ for the run method of BaseProcess is a common pitfall in Python's multiprocessing, especially when combined with how multiprocessing.Process works internally.

Here's a breakdown of why before_run isn't being called and why you might be experiencing a deadlock:

The Problem: __getattribute__ and Process Serialization
When you create a multiprocessing.Process object and call start(), the multiprocessing module needs to serialize the process object (or at least enough of it to re-create the process in the new interpreter). It then pickles this serialized object and sends it to the newly spawned process.

The issue with your __getattribute__ implementation for run is that:

run is retrieved during serialization: When multiprocessing tries to pickle your Process object to send to the new process, it will likely access the run attribute. This triggers your __getattribute__ wrapper, which then tries to bind run_wrapper to self.
run_wrapper is bound to the parent process's self: The run_wrapper closure, when created in the parent process, captures the self (the Process instance) from the parent's memory space.
Deserialization creates a new object: In the child process, a new Process object is created by deserializing the pickled data. However, the run_wrapper method that was pickled still holds a reference to the self from the parent process. This is a subtle but critical distinction.
The child's run is not your wrapped run: When the child process starts, it internally calls its own run method. Because of the serialization and deserialization process, the run method that's ultimately executed in the child process is the original multiprocessing.Process.run or the Process.run if you had directly overridden it. Your __getattribute__ magic, which wraps run, isn't correctly applied to the Process object within the child's context.

* Cleanup

* Logging bugfix (#18465)

* use mp Manager to handle logging queues

A Python bug (https://github.com/python/cpython/issues/91555) was preventing logs from the embeddings maintainer process from printing. The bug is fixed in Python 3.14, but a viable workaround is to use the multiprocessing Manager, which better manages mp queues and causes the logging to work correctly.

* consolidate

* fix typing

* Fix typing

* Use global log queue

* Move to using process for logging

* Convert camera tracking to process

* Add more processes

* Finalize process

* Cleanup

* Cleanup typing

* Formatting

* Remove daemon

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2025-06-12 12:12:34 -06:00
Nicolas Mowen
6f16ecdd48
Dynamic Management of Cameras (#18671)
* Add base class for global config updates

* Add or remove camera states

* Move camera process management to separate thread

* Move camera management fully to separate class

* Cleanup

* Stop camera processes when stop command is sent

* Start processes dynamically when needed

* Adjust

* Leave extra room in tracked object queue for two cameras

* Dynamically set extra config pieces

* Add some TODOs

* Fix type check

* Simplify config updates

* Improve typing

* Correctly handle indexed entries

* Cleanup

* Create out SHM

* Use ZMQ for signaling object detectoin is completed

* Get camera correctly created

* Cleanup for updating the cameras config

* Cleanup

* Don't enable audio if no cameras have audio transcription

* Use exact string so similar camera names don't interfere

* Add ability to update config via json body to config/set endpoint

Additionally, update the config in a single rather than multiple calls for each updated key

* fix autotracking calibration to support new config updater function

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2025-06-11 12:25:30 -05:00
Nicolas Mowen
28fba7122d
Refactor TensorRT (#18643)
* Combine base and arm trt detectors

* Remove unused deps for amd64 build

* Add missing packages and cleanup ldconfig

* Expand packages for tensorflow model training

* Cleanup

* Refactor training to not reserve memory
2025-06-09 08:25:33 -06:00
Josh Hawkins
9a5162752c
Make Birdseye clickable (#18628)
* keep track of layout changes and publish on change

* websocket hook

* clickable overlay div to navigate to full camera view
2025-06-08 12:06:17 -06:00
FL42
eb83f2ac47
fix: Initialize GenAI client if GenAI is enabled globally (#18623) 2025-06-08 06:55:29 -06:00
FL42
76201c0c7f
feat: enable using GenAI for cameras with GenAI disabled from the API (#18616) 2025-06-07 13:43:29 -05:00
Jimmy
ab7b12da54
Add Mesa Teflon as a TFLite detector (#18310)
* Refactor common functions for tflite detector implementations

* Add detector using mesa teflon delegate

Non-EdgeTPU TFLite can use the standard .tflite format

* Add mesa-teflon-delegate from bookworm-backports to arm64 images
2025-06-06 13:41:04 -06:00
Nicolas Mowen
8409100623
Classification Model Metrics (#18595)
* Add speed and rate metrics for custom classification models

* Use metrics for classification models

* Use keys

* Cast to list
2025-06-06 11:29:44 -05:00
Nicolas Mowen
be8ee068e2
Live classification model training (#18583)
* Implement model training via ZMQ and add model states to represent training

* Get model updates working

* Improve toasts and model state

* Clean up logging

* Add back in
2025-06-05 09:13:12 -06:00
Nicolas Mowen
85d721eb6b
Classification Model UI (#18571)
* Setup basic training structure

* Build out route

* Handle model configs

* Add image fetch APIs

* Implement model training screen with dataset selection

* Implement viewing of training images

* Adjust directories

* Implement viewing of images

* Add support for deleting images

* Implement full deletion

* Implement classification model training

* Improve naming

* More renaming

* Improve layout

* Reduce logging

* Cleanup
2025-06-04 18:09:55 -05:00
Josh Hawkins
eb1fe9fe20
Audio transcription tweaks (#18540)
* use model runner

* unload whisper model when live transcription is complete
2025-06-03 06:53:48 -05:00
Josh Hawkins
645868e099
Upgrade PaddleOCR models to v4 (rec) and v5 (det) (#18505)
The PP_OCRv5 text detection models have greatly improved over v3. The v5 recognition model makes improvements to challenging handwriting and uncommon characters, which are not necessary for LPR, so using v4 seemed like a better choice to continue to keep inference time as low as possible. Also included is the full dictionary for Chinese character support.
2025-06-01 14:21:12 -06:00
Nicolas Mowen
568e620963
Tiered recordings (#18492)
* Implement tiered recording

* Add migration for record config

* Update docs

* Update reference docs

* Fix preview query

* Fix incorrect accesses

* Fix

* Fix

* Fix

* Fix
2025-05-30 17:01:39 -06:00
Nicolas Mowen
caf3e9fc8c
Intel updates (#18493)
* Update openvino and onnxruntime

* Install icd and level-zero-gpu deps from intel directly

* Install

* Add dep

* Fix package install
2025-05-30 15:30:21 -06:00