Commit Graph

108 Commits

Author SHA1 Message Date
Nicolas Mowen
206ed06905
Make all SHM management untracked (#15011) 2024-11-15 14:14:37 -07:00
Nicolas Mowen
7fdf42a56f
Various Fixes (#15004)
* Don't track shared memory in frame tracker

* Don't track any instance

* Don't assign sub label to objects when multiple cars are overlapping

* Formatting

* Fix assignment
2024-11-15 09:54:59 -07:00
Nicolas Mowen
9c20cd5f7b
Handle in progress previews export and fix time check bug (#14930)
* Handle in progress previews and fix time check bug

* Formatting
2024-11-11 09:30:55 -06:00
Nicolas Mowen
96c0c43dc8
Add support for specifying tensorrt device (#14898) 2024-11-10 08:43:24 -06:00
Nicolas Mowen
a13b9815f6
Various fixes (#14786)
* Catch openvino error

* Remove clip deletion

* Update deletion text

* Fix timeline not respecting timezone config

* Tweaks

* More timezone fixes

* Fix

* More timezone fixes

* Fix shm docs
2024-11-04 07:07:57 -07:00
Felipe Santos
9755fa0537
Fix exports migration when there is none (#14761) 2024-11-03 10:00:12 -07:00
joshjryan
d7935abc14
Set the loglevel for OpenCV ffmpeg messages to fatal (#14728)
* Set the loglevel for OpenCV ffmpeg messages to fatal

* Set OPENCV_FFMPEG_LOGLEVEL in Dockerfile
2024-11-01 20:01:38 -06:00
Nicolas Mowen
357ce0382e
Fixes (#14668)
* Fix environment vars reading

* fix yaml returning none

* Assume rocm model is onnx despite file extension
2024-10-29 15:34:07 -05:00
Nicolas Mowen
4e25bebdd0
Add ability to configure model input dtype (#14659)
* Add input type for dtype

* Add ability to manually enable TRT execution provider

* Formatting
2024-10-29 10:28:05 -05:00
Nicolas Mowen
94f7528885
Bug fixes (#14588)
* Get intel stats manually if parsing fails

* Fix assignment

* Clean up mqtt

* Formatting

* Fix logic
2024-10-25 06:47:56 -06:00
Nicolas Mowen
40c6fda19d
Various fixes and improvements (#14492)
* Refactor preprocessing of images

* Cleanup preprocessing

* Improve naming and handling of embeddings

* Handle invalid intel json

* remove unused

* Use enum for model types

* Formatting
2024-10-21 16:19:34 -06:00
Josh Hawkins
8364e68667
Model and genai fixes (#14481)
* disable mem arena in options for cpu only

* add try/except around ollama initialization

* update docs
2024-10-21 09:00:45 -06:00
Nicolas Mowen
560dc68120
Fixes (#14480)
* Catch case where object does not have thumbnail data

* Catch intel stats json decoding error

* Catch division by zero
2024-10-21 09:38:48 -05:00
Josh Hawkins
6c70e56059
Misc bugfixes and improvements (#14460)
* only save a fixed number of thumbnails if genai is enabled

* disable cpu_mem_arena to save on memory until its actually needed

* fix search settings pane so it actually saves to the config
2024-10-20 14:14:51 -06:00
Nicolas Mowen
8ac4b001a2
Various fixes (#14410)
* Fix access

* Reorganize tracked object for imports

* Separate out rockchip build

* Formatting

* Use original ffmpeg build

* Fix build

* Update default search type value
2024-10-17 11:02:27 -05:00
Josh Hawkins
0ee32cf110
Fix yaml bug and ensure embeddings progress doesn't show until all models are loaded (#14338) 2024-10-14 08:23:08 -06:00
Nicolas Mowen
9adffa1ef5
Detection adjustments (#14329) 2024-10-13 21:34:51 -05:00
Nicolas Mowen
3a403392e7
Fixes for model downloading (#14305)
* Use different requestor for downloaders

* Handle case where lock is left over from failed partial download

* close requestor

* Formatting
2024-10-12 13:36:10 -05:00
Nicolas Mowen
d4b9b5a7dd
Reduce onnx memory usage (#14285) 2024-10-11 13:03:47 -05:00
Nicolas Mowen
6df541e1fd
Openvino models (#14283)
* Enable model conversion cache for openvino

* Use openvino directly for onnx embeddings if available

* Don't fail if zmq is busy
2024-10-11 10:47:23 -06:00
Nicolas Mowen
dd6276e706
Embeddings fixes (#14269)
* Add debugging logs for more info

* Improve timeout handling

* Fix event cleanup

* Handle zmq error and empty data

* Don't run download

* Remove unneeded embeddings creations

* Update timouts

* Init models immediately

* Fix order of init

* Cleanup
2024-10-10 16:37:43 -05:00
Nicolas Mowen
8ade85edec
Restructure embeddings (#14266)
* Restructure embeddings

* Use ZMQ to proxy embeddings requests

* Handle serialization

* Formatting

* Remove unused
2024-10-10 09:42:24 -06:00
Nicolas Mowen
a2ca18a714
Bug fixes (#14263)
* Simplify loitering logic

* Fix divide by zero

* Add device config for semantic search

* Add docs
2024-10-10 07:09:12 -06:00
Nicolas Mowen
bc3a06178b
Embedding gpu (#14253) 2024-10-09 19:46:31 -06:00
Nicolas Mowen
2541a345d0
Improve Nvidia GPU stats (#14206)
* :Add support for nvidia driver info

* Don't show temperature if detector isn't called coral

* Add encoder and decoder info for Nvidia GPUs

* Fix device info

* Implement GPU info for nvidia GPU

* Update web/src/views/system/GeneralMetrics.tsx

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Update web/src/views/system/GeneralMetrics.tsx

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2024-10-07 20:15:31 -06:00
Josh Hawkins
24ac9f3e5a
Use sqlite-vec extension instead of chromadb for embeddings (#14163)
* swap sqlite_vec for chroma in requirements

* load sqlite_vec in embeddings manager

* remove chroma and revamp Embeddings class for sqlite_vec

* manual minilm onnx inference

* remove chroma in clip model

* migrate api from chroma to sqlite_vec

* migrate event cleanup from chroma to sqlite_vec

* migrate embedding maintainer from chroma to sqlite_vec

* genai description for sqlite_vec

* load sqlite_vec in main thread db

* extend the SqliteQueueDatabase class and use peewee db.execute_sql

* search with Event type for similarity

* fix similarity search

* install and add comment about transformers

* fix normalization

* add id filter

* clean up

* clean up

* fully remove chroma and add transformers env var

* readd uvicorn for fastapi

* readd tokenizer parallelism env var

* remove chroma from docs

* remove chroma from UI

* try removing custom pysqlite3 build

* hard code limit

* optimize queries

* revert explore query

* fix query

* keep building pysqlite3

* single pass fetch and process

* remove unnecessary re-embed

* update deps

* move SqliteVecQueueDatabase to db directory

* make search thumbnail take up full size of results box

* improve typing

* improve model downloading and add status screen

* daemon downloading thread

* catch case when semantic search is disabled

* fix typing

* build sqlite_vec from source

* resolve conflict

* file permissions

* try build deps

* remove sources

* sources

* fix thread start

* include git in build

* reorder embeddings after detectors are started

* build with sqlite amalgamation

* non-platform specific

* use wget instead of curl

* remove unzip -d

* remove sqlite_vec from requirements and load the compiled version

* fix build

* avoid race in db connection

* add scale_factor and bias to description zscore normalization
2024-10-07 14:30:45 -06:00
gtsiam
a468ed316d
Added stop_event to util.Process (#14142)
* Added stop_event to util.Process

util.Process will take care of receiving signals when the stop_event is
accessed in the subclass. If it never is, SystemExit is raised instead.

This has the effect of still behaving like multiprocessing.Process when
stop_event is not accessed, while still allowing subclasses to not deal
with the hassle of setting it up.

* Give each util.Process their own logger

This will help to reduce boilerplate in subclasses.

* Give explicit types to util.Process.__init__

This gives better type hinting in the editor.

* Use util.Process facilities in AudioProcessor

Boilerplate begone!

* Removed pointless check in util.Process

The log_listener.queue should never be None, unless something has gone
extremely wrong in the log setup code. If we're that far gone, crashing
is better.

* Make sure faulthandler is enabled in all processes

This has no effect currently since we're using the fork start_method.
However, when we inevidably switch to forkserver (either by choice, or
by upgrading to python 3.14+) not having this makes for some really fun
failure modes :D
2024-10-03 11:03:43 -06:00
Nicolas Mowen
f36e7430ae
Fix logging (#14079)
* Fix log level setting

* fix app.py mypy issues
2024-09-30 17:45:22 -05:00
Nicolas Mowen
4dc4704bb4
Improve Intel GPU stats (#14073)
* Fix formatting

* Fix test
2024-09-30 16:41:14 -05:00
Josh Hawkins
3688a3bc67
Misc fixes (#14064)
* Add loading indicator when explore view is revalidating

* Portal tooltip in object lifecycle pane

* Better config file handling

* Only manually set aspect ratio when using alert videos
2024-09-30 07:32:54 -06:00
Nicolas Mowen
05fe7f8a48
Fixes & Tweaks (#14013)
* Rework to create util for onnx initialization

* Fix shm log

* Fix onClick exceptoins
2024-09-27 07:41:48 -06:00
gtsiam
c0bd3b362c
Custom classes for Process and Metrics (#13950)
* Subclass Process for audio_process

* Introduce custom mp.Process subclass

In preparation to switch the multiprocessing startup method away from
"fork", we cannot rely on os.fork cloning the log state at fork time.
Instead, we have to set up logging before we run the business logic of
each process.

* Make camera_metrics into a class

* Make ptz_metrics into a class

* Fixed PtzMotionEstimator.ptz_metrics type annotation

* Removed pointless variables

* Do not start audio processor when no audio cameras are configured
2024-09-27 07:53:23 -05:00
gtsiam
dc54981784
Move more things out of FrigateApp (#13897)
* Moved FrigateApp.init_config() into FrigateConfig.load()

* Move frigate config loading into main

* Store PlusApi in FrigateConfig

* Register SIGTERM handler in main

* Ensure logging is setup during config parsing

* Removed pointless try

* Moved config initialization out of FrigateApp

* Made FrigateApp.shm_frame_count into a function

* Removed log calls from signal handlers

python's logging calls are not re-entrant, which caused at least one of
these to deadlock randomly.

* Reopen stdout/err on process fork

This helps avoid deadlocks (https://github.com/python/cpython/issues/91776).

* Make mypy happy

* Whoops. I might have forgotten to save.

Truly an amateur mistake.

* Always call FrigateApp.stop()
2024-09-24 07:07:47 -05:00
gtsiam
e8763b3697
Removed usage of PyYAML for config parsing. (#13883)
* Ignore entire __pycache__ folder instead of individual *.pyc files

* Ignore .mypy_cache in git

* Rework config YAML parsing to use only ruamel.yaml

PyYAML silently overrides keys when encountering duplicates, but ruamel
raises and exception by default. Since we're already using it elsewhere,
dropping PyYAML is an easy choice to make.

* Added EnvString in config to slim down runtime_config()

* Added gitlens to devcontainer

* Automatically call FrigateConfig.runtime_config()

runtime_config needed to be called manually before. Now, it's been
removed, but the same code is run by a pydantic validator.

* Fix handling of missing -segment_time

* Removed type annotation on FrigateConfig's parse

I'd like to keep them, but then mypy complains about some fundamental
errors with how the pydantic model is structured. I'd like to fix it,
but I'd rather work towards moving some of this config to the database.
2024-09-22 10:56:57 -05:00
Josh Hawkins
ff9e1da1de
Revert "Rewrite yaml loader (#13803)" (#13805)
This reverts commit 38ff46e45c.
2024-09-17 15:03:22 -06:00
gtsiam
38ff46e45c
Rewrite yaml loader (#13803)
* Ignore entire __pycache__ folder instead of individual *.pyc files

* Rewrite the yaml loader to match PyYAML

The old implementation would fail in weird ways with configs that were
incorrect in just the right way. The new implementation just does what
PyYAML would do, only diverging in case of duplicate keys.

* Clarify duplicate yaml key ValueError message

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2024-09-17 15:52:55 -05:00
gtsiam
edababa88e
Work through most of the cspell warnings in python (#13794) 2024-09-17 10:41:46 -05:00
Nicolas Mowen
088a0fb4a5
Ffmpeg cleanup (#13737) 2024-09-14 07:03:39 -06:00
Nicolas Mowen
5ff476c6f9
Configurable ffmpeg (#13722)
* Install multiple ffmpeg versions and add config to make it configurable

* Update docs

* Run ffprobe too

* Cleanup

* Apply config to go2rtc as well

* Fix ffmpeg bin

* Docs

* Restore path

* Cleanup env var

* Fix ffmpeg path for encoding

* Fix export

* Formatting
2024-09-13 15:14:51 -05:00
Nicolas Mowen
62657ad05a
Ensure detections are not immediately deleted (#13683)
* Ensure detections are not immediately deleted

* Formatting
2024-09-11 15:46:24 -05:00
Josh Hawkins
ddf9163c47
Implement object lifecycle pane (#13550)
* Object lifecycle pane

* fix thumbnails and annotation offset math

* snapshot endpoint height and format, yaml types, bugfixes

* clean up for new type

* use get_image_from_recording in recordings snapshot api

* make height optional
2024-09-04 07:46:49 -06:00
Nicolas Mowen
9afa1354da
Limit shm frame count (#12363)
* Limited shm frame count (#12346)

* 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

* Add handler logs when frame is None

* Don't fail on cleanup

* Cleanup logging

* Update docs

* Update calculation

* Restore condition

* Fix case where thumbnail is saved without frame

* Adjust debug logs

* Calculate best shm frame count

* Fix shm count calculation

* Catch missing frame

* Formatting

* Clarify docs

* Catch none frame in autotracking
2024-09-03 10:22:30 -06:00
Nicolas Mowen
0acbd3d5e8
Refactor recordings retention to be based on review items (#13355)
* Refactor recordings config to be based off of review items

* Update object processing logic for when an event is created

* Migrate to deciding recording retention based on review items

* Refactor recording expiration to be based off of review items

* Remove remainder of recording events access

* Handle migration automatically

* Update version and cleanup

* Update docs

* Clarify docs

* Cleanup

* Target camera config

* Safely access all fields
2024-09-02 07:22:53 -06:00
Martin Weinelt
ecaba82c9d
Use escapse string in get_intel_gpu_stats (#13452)
````
frigate/util/services.py:299: SyntaxWarning: invalid escape sequence '\d'
    for result in re.findall('"Video/\d":{[a-z":\d.,%]+}', reading):
````
2024-08-31 10:49:13 -06:00
Nicolas Mowen
e9e86cc5af
Fix use experimental migrator (#12906) 2024-08-09 16:59:55 -05:00
Nicolas Mowen
91f62cf8ce
Fix ui config migration (#12476) 2024-07-16 08:45:11 -05:00
Nicolas Mowen
f44df9fe61
Revert "Limited shm frame count (#12346)" (#12362)
This reverts commit 34812b7439.
2024-07-09 11:49:08 -05:00
Nicolas Mowen
34812b7439
Limited shm frame count (#12346)
* 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
2024-07-09 06:44:53 -06:00
Josh Hawkins
a0741aa7b1
Remove matplotlib and generate color palette to mimic matplotlib's colors (#12327) 2024-07-07 12:53:00 -06:00
Blake Blackshear
b4384a1be3
Shutdown hang (#11793)
* 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
2024-06-06 18:54:38 -05:00