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.*
|
||||
click == 8.1.*
|
||||
# FastAPI
|
||||
aiohttp == 3.11.3
|
||||
starlette == 0.41.2
|
||||
starlette-context == 0.3.6
|
||||
fastapi == 0.115.*
|
||||
uvicorn == 0.30.*
|
||||
aiohttp == 3.12.*
|
||||
starlette == 0.47.*
|
||||
starlette-context == 0.4.*
|
||||
fastapi[standard-no-fastapi-cloud-cli] == 0.116.*
|
||||
uvicorn == 0.35.*
|
||||
slowapi == 0.1.*
|
||||
joserfc == 1.0.*
|
||||
pathvalidate == 3.2.*
|
||||
joserfc == 1.2.*
|
||||
cryptography == 44.0.*
|
||||
pathvalidate == 3.3.*
|
||||
markupsafe == 3.0.*
|
||||
python-multipart == 0.0.12
|
||||
python-multipart == 0.0.20
|
||||
# Classification Model Training
|
||||
tensorflow == 2.19.* ; platform_machine == 'aarch64'
|
||||
tensorflow-cpu == 2.19.* ; platform_machine == 'x86_64'
|
||||
# General
|
||||
mypy == 1.6.1
|
||||
onvif-zeep-async == 3.1.*
|
||||
onvif-zeep-async == 4.0.*
|
||||
paho-mqtt == 2.1.*
|
||||
pandas == 2.2.*
|
||||
peewee == 3.17.*
|
||||
@ -30,7 +31,7 @@ ruamel.yaml == 0.18.*
|
||||
tzlocal == 5.2
|
||||
requests == 2.32.*
|
||||
types-requests == 2.32.*
|
||||
norfair == 2.2.*
|
||||
norfair == 2.3.*
|
||||
setproctitle == 1.3.*
|
||||
ws4py == 0.5.*
|
||||
unidecode == 1.3.*
|
||||
|
@ -5,15 +5,10 @@ from typing import Any, Sequence
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from norfair import (
|
||||
Detection,
|
||||
Drawable,
|
||||
OptimizedKalmanFilterFactory,
|
||||
Tracker,
|
||||
draw_boxes,
|
||||
)
|
||||
from norfair.drawing.drawer import Drawer
|
||||
from norfair.tracker import TrackedObject
|
||||
from norfair.drawing.draw_boxes import draw_boxes
|
||||
from norfair.drawing.drawer import Drawable, Drawer
|
||||
from norfair.filter import OptimizedKalmanFilterFactory
|
||||
from norfair.tracker import Detection, TrackedObject, Tracker
|
||||
from rich import print
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
@ -198,19 +193,21 @@ class NorfairTracker(ObjectTracker):
|
||||
self.default_tracker = {
|
||||
"static": Tracker(
|
||||
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,
|
||||
hit_counter_max=self.detect_config.max_disappeared,
|
||||
filter_factory=self.default_tracker_config["filter_factory"],
|
||||
hit_counter_max=self.detect_config.max_disappeared, # type: ignore[arg-type]
|
||||
filter_factory=self.default_tracker_config["filter_factory"], # type: ignore[arg-type]
|
||||
),
|
||||
"ptz": Tracker(
|
||||
distance_function=frigate_distance,
|
||||
distance_threshold=self.default_ptz_tracker_config[
|
||||
"distance_threshold"
|
||||
],
|
||||
], # type: ignore[arg-type]
|
||||
initialization_delay=self.detect_config.min_initialized,
|
||||
hit_counter_max=self.detect_config.max_disappeared,
|
||||
filter_factory=self.default_ptz_tracker_config["filter_factory"],
|
||||
hit_counter_max=self.detect_config.max_disappeared, # type: ignore[arg-type]
|
||||
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
|
||||
tracker = self.get_tracker(obj["label"])
|
||||
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
|
||||
obj["score_history"] = (
|
||||
@ -317,7 +314,7 @@ class NorfairTracker(ObjectTracker):
|
||||
tracker.tracked_objects = [
|
||||
o
|
||||
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]
|
||||
@ -565,12 +562,12 @@ class NorfairTracker(ObjectTracker):
|
||||
"estimate": estimate,
|
||||
"estimate_velocity": t.estimate_velocity,
|
||||
}
|
||||
active_ids.append(t.global_id)
|
||||
if t.global_id not in self.track_id_map:
|
||||
self.register(t.global_id, new_obj)
|
||||
active_ids.append(str(t.global_id))
|
||||
if str(t.global_id) not in self.track_id_map:
|
||||
self.register(str(t.global_id), new_obj)
|
||||
# if there wasn't a detection in this frame, increment disappeared
|
||||
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
|
||||
# sometimes the estimate gets way off
|
||||
# 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"]
|
||||
# else update it
|
||||
else:
|
||||
self.update(t.global_id, new_obj)
|
||||
self.update(str(t.global_id), new_obj)
|
||||
|
||||
# clear expired tracks
|
||||
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:
|
||||
# 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
|
||||
if False:
|
||||
@ -644,9 +641,9 @@ class NorfairTracker(ObjectTracker):
|
||||
# draw the estimated bounding box
|
||||
draw_boxes(frame, all_tracked_objects, color="green", draw_ids=True)
|
||||
# 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_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
|
||||
# estimate vs detection
|
||||
@ -654,8 +651,8 @@ class NorfairTracker(ObjectTracker):
|
||||
ld = obj.last_detection
|
||||
# bottom right
|
||||
text_anchor = (
|
||||
ld.points[1, 0],
|
||||
ld.points[1, 1],
|
||||
ld.points[1, 0], # type: ignore[index]
|
||||
ld.points[1, 1], # type: ignore[index]
|
||||
)
|
||||
frame = Drawer.text(
|
||||
frame,
|
||||
|
@ -284,7 +284,7 @@ def post_process_yolox(
|
||||
|
||||
|
||||
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]]]:
|
||||
if force_cpu:
|
||||
return (
|
||||
@ -301,7 +301,7 @@ def get_ort_providers(
|
||||
|
||||
for provider in ort.get_available_providers():
|
||||
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)
|
||||
options.append(
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user