mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-05 00:15:51 +01:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
4810a18de2
@ -156,7 +156,9 @@ cameras:
|
|||||||
|
|
||||||
#### Reolink Doorbell
|
#### Reolink Doorbell
|
||||||
|
|
||||||
The reolink doorbell supports 2-way audio via go2rtc and other applications. It is important that the http-flv stream is still used for stability, a secondary rtsp stream can be added that will be using for the two way audio only.
|
The reolink doorbell supports two way audio via go2rtc and other applications. It is important that the http-flv stream is still used for stability, a secondary rtsp stream can be added that will be using for the two way audio only.
|
||||||
|
|
||||||
|
Ensure HTTP is enabled in the camera's advanced network settings. To use two way talk with Frigate, see the [Live view documentation](/configuration/live#two-way-talk).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
go2rtc:
|
go2rtc:
|
||||||
|
@ -203,14 +203,13 @@ detectors:
|
|||||||
ov:
|
ov:
|
||||||
type: openvino
|
type: openvino
|
||||||
device: AUTO
|
device: AUTO
|
||||||
model:
|
|
||||||
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
|
||||||
|
|
||||||
model:
|
model:
|
||||||
width: 300
|
width: 300
|
||||||
height: 300
|
height: 300
|
||||||
input_tensor: nhwc
|
input_tensor: nhwc
|
||||||
input_pixel_format: bgr
|
input_pixel_format: bgr
|
||||||
|
path: /openvino-model/ssdlite_mobilenet_v2.xml
|
||||||
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
|
||||||
|
|
||||||
record:
|
record:
|
||||||
|
@ -29,7 +29,7 @@ The default video and audio codec on your camera may not always be compatible wi
|
|||||||
|
|
||||||
### Audio Support
|
### Audio Support
|
||||||
|
|
||||||
MSE Requires AAC audio, WebRTC requires PCMU/PCMA, or opus audio. If you want to support both MSE and WebRTC then your restream config needs to make sure both are enabled.
|
MSE Requires PCMA/PCMU or AAC audio, WebRTC requires PCMA/PCMU or opus audio. If you want to support both MSE and WebRTC then your restream config needs to make sure both are enabled.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
go2rtc:
|
go2rtc:
|
||||||
@ -138,3 +138,13 @@ services:
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.3#module-webrtc) for more information about this.
|
See [go2rtc WebRTC docs](https://github.com/AlexxIT/go2rtc/tree/v1.8.3#module-webrtc) for more information about this.
|
||||||
|
|
||||||
|
### Two way talk
|
||||||
|
|
||||||
|
For devices that support two way talk, Frigate can be configured to use the feature from the camera's Live view in the Web UI. You should:
|
||||||
|
|
||||||
|
- Set up go2rtc with [WebRTC](#webrtc-extra-configuration).
|
||||||
|
- Ensure you access Frigate via https (may require [opening port 8971](/frigate/installation/#ports)).
|
||||||
|
- For the Home Assistant Frigate card, [follow the docs](https://github.com/dermotduffy/frigate-hass-card?tab=readme-ov-file#using-2-way-audio) for the correct source.
|
||||||
|
|
||||||
|
To use the Reolink Doorbell with two way talk, you should use the [recommended Reolink configuration](/configuration/camera_specific#reolink-doorbell)
|
||||||
|
@ -506,11 +506,12 @@ detectors:
|
|||||||
cpu1:
|
cpu1:
|
||||||
type: cpu
|
type: cpu
|
||||||
num_threads: 3
|
num_threads: 3
|
||||||
model:
|
|
||||||
path: "/custom_model.tflite"
|
|
||||||
cpu2:
|
cpu2:
|
||||||
type: cpu
|
type: cpu
|
||||||
num_threads: 3
|
num_threads: 3
|
||||||
|
|
||||||
|
model:
|
||||||
|
path: "/custom_model.tflite"
|
||||||
```
|
```
|
||||||
|
|
||||||
When using CPU detectors, you can add one CPU detector per camera. Adding more detectors than the number of cameras should not improve performance.
|
When using CPU detectors, you can add one CPU detector per camera. Adding more detectors than the number of cameras should not improve performance.
|
||||||
@ -637,8 +638,6 @@ detectors:
|
|||||||
hailo8l:
|
hailo8l:
|
||||||
type: hailo8l
|
type: hailo8l
|
||||||
device: PCIe
|
device: PCIe
|
||||||
model:
|
|
||||||
path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
|
||||||
|
|
||||||
model:
|
model:
|
||||||
width: 300
|
width: 300
|
||||||
@ -646,4 +645,5 @@ model:
|
|||||||
input_tensor: nhwc
|
input_tensor: nhwc
|
||||||
input_pixel_format: bgr
|
input_pixel_format: bgr
|
||||||
model_type: ssd
|
model_type: ssd
|
||||||
|
path: /config/model_cache/h8l_cache/ssd_mobilenet_v1.hef
|
||||||
```
|
```
|
||||||
|
@ -52,7 +52,7 @@ detectors:
|
|||||||
# Required: name of the detector
|
# Required: name of the detector
|
||||||
detector_name:
|
detector_name:
|
||||||
# Required: type of the detector
|
# Required: type of the detector
|
||||||
# Frigate provided types include 'cpu', 'edgetpu', 'openvino' and 'tensorrt' (default: shown below)
|
# Frigate provides many types, see https://docs.frigate.video/configuration/object_detectors for more details (default: shown below)
|
||||||
# Additional detector types can also be plugged in.
|
# Additional detector types can also be plugged in.
|
||||||
# Detectors may require additional configuration.
|
# Detectors may require additional configuration.
|
||||||
# Refer to the Detectors configuration page for more information.
|
# Refer to the Detectors configuration page for more information.
|
||||||
|
@ -305,8 +305,15 @@ To install make sure you have the [community app plugin here](https://forums.unr
|
|||||||
|
|
||||||
## Proxmox
|
## Proxmox
|
||||||
|
|
||||||
It is recommended to run Frigate in LXC, rather than in a VM, for maximum performance. The setup can be complex so be prepared to read the Proxmox and LXC documentation. Suggestions include:
|
[According to Proxmox documentation](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#chapter_pct) it is recommended that you run application containers like Frigate inside a Proxmox QEMU VM. This will give you all the advantages of application containerization, while also providing the benefits that VMs offer, such as strong isolation from the host and the ability to live-migrate, which otherwise isn’t possible with containers.
|
||||||
|
|
||||||
|
:::warning
|
||||||
|
|
||||||
|
If you choose to run Frigate via LXC in Proxmox the setup can be complex so be prepared to read the Proxmox and LXC documentation, Frigate does not officially support running inside of an LXC.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
Suggestions include:
|
||||||
- For Intel-based hardware acceleration, to allow access to the `/dev/dri/renderD128` device with major number 226 and minor number 128, add the following lines to the `/etc/pve/lxc/<id>.conf` LXC configuration:
|
- For Intel-based hardware acceleration, to allow access to the `/dev/dri/renderD128` device with major number 226 and minor number 128, add the following lines to the `/etc/pve/lxc/<id>.conf` LXC configuration:
|
||||||
- `lxc.cgroup2.devices.allow: c 226:128 rwm`
|
- `lxc.cgroup2.devices.allow: c 226:128 rwm`
|
||||||
- `lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file`
|
- `lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file`
|
||||||
|
@ -3,7 +3,15 @@ id: recordings
|
|||||||
title: Troubleshooting Recordings
|
title: Troubleshooting Recordings
|
||||||
---
|
---
|
||||||
|
|
||||||
### WARNING : Unable to keep up with recording segments in cache for camera. Keeping the 5 most recent segments out of 6 and discarding the rest...
|
## I have Frigate configured for motion recording only, but it still seems to be recording even with no motion. Why?
|
||||||
|
|
||||||
|
You'll want to:
|
||||||
|
|
||||||
|
- Make sure your camera's timestamp is masked out with a motion mask. Even if there is no motion occurring in your scene, your motion settings may be sensitive enough to count your timestamp as motion.
|
||||||
|
- If you have audio detection enabled, keep in mind that audio that is heard above `min_volume` is considered motion.
|
||||||
|
- [Tune your motion detection settings](/configuration/motion_detection) either by editing your config file or by using the UI's Motion Tuner.
|
||||||
|
|
||||||
|
## I see the message: WARNING : Unable to keep up with recording segments in cache for camera. Keeping the 5 most recent segments out of 6 and discarding the rest...
|
||||||
|
|
||||||
This error can be caused by a number of different issues. The first step in troubleshooting is to enable debug logging for recording. This will enable logging showing how long it takes for recordings to be moved from RAM cache to the disk.
|
This error can be caused by a number of different issues. The first step in troubleshooting is to enable debug logging for recording. This will enable logging showing how long it takes for recordings to be moved from RAM cache to the disk.
|
||||||
|
|
||||||
@ -40,6 +48,7 @@ On linux, some helpful tools/commands in diagnosing would be:
|
|||||||
On modern linux kernels, the system will utilize some swap if enabled. Setting vm.swappiness=1 no longer means that the kernel will only swap in order to avoid OOM. To prevent any swapping inside a container, set allocations memory and memory+swap to be the same and disable swapping by setting the following docker/podman run parameters:
|
On modern linux kernels, the system will utilize some swap if enabled. Setting vm.swappiness=1 no longer means that the kernel will only swap in order to avoid OOM. To prevent any swapping inside a container, set allocations memory and memory+swap to be the same and disable swapping by setting the following docker/podman run parameters:
|
||||||
|
|
||||||
**Compose example**
|
**Compose example**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3.9"
|
version: "3.9"
|
||||||
services:
|
services:
|
||||||
@ -54,6 +63,7 @@ services:
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Run command example**
|
**Run command example**
|
||||||
|
|
||||||
```
|
```
|
||||||
--memory=<MAXRAM> --memory-swap=<MAXSWAP> --memory-swappiness=0
|
--memory=<MAXRAM> --memory-swap=<MAXSWAP> --memory-swappiness=0
|
||||||
```
|
```
|
||||||
|
@ -151,7 +151,7 @@ class WebPushClient(Communicator): # type: ignore[misc]
|
|||||||
camera: str = payload["after"]["camera"]
|
camera: str = payload["after"]["camera"]
|
||||||
title = f"{', '.join(sorted_objects).replace('_', ' ').title()}{' was' if state == 'end' else ''} detected in {', '.join(payload['after']['data']['zones']).replace('_', ' ').title()}"
|
title = f"{', '.join(sorted_objects).replace('_', ' ').title()}{' was' if state == 'end' else ''} detected in {', '.join(payload['after']['data']['zones']).replace('_', ' ').title()}"
|
||||||
message = f"Detected on {camera.replace('_', ' ').title()}"
|
message = f"Detected on {camera.replace('_', ' ').title()}"
|
||||||
image = f'{payload["after"]["thumb_path"].replace("/media/frigate", "")}'
|
image = f"{payload['after']['thumb_path'].replace('/media/frigate', '')}"
|
||||||
|
|
||||||
# if event is ongoing open to live view otherwise open to recordings view
|
# if event is ongoing open to live view otherwise open to recordings view
|
||||||
direct_url = f"/review?id={reviewId}" if state == "end" else f"/#{camera}"
|
direct_url = f"/review?id={reviewId}" if state == "end" else f"/#{camera}"
|
||||||
|
@ -85,7 +85,7 @@ class ZoneConfig(BaseModel):
|
|||||||
if explicit:
|
if explicit:
|
||||||
self.coordinates = ",".join(
|
self.coordinates = ",".join(
|
||||||
[
|
[
|
||||||
f'{round(int(p.split(",")[0]) / frame_shape[1], 3)},{round(int(p.split(",")[1]) / frame_shape[0], 3)}'
|
f"{round(int(p.split(',')[0]) / frame_shape[1], 3)},{round(int(p.split(',')[1]) / frame_shape[0], 3)}"
|
||||||
for p in coordinates
|
for p in coordinates
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -594,35 +594,27 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
if isinstance(detector, dict)
|
if isinstance(detector, dict)
|
||||||
else detector.model_dump(warnings="none")
|
else detector.model_dump(warnings="none")
|
||||||
)
|
)
|
||||||
detector_config: DetectorConfig = adapter.validate_python(model_dict)
|
detector_config: BaseDetectorConfig = adapter.validate_python(model_dict)
|
||||||
if detector_config.model is None:
|
|
||||||
detector_config.model = self.model.model_copy()
|
|
||||||
else:
|
|
||||||
path = detector_config.model.path
|
|
||||||
detector_config.model = self.model.model_copy()
|
|
||||||
detector_config.model.path = path
|
|
||||||
|
|
||||||
if "path" not in model_dict or len(model_dict.keys()) > 1:
|
# users should not set model themselves
|
||||||
logger.warning(
|
if detector_config.model:
|
||||||
"Customizing more than a detector model path is unsupported."
|
detector_config.model = None
|
||||||
)
|
|
||||||
|
|
||||||
merged_model = deep_merge(
|
model_config = self.model.model_dump(exclude_unset=True, warnings="none")
|
||||||
detector_config.model.model_dump(exclude_unset=True, warnings="none"),
|
|
||||||
self.model.model_dump(exclude_unset=True, warnings="none"),
|
|
||||||
)
|
|
||||||
|
|
||||||
if "path" not in merged_model:
|
if detector_config.model_path:
|
||||||
|
model_config["path"] = detector_config.model_path
|
||||||
|
|
||||||
|
if "path" not in model_config:
|
||||||
if detector_config.type == "cpu":
|
if detector_config.type == "cpu":
|
||||||
merged_model["path"] = "/cpu_model.tflite"
|
model_config["path"] = "/cpu_model.tflite"
|
||||||
elif detector_config.type == "edgetpu":
|
elif detector_config.type == "edgetpu":
|
||||||
merged_model["path"] = "/edgetpu_model.tflite"
|
model_config["path"] = "/edgetpu_model.tflite"
|
||||||
|
|
||||||
detector_config.model = ModelConfig.model_validate(merged_model)
|
model = ModelConfig.model_validate(model_config)
|
||||||
detector_config.model.check_and_load_plus_model(
|
model.check_and_load_plus_model(self.plus_api, detector_config.type)
|
||||||
self.plus_api, detector_config.type
|
model.compute_model_hash()
|
||||||
)
|
detector_config.model = model
|
||||||
detector_config.model.compute_model_hash()
|
|
||||||
self.detectors[key] = detector_config
|
self.detectors[key] = detector_config
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
@ -194,6 +194,9 @@ class BaseDetectorConfig(BaseModel):
|
|||||||
model: Optional[ModelConfig] = Field(
|
model: Optional[ModelConfig] = Field(
|
||||||
default=None, title="Detector specific model configuration."
|
default=None, title="Detector specific model configuration."
|
||||||
)
|
)
|
||||||
|
model_path: Optional[str] = Field(
|
||||||
|
default=None, title="Detector specific model path."
|
||||||
|
)
|
||||||
model_config = ConfigDict(
|
model_config = ConfigDict(
|
||||||
extra="allow", arbitrary_types_allowed=True, protected_namespaces=()
|
extra="allow", arbitrary_types_allowed=True, protected_namespaces=()
|
||||||
)
|
)
|
||||||
|
@ -219,19 +219,19 @@ class TensorRtDetector(DetectionApi):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, detector_config: TensorRTDetectorConfig):
|
def __init__(self, detector_config: TensorRTDetectorConfig):
|
||||||
assert (
|
assert TRT_SUPPORT, (
|
||||||
TRT_SUPPORT
|
f"TensorRT libraries not found, {DETECTOR_KEY} detector not present"
|
||||||
), f"TensorRT libraries not found, {DETECTOR_KEY} detector not present"
|
)
|
||||||
|
|
||||||
(cuda_err,) = cuda.cuInit(0)
|
(cuda_err,) = cuda.cuInit(0)
|
||||||
assert (
|
assert cuda_err == cuda.CUresult.CUDA_SUCCESS, (
|
||||||
cuda_err == cuda.CUresult.CUDA_SUCCESS
|
f"Failed to initialize cuda {cuda_err}"
|
||||||
), f"Failed to initialize cuda {cuda_err}"
|
)
|
||||||
err, dev_count = cuda.cuDeviceGetCount()
|
err, dev_count = cuda.cuDeviceGetCount()
|
||||||
logger.debug(f"Num Available Devices: {dev_count}")
|
logger.debug(f"Num Available Devices: {dev_count}")
|
||||||
assert (
|
assert detector_config.device < dev_count, (
|
||||||
detector_config.device < dev_count
|
f"Invalid TensorRT Device Config. Device {detector_config.device} Invalid."
|
||||||
), f"Invalid TensorRT Device Config. Device {detector_config.device} Invalid."
|
)
|
||||||
err, self.cu_ctx = cuda.cuCtxCreate(
|
err, self.cu_ctx = cuda.cuCtxCreate(
|
||||||
cuda.CUctx_flags.CU_CTX_MAP_HOST, detector_config.device
|
cuda.CUctx_flags.CU_CTX_MAP_HOST, detector_config.device
|
||||||
)
|
)
|
||||||
|
@ -71,8 +71,8 @@ PRESETS_HW_ACCEL_DECODE = {
|
|||||||
"preset-rpi-64-h264": "-c:v:1 h264_v4l2m2m",
|
"preset-rpi-64-h264": "-c:v:1 h264_v4l2m2m",
|
||||||
"preset-rpi-64-h265": "-c:v:1 hevc_v4l2m2m",
|
"preset-rpi-64-h265": "-c:v:1 hevc_v4l2m2m",
|
||||||
FFMPEG_HWACCEL_VAAPI: f"-hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format vaapi",
|
FFMPEG_HWACCEL_VAAPI: f"-hwaccel_flags allow_profile_mismatch -hwaccel vaapi -hwaccel_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format vaapi",
|
||||||
"preset-intel-qsv-h264": f"-hwaccel qsv -qsv_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format qsv -c:v h264_qsv",
|
"preset-intel-qsv-h264": f"-hwaccel qsv -qsv_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format qsv -c:v h264_qsv -bsf:v dump_extra", # https://trac.ffmpeg.org/ticket/9766#comment:17
|
||||||
"preset-intel-qsv-h265": f"-load_plugin hevc_hw -hwaccel qsv -qsv_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format qsv -c:v hevc_qsv",
|
"preset-intel-qsv-h265": f"-load_plugin hevc_hw -hwaccel qsv -qsv_device {_gpu_selector.get_selected_gpu()} -hwaccel_output_format qsv -c:v hevc_qsv -bsf:v dump_extra", # https://trac.ffmpeg.org/ticket/9766#comment:17
|
||||||
FFMPEG_HWACCEL_NVIDIA: "-hwaccel cuda -hwaccel_output_format cuda",
|
FFMPEG_HWACCEL_NVIDIA: "-hwaccel cuda -hwaccel_output_format cuda",
|
||||||
"preset-jetson-h264": "-c:v h264_nvmpi -resize {1}x{2}",
|
"preset-jetson-h264": "-c:v h264_nvmpi -resize {1}x{2}",
|
||||||
"preset-jetson-h265": "-c:v hevc_nvmpi -resize {1}x{2}",
|
"preset-jetson-h265": "-c:v hevc_nvmpi -resize {1}x{2}",
|
||||||
|
@ -68,11 +68,13 @@ class PlusApi:
|
|||||||
or self._token_data["expires"] - datetime.datetime.now().timestamp() < 60
|
or self._token_data["expires"] - datetime.datetime.now().timestamp() < 60
|
||||||
):
|
):
|
||||||
if self.key is None:
|
if self.key is None:
|
||||||
raise Exception("Plus API not activated")
|
raise Exception(
|
||||||
|
"Plus API key not set. See https://docs.frigate.video/integrations/plus#set-your-api-key"
|
||||||
|
)
|
||||||
parts = self.key.split(":")
|
parts = self.key.split(":")
|
||||||
r = requests.get(f"{self.host}/v1/auth/token", auth=(parts[0], parts[1]))
|
r = requests.get(f"{self.host}/v1/auth/token", auth=(parts[0], parts[1]))
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
raise Exception("Unable to refresh API token")
|
raise Exception(f"Unable to refresh API token: {r.text}")
|
||||||
self._token_data = r.json()
|
self._token_data = r.json()
|
||||||
|
|
||||||
def _get_authorization_header(self) -> dict:
|
def _get_authorization_header(self) -> dict:
|
||||||
@ -116,15 +118,6 @@ class PlusApi:
|
|||||||
logger.error(f"Failed to upload original: {r.status_code} {r.text}")
|
logger.error(f"Failed to upload original: {r.status_code} {r.text}")
|
||||||
raise Exception(r.text)
|
raise Exception(r.text)
|
||||||
|
|
||||||
# resize and submit annotate
|
|
||||||
files = {"file": get_jpg_bytes(image, 640, 70)}
|
|
||||||
data = presigned_urls["annotate"]["fields"]
|
|
||||||
data["content-type"] = "image/jpeg"
|
|
||||||
r = requests.post(presigned_urls["annotate"]["url"], files=files, data=data)
|
|
||||||
if not r.ok:
|
|
||||||
logger.error(f"Failed to upload annotate: {r.status_code} {r.text}")
|
|
||||||
raise Exception(r.text)
|
|
||||||
|
|
||||||
# resize and submit thumbnail
|
# resize and submit thumbnail
|
||||||
files = {"file": get_jpg_bytes(image, 200, 70)}
|
files = {"file": get_jpg_bytes(image, 200, 70)}
|
||||||
data = presigned_urls["thumbnail"]["fields"]
|
data = presigned_urls["thumbnail"]["fields"]
|
||||||
|
@ -983,10 +983,10 @@ class PtzAutoTracker:
|
|||||||
logger.debug(f"{camera}: Zoom test: at max zoom: {at_max_zoom}")
|
logger.debug(f"{camera}: Zoom test: at max zoom: {at_max_zoom}")
|
||||||
logger.debug(f"{camera}: Zoom test: at min zoom: {at_min_zoom}")
|
logger.debug(f"{camera}: Zoom test: at min zoom: {at_min_zoom}")
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f'{camera}: Zoom test: zoom in hysteresis limit: {zoom_in_hysteresis} value: {AUTOTRACKING_ZOOM_IN_HYSTERESIS} original: {self.tracked_object_metrics[camera]["original_target_box"]} max: {self.tracked_object_metrics[camera]["max_target_box"]} target: {calculated_target_box if calculated_target_box else self.tracked_object_metrics[camera]["target_box"]}'
|
f"{camera}: Zoom test: zoom in hysteresis limit: {zoom_in_hysteresis} value: {AUTOTRACKING_ZOOM_IN_HYSTERESIS} original: {self.tracked_object_metrics[camera]['original_target_box']} max: {self.tracked_object_metrics[camera]['max_target_box']} target: {calculated_target_box if calculated_target_box else self.tracked_object_metrics[camera]['target_box']}"
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f'{camera}: Zoom test: zoom out hysteresis limit: {zoom_out_hysteresis} value: {AUTOTRACKING_ZOOM_OUT_HYSTERESIS} original: {self.tracked_object_metrics[camera]["original_target_box"]} max: {self.tracked_object_metrics[camera]["max_target_box"]} target: {calculated_target_box if calculated_target_box else self.tracked_object_metrics[camera]["target_box"]}'
|
f"{camera}: Zoom test: zoom out hysteresis limit: {zoom_out_hysteresis} value: {AUTOTRACKING_ZOOM_OUT_HYSTERESIS} original: {self.tracked_object_metrics[camera]['original_target_box']} max: {self.tracked_object_metrics[camera]['max_target_box']} target: {calculated_target_box if calculated_target_box else self.tracked_object_metrics[camera]['target_box']}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Zoom in conditions (and)
|
# Zoom in conditions (and)
|
||||||
@ -1069,7 +1069,7 @@ class PtzAutoTracker:
|
|||||||
pan = ((centroid_x / camera_width) - 0.5) * 2
|
pan = ((centroid_x / camera_width) - 0.5) * 2
|
||||||
tilt = (0.5 - (centroid_y / camera_height)) * 2
|
tilt = (0.5 - (centroid_y / camera_height)) * 2
|
||||||
|
|
||||||
logger.debug(f'{camera}: Original box: {obj.obj_data["box"]}')
|
logger.debug(f"{camera}: Original box: {obj.obj_data['box']}")
|
||||||
logger.debug(f"{camera}: Predicted box: {tuple(predicted_box)}")
|
logger.debug(f"{camera}: Predicted box: {tuple(predicted_box)}")
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"{camera}: Velocity: {tuple(np.round(average_velocity).flatten().astype(int))}"
|
f"{camera}: Velocity: {tuple(np.round(average_velocity).flatten().astype(int))}"
|
||||||
@ -1179,7 +1179,7 @@ class PtzAutoTracker:
|
|||||||
)
|
)
|
||||||
zoom = (ratio - 1) / (ratio + 1)
|
zoom = (ratio - 1) / (ratio + 1)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f'{camera}: limit: {self.tracked_object_metrics[camera]["max_target_box"]}, ratio: {ratio} zoom calculation: {zoom}'
|
f"{camera}: limit: {self.tracked_object_metrics[camera]['max_target_box']}, ratio: {ratio} zoom calculation: {zoom}"
|
||||||
)
|
)
|
||||||
if not result:
|
if not result:
|
||||||
# zoom out with special condition if zooming out because of velocity, edges, etc.
|
# zoom out with special condition if zooming out because of velocity, edges, etc.
|
||||||
|
@ -256,7 +256,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||||
segment.detections[object["id"]] = object["sub_label"][0]
|
segment.detections[object["id"]] = object["sub_label"][0]
|
||||||
else:
|
else:
|
||||||
segment.detections[object["id"]] = f'{object["label"]}-verified'
|
segment.detections[object["id"]] = f"{object['label']}-verified"
|
||||||
segment.sub_labels[object["id"]] = object["sub_label"][0]
|
segment.sub_labels[object["id"]] = object["sub_label"][0]
|
||||||
|
|
||||||
# if object is alert label
|
# if object is alert label
|
||||||
@ -352,7 +352,7 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
elif object["sub_label"][0] in self.config.model.all_attributes:
|
elif object["sub_label"][0] in self.config.model.all_attributes:
|
||||||
detections[object["id"]] = object["sub_label"][0]
|
detections[object["id"]] = object["sub_label"][0]
|
||||||
else:
|
else:
|
||||||
detections[object["id"]] = f'{object["label"]}-verified'
|
detections[object["id"]] = f"{object['label']}-verified"
|
||||||
sub_labels[object["id"]] = object["sub_label"][0]
|
sub_labels[object["id"]] = object["sub_label"][0]
|
||||||
|
|
||||||
# if object is alert label
|
# if object is alert label
|
||||||
@ -527,6 +527,8 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
|
|
||||||
if event_id in self.indefinite_events[camera]:
|
if event_id in self.indefinite_events[camera]:
|
||||||
self.indefinite_events[camera].pop(event_id)
|
self.indefinite_events[camera].pop(event_id)
|
||||||
|
|
||||||
|
if len(self.indefinite_events[camera]) == 0:
|
||||||
current_segment.last_update = manual_info["end_time"]
|
current_segment.last_update = manual_info["end_time"]
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
@ -72,8 +72,7 @@ class BaseServiceProcess(Service, ABC):
|
|||||||
running = False
|
running = False
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
self.manager.logger.warning(
|
self.manager.logger.warning(
|
||||||
f"{self.name} is still running after "
|
f"{self.name} is still running after {timeout} seconds. Killing."
|
||||||
f"{timeout} seconds. Killing."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if running:
|
if running:
|
||||||
|
@ -75,11 +75,11 @@ class TestConfig(unittest.TestCase):
|
|||||||
"detectors": {
|
"detectors": {
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"type": "cpu",
|
"type": "cpu",
|
||||||
"model": {"path": "/cpu_model.tflite"},
|
"model_path": "/cpu_model.tflite",
|
||||||
},
|
},
|
||||||
"edgetpu": {
|
"edgetpu": {
|
||||||
"type": "edgetpu",
|
"type": "edgetpu",
|
||||||
"model": {"path": "/edgetpu_model.tflite"},
|
"model_path": "/edgetpu_model.tflite",
|
||||||
},
|
},
|
||||||
"openvino": {
|
"openvino": {
|
||||||
"type": "openvino",
|
"type": "openvino",
|
||||||
|
@ -13,7 +13,7 @@ from frigate.util.services import get_video_properties
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
CURRENT_CONFIG_VERSION = "0.15-0"
|
CURRENT_CONFIG_VERSION = "0.15-1"
|
||||||
DEFAULT_CONFIG_FILE = "/config/config.yml"
|
DEFAULT_CONFIG_FILE = "/config/config.yml"
|
||||||
|
|
||||||
|
|
||||||
@ -77,6 +77,13 @@ def migrate_frigate_config(config_file: str):
|
|||||||
yaml.dump(new_config, f)
|
yaml.dump(new_config, f)
|
||||||
previous_version = "0.15-0"
|
previous_version = "0.15-0"
|
||||||
|
|
||||||
|
if previous_version < "0.15-1":
|
||||||
|
logger.info(f"Migrating frigate config from {previous_version} to 0.15-1...")
|
||||||
|
new_config = migrate_015_1(config)
|
||||||
|
with open(config_file, "w") as f:
|
||||||
|
yaml.dump(new_config, f)
|
||||||
|
previous_version = "0.15-1"
|
||||||
|
|
||||||
logger.info("Finished frigate config migration...")
|
logger.info("Finished frigate config migration...")
|
||||||
|
|
||||||
|
|
||||||
@ -267,6 +274,21 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
|
|||||||
return new_config
|
return new_config
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_015_1(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]:
|
||||||
|
"""Handle migrating frigate config to 0.15-1"""
|
||||||
|
new_config = config.copy()
|
||||||
|
|
||||||
|
for detector, detector_config in config.get("detectors", {}).items():
|
||||||
|
path = detector_config.get("model", {}).get("path")
|
||||||
|
|
||||||
|
if path:
|
||||||
|
new_config["detectors"][detector]["model_path"] = path
|
||||||
|
del new_config["detectors"][detector]["model"]
|
||||||
|
|
||||||
|
new_config["version"] = "0.15-1"
|
||||||
|
return new_config
|
||||||
|
|
||||||
|
|
||||||
def get_relative_coordinates(
|
def get_relative_coordinates(
|
||||||
mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
|
mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
|
||||||
) -> Union[str, list]:
|
) -> Union[str, list]:
|
||||||
|
@ -390,12 +390,22 @@ def try_get_info(f, h, default="N/A"):
|
|||||||
|
|
||||||
|
|
||||||
def get_nvidia_gpu_stats() -> dict[int, dict]:
|
def get_nvidia_gpu_stats() -> dict[int, dict]:
|
||||||
|
names: dict[str, int] = {}
|
||||||
results = {}
|
results = {}
|
||||||
try:
|
try:
|
||||||
nvml.nvmlInit()
|
nvml.nvmlInit()
|
||||||
deviceCount = nvml.nvmlDeviceGetCount()
|
deviceCount = nvml.nvmlDeviceGetCount()
|
||||||
for i in range(deviceCount):
|
for i in range(deviceCount):
|
||||||
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
handle = nvml.nvmlDeviceGetHandleByIndex(i)
|
||||||
|
gpu_name = nvml.nvmlDeviceGetName(handle)
|
||||||
|
|
||||||
|
# handle case where user has multiple of same GPU
|
||||||
|
if gpu_name in names:
|
||||||
|
names[gpu_name] += 1
|
||||||
|
gpu_name += f" ({names.get(gpu_name)})"
|
||||||
|
else:
|
||||||
|
names[gpu_name] = 1
|
||||||
|
|
||||||
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
|
||||||
util = try_get_info(nvml.nvmlDeviceGetUtilizationRates, handle)
|
util = try_get_info(nvml.nvmlDeviceGetUtilizationRates, handle)
|
||||||
enc = try_get_info(nvml.nvmlDeviceGetEncoderUtilization, handle)
|
enc = try_get_info(nvml.nvmlDeviceGetEncoderUtilization, handle)
|
||||||
@ -423,7 +433,7 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
|
|||||||
dec_util = -1
|
dec_util = -1
|
||||||
|
|
||||||
results[i] = {
|
results[i] = {
|
||||||
"name": nvml.nvmlDeviceGetName(handle),
|
"name": gpu_name,
|
||||||
"gpu": gpu_util,
|
"gpu": gpu_util,
|
||||||
"mem": gpu_mem_util,
|
"mem": gpu_mem_util,
|
||||||
"enc": enc_util,
|
"enc": enc_util,
|
||||||
|
Loading…
Reference in New Issue
Block a user