mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-27 13:47:50 +02:00
Update deps (#19617)
* Update virtualenv * Fix device ID * Fix dependency conflict * Cleanup mypy
This commit is contained in:
parent
8e254aa1f0
commit
e92267d7e2
@ -1,22 +1,23 @@
|
|||||||
aiofiles == 24.1.*
|
aiofiles == 24.1.*
|
||||||
click == 8.1.*
|
click == 8.1.*
|
||||||
# FastAPI
|
# FastAPI
|
||||||
aiohttp == 3.11.3
|
aiohttp == 3.12.*
|
||||||
starlette == 0.41.2
|
starlette == 0.47.*
|
||||||
starlette-context == 0.3.6
|
starlette-context == 0.4.*
|
||||||
fastapi == 0.115.*
|
fastapi[standard-no-fastapi-cloud-cli] == 0.116.*
|
||||||
uvicorn == 0.30.*
|
uvicorn == 0.35.*
|
||||||
slowapi == 0.1.*
|
slowapi == 0.1.*
|
||||||
joserfc == 1.0.*
|
joserfc == 1.2.*
|
||||||
pathvalidate == 3.2.*
|
cryptography == 44.0.*
|
||||||
|
pathvalidate == 3.3.*
|
||||||
markupsafe == 3.0.*
|
markupsafe == 3.0.*
|
||||||
python-multipart == 0.0.12
|
python-multipart == 0.0.20
|
||||||
# Classification Model Training
|
# Classification Model Training
|
||||||
tensorflow == 2.19.* ; platform_machine == 'aarch64'
|
tensorflow == 2.19.* ; platform_machine == 'aarch64'
|
||||||
tensorflow-cpu == 2.19.* ; platform_machine == 'x86_64'
|
tensorflow-cpu == 2.19.* ; platform_machine == 'x86_64'
|
||||||
# General
|
# General
|
||||||
mypy == 1.6.1
|
mypy == 1.6.1
|
||||||
onvif-zeep-async == 3.1.*
|
onvif-zeep-async == 4.0.*
|
||||||
paho-mqtt == 2.1.*
|
paho-mqtt == 2.1.*
|
||||||
pandas == 2.2.*
|
pandas == 2.2.*
|
||||||
peewee == 3.17.*
|
peewee == 3.17.*
|
||||||
@ -30,7 +31,7 @@ ruamel.yaml == 0.18.*
|
|||||||
tzlocal == 5.2
|
tzlocal == 5.2
|
||||||
requests == 2.32.*
|
requests == 2.32.*
|
||||||
types-requests == 2.32.*
|
types-requests == 2.32.*
|
||||||
norfair == 2.2.*
|
norfair == 2.3.*
|
||||||
setproctitle == 1.3.*
|
setproctitle == 1.3.*
|
||||||
ws4py == 0.5.*
|
ws4py == 0.5.*
|
||||||
unidecode == 1.3.*
|
unidecode == 1.3.*
|
||||||
|
@ -5,15 +5,10 @@ from typing import Any, Sequence
|
|||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from norfair import (
|
from norfair.drawing.draw_boxes import draw_boxes
|
||||||
Detection,
|
from norfair.drawing.drawer import Drawable, Drawer
|
||||||
Drawable,
|
from norfair.filter import OptimizedKalmanFilterFactory
|
||||||
OptimizedKalmanFilterFactory,
|
from norfair.tracker import Detection, TrackedObject, Tracker
|
||||||
Tracker,
|
|
||||||
draw_boxes,
|
|
||||||
)
|
|
||||||
from norfair.drawing.drawer import Drawer
|
|
||||||
from norfair.tracker import TrackedObject
|
|
||||||
from rich import print
|
from rich import print
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.table import Table
|
from rich.table import Table
|
||||||
@ -198,19 +193,21 @@ class NorfairTracker(ObjectTracker):
|
|||||||
self.default_tracker = {
|
self.default_tracker = {
|
||||||
"static": Tracker(
|
"static": Tracker(
|
||||||
distance_function=frigate_distance,
|
distance_function=frigate_distance,
|
||||||
distance_threshold=self.default_tracker_config["distance_threshold"],
|
distance_threshold=self.default_tracker_config[ # type: ignore[arg-type]
|
||||||
|
"distance_threshold"
|
||||||
|
],
|
||||||
initialization_delay=self.detect_config.min_initialized,
|
initialization_delay=self.detect_config.min_initialized,
|
||||||
hit_counter_max=self.detect_config.max_disappeared,
|
hit_counter_max=self.detect_config.max_disappeared, # type: ignore[arg-type]
|
||||||
filter_factory=self.default_tracker_config["filter_factory"],
|
filter_factory=self.default_tracker_config["filter_factory"], # type: ignore[arg-type]
|
||||||
),
|
),
|
||||||
"ptz": Tracker(
|
"ptz": Tracker(
|
||||||
distance_function=frigate_distance,
|
distance_function=frigate_distance,
|
||||||
distance_threshold=self.default_ptz_tracker_config[
|
distance_threshold=self.default_ptz_tracker_config[
|
||||||
"distance_threshold"
|
"distance_threshold"
|
||||||
],
|
], # type: ignore[arg-type]
|
||||||
initialization_delay=self.detect_config.min_initialized,
|
initialization_delay=self.detect_config.min_initialized,
|
||||||
hit_counter_max=self.detect_config.max_disappeared,
|
hit_counter_max=self.detect_config.max_disappeared, # type: ignore[arg-type]
|
||||||
filter_factory=self.default_ptz_tracker_config["filter_factory"],
|
filter_factory=self.default_ptz_tracker_config["filter_factory"], # type: ignore[arg-type]
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +270,7 @@ class NorfairTracker(ObjectTracker):
|
|||||||
# Get the correct tracker for this object's label
|
# Get the correct tracker for this object's label
|
||||||
tracker = self.get_tracker(obj["label"])
|
tracker = self.get_tracker(obj["label"])
|
||||||
obj_match = next(
|
obj_match = next(
|
||||||
(o for o in tracker.tracked_objects if o.global_id == track_id), None
|
(o for o in tracker.tracked_objects if str(o.global_id) == track_id), None
|
||||||
)
|
)
|
||||||
# if we don't have a match, we have a new object
|
# if we don't have a match, we have a new object
|
||||||
obj["score_history"] = (
|
obj["score_history"] = (
|
||||||
@ -317,7 +314,7 @@ class NorfairTracker(ObjectTracker):
|
|||||||
tracker.tracked_objects = [
|
tracker.tracked_objects = [
|
||||||
o
|
o
|
||||||
for o in tracker.tracked_objects
|
for o in tracker.tracked_objects
|
||||||
if o.global_id != track_id and o.hit_counter < 0
|
if str(o.global_id) != track_id and o.hit_counter < 0
|
||||||
]
|
]
|
||||||
|
|
||||||
del self.track_id_map[track_id]
|
del self.track_id_map[track_id]
|
||||||
@ -565,12 +562,12 @@ class NorfairTracker(ObjectTracker):
|
|||||||
"estimate": estimate,
|
"estimate": estimate,
|
||||||
"estimate_velocity": t.estimate_velocity,
|
"estimate_velocity": t.estimate_velocity,
|
||||||
}
|
}
|
||||||
active_ids.append(t.global_id)
|
active_ids.append(str(t.global_id))
|
||||||
if t.global_id not in self.track_id_map:
|
if str(t.global_id) not in self.track_id_map:
|
||||||
self.register(t.global_id, new_obj)
|
self.register(str(t.global_id), new_obj)
|
||||||
# if there wasn't a detection in this frame, increment disappeared
|
# if there wasn't a detection in this frame, increment disappeared
|
||||||
elif t.last_detection.data["frame_time"] != frame_time:
|
elif t.last_detection.data["frame_time"] != frame_time:
|
||||||
id = self.track_id_map[t.global_id]
|
id = self.track_id_map[str(t.global_id)]
|
||||||
self.disappeared[id] += 1
|
self.disappeared[id] += 1
|
||||||
# sometimes the estimate gets way off
|
# sometimes the estimate gets way off
|
||||||
# only update if the upper left corner is actually upper left
|
# only update if the upper left corner is actually upper left
|
||||||
@ -578,7 +575,7 @@ class NorfairTracker(ObjectTracker):
|
|||||||
self.tracked_objects[id]["estimate"] = new_obj["estimate"]
|
self.tracked_objects[id]["estimate"] = new_obj["estimate"]
|
||||||
# else update it
|
# else update it
|
||||||
else:
|
else:
|
||||||
self.update(t.global_id, new_obj)
|
self.update(str(t.global_id), new_obj)
|
||||||
|
|
||||||
# clear expired tracks
|
# clear expired tracks
|
||||||
expired_ids = [k for k in self.track_id_map.keys() if k not in active_ids]
|
expired_ids = [k for k in self.track_id_map.keys() if k not in active_ids]
|
||||||
@ -613,7 +610,7 @@ class NorfairTracker(ObjectTracker):
|
|||||||
|
|
||||||
def debug_draw(self, frame: np.ndarray, frame_time: float) -> None:
|
def debug_draw(self, frame: np.ndarray, frame_time: float) -> None:
|
||||||
# Collect all tracked objects from each tracker
|
# Collect all tracked objects from each tracker
|
||||||
all_tracked_objects = []
|
all_tracked_objects: list[TrackedObject] = []
|
||||||
|
|
||||||
# print a table to the console with norfair tracked object info
|
# print a table to the console with norfair tracked object info
|
||||||
if False:
|
if False:
|
||||||
@ -644,9 +641,9 @@ class NorfairTracker(ObjectTracker):
|
|||||||
# draw the estimated bounding box
|
# draw the estimated bounding box
|
||||||
draw_boxes(frame, all_tracked_objects, color="green", draw_ids=True)
|
draw_boxes(frame, all_tracked_objects, color="green", draw_ids=True)
|
||||||
# draw the detections that were detected in the current frame
|
# draw the detections that were detected in the current frame
|
||||||
draw_boxes(frame, active_detections, color="blue", draw_ids=True)
|
draw_boxes(frame, active_detections, color="blue", draw_ids=True) # type: ignore[arg-type]
|
||||||
# draw the detections that are missing in the current frame
|
# draw the detections that are missing in the current frame
|
||||||
draw_boxes(frame, missing_detections, color="red", draw_ids=True)
|
draw_boxes(frame, missing_detections, color="red", draw_ids=True) # type: ignore[arg-type]
|
||||||
|
|
||||||
# draw the distance calculation for the last detection
|
# draw the distance calculation for the last detection
|
||||||
# estimate vs detection
|
# estimate vs detection
|
||||||
@ -654,8 +651,8 @@ class NorfairTracker(ObjectTracker):
|
|||||||
ld = obj.last_detection
|
ld = obj.last_detection
|
||||||
# bottom right
|
# bottom right
|
||||||
text_anchor = (
|
text_anchor = (
|
||||||
ld.points[1, 0],
|
ld.points[1, 0], # type: ignore[index]
|
||||||
ld.points[1, 1],
|
ld.points[1, 1], # type: ignore[index]
|
||||||
)
|
)
|
||||||
frame = Drawer.text(
|
frame = Drawer.text(
|
||||||
frame,
|
frame,
|
||||||
|
@ -284,7 +284,7 @@ def post_process_yolox(
|
|||||||
|
|
||||||
|
|
||||||
def get_ort_providers(
|
def get_ort_providers(
|
||||||
force_cpu: bool = False, device: str = "AUTO", requires_fp16: bool = False
|
force_cpu: bool = False, device: str | None = "AUTO", requires_fp16: bool = False
|
||||||
) -> tuple[list[str], list[dict[str, Any]]]:
|
) -> tuple[list[str], list[dict[str, Any]]]:
|
||||||
if force_cpu:
|
if force_cpu:
|
||||||
return (
|
return (
|
||||||
@ -301,7 +301,7 @@ def get_ort_providers(
|
|||||||
|
|
||||||
for provider in ort.get_available_providers():
|
for provider in ort.get_available_providers():
|
||||||
if provider == "CUDAExecutionProvider":
|
if provider == "CUDAExecutionProvider":
|
||||||
device_id = 0 if not device.isdigit() else int(device)
|
device_id = 0 if (not device or not device.isdigit()) else int(device)
|
||||||
providers.append(provider)
|
providers.append(provider)
|
||||||
options.append(
|
options.append(
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user