mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-24 18:26:51 +03:00
remove deepstack detector and all references to it (#24259)
the 0.18 release notes indicated this was being removed in 0.19
This commit is contained in:
@@ -55,7 +55,6 @@ Dahua
|
|||||||
datasheet
|
datasheet
|
||||||
debconf
|
debconf
|
||||||
deci
|
deci
|
||||||
deepstack
|
|
||||||
defragment
|
defragment
|
||||||
devcontainer
|
devcontainer
|
||||||
DEVICEMAP
|
DEVICEMAP
|
||||||
|
|||||||
@@ -824,24 +824,6 @@ cpu:
|
|||||||
models:
|
models:
|
||||||
- devices:
|
- devices:
|
||||||
- cpu:3
|
- cpu:3
|
||||||
deepstack:
|
|
||||||
title: DeepStack / CodeProject.AI
|
|
||||||
models:
|
|
||||||
- key: yolo
|
|
||||||
label: YOLO
|
|
||||||
recommended: true
|
|
||||||
download: This detector runs object detection over the network against a CodeProject.AI or DeepStack server, so no model is downloaded into Frigate itself. Visit the [CodeProject.AI official website](https://www.codeproject.com/Articles/5322557/CodeProject-AI-Server-AI-the-easy-way) to download and install the AI server on your preferred device (e.g. Raspberry Pi, Nvidia Jetson, or other compatible hardware) before configuring the detector.
|
|
||||||
ui: |-
|
|
||||||
Navigate to **Settings > System > Detection models** and add a model. The CodeProject.AI server is not reported by the hardware probe, so set `devices` to `deepstack:http://<your_codeproject_ai_server_ip>:<port>/v1/vision/detection` in YAML.
|
|
||||||
|
|
||||||
| Field | Value |
|
|
||||||
| ------------- | ---------------------------------------------------------------------- |
|
|
||||||
| **API URL** | `http://<your_codeproject_ai_server_ip>:<port>/v1/vision/detection` |
|
|
||||||
| **API Timeout** | `0.1` (seconds) |
|
|
||||||
yaml: |-
|
|
||||||
models:
|
|
||||||
- devices:
|
|
||||||
- deepstack:http://<your_codeproject_ai_server_ip>:<port>/v1/vision/detection
|
|
||||||
memryx:
|
memryx:
|
||||||
title: MemryX
|
title: MemryX
|
||||||
models:
|
models:
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ Intel NPUs cannot be used under Home Assistant OS, which does not include the NP
|
|||||||
|
|
||||||
:::warning
|
:::warning
|
||||||
|
|
||||||
The network-based detectors (Deepstack and the Apple Silicon client) are being reworked. Their extra options no longer have a place in the config, so only the endpoint carried in the device string is honored right now: Deepstack ignores `api_key` and `api_timeout`, and the Apple Silicon client ignores `request_timeout_ms` and `linger_ms`. Anything else is dropped when your config is migrated.
|
The Apple Silicon detector client is being reworked. Its extra options no longer have a place in the config, so only the endpoint carried in the device string is honored right now, and `request_timeout_ms` and `linger_ms` are ignored. Anything else is dropped when your config is migrated.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@@ -540,30 +540,6 @@ A TensorFlow Lite model is provided in the container at `/cpu_model.tflite` and
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
## Deepstack / CodeProject.AI Server Detector
|
|
||||||
|
|
||||||
:::warning
|
|
||||||
|
|
||||||
The network-based detectors (Deepstack and the Apple Silicon client) are being reworked. Their extra options no longer have a place in the config, so only the endpoint carried in the device string is honored right now: Deepstack ignores `api_key` and `api_timeout`, and the Apple Silicon client ignores `request_timeout_ms` and `linger_ms`. Anything else is dropped when your config is migrated.
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
The Deepstack / CodeProject.AI Server detector for Frigate allows you to integrate Deepstack and CodeProject.AI object detection capabilities into Frigate. CodeProject.AI and DeepStack are open-source AI platforms that can be run on various devices such as the Raspberry Pi, Nvidia Jetson, and other compatible hardware. It is important to note that the integration is performed over the network, so the inference times may not be as fast as native Frigate detectors, but it still provides an efficient and reliable solution for object detection and tracking.
|
|
||||||
|
|
||||||
### Setup {#setup-deepstack}
|
|
||||||
|
|
||||||
To get started with CodeProject.AI, visit their [official website](https://www.codeproject.com/Articles/5322557/CodeProject-AI-Server-AI-the-easy-way) to follow the instructions to download and install the AI server on your preferred device. Detailed setup instructions for CodeProject.AI are outside the scope of the Frigate documentation.
|
|
||||||
|
|
||||||
To integrate CodeProject.AI into Frigate, configure the detector as follows:
|
|
||||||
|
|
||||||
### Configuration {#configuration-deepstack}
|
|
||||||
|
|
||||||
<ModelConfigDropdown detectorTitle="DeepStack" models={objectDetectorsModels.deepstack.models} />
|
|
||||||
|
|
||||||
Replace `<your_codeproject_ai_server_ip>` and `<port>` with the IP address and port of your CodeProject.AI server.
|
|
||||||
|
|
||||||
To verify that the integration is working correctly, start Frigate and observe the logs for any error messages related to CodeProject.AI. Additionally, you can check the Frigate web interface to see if the objects detected by CodeProject.AI are being displayed and tracked properly.
|
|
||||||
|
|
||||||
# Community Supported Detectors
|
# Community Supported Detectors
|
||||||
|
|
||||||
## MemryX MX3
|
## MemryX MX3
|
||||||
|
|||||||
@@ -142,10 +142,6 @@ When [notifications](/configuration/notifications) are enabled and users have re
|
|||||||
|
|
||||||
If an [MQTT broker](/integrations/mqtt) is configured, Frigate maintains a connection to the broker's host and port. This is typically a local network connection, but will require internet if you use a cloud-hosted MQTT broker.
|
If an [MQTT broker](/integrations/mqtt) is configured, Frigate maintains a connection to the broker's host and port. This is typically a local network connection, but will require internet if you use a cloud-hosted MQTT broker.
|
||||||
|
|
||||||
### DeepStack / CodeProject.AI
|
|
||||||
|
|
||||||
When using the [DeepStack detector plugin](/configuration/object_detectors), Frigate sends images to the configured API endpoint for inference. This is typically local but depends on where the service is hosted.
|
|
||||||
|
|
||||||
## WebRTC (STUN)
|
## WebRTC (STUN)
|
||||||
|
|
||||||
For [WebRTC live streaming](/configuration/live), Frigate uses STUN for NAT traversal:
|
For [WebRTC live streaming](/configuration/live), Frigate uses STUN for NAT traversal:
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
import io
|
|
||||||
import logging
|
|
||||||
from typing import Literal
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import requests
|
|
||||||
from PIL import Image
|
|
||||||
from pydantic import ConfigDict, Field
|
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
DETECTOR_KEY = "deepstack"
|
|
||||||
|
|
||||||
|
|
||||||
class DeepstackDetectorConfig(BaseDetectorConfig):
|
|
||||||
"""DeepStack/CodeProject.AI detector that sends images to a remote DeepStack HTTP API for inference. Not recommended."""
|
|
||||||
|
|
||||||
model_config = ConfigDict(
|
|
||||||
title="DeepStack",
|
|
||||||
)
|
|
||||||
|
|
||||||
type: Literal[DETECTOR_KEY]
|
|
||||||
api_url: str = Field(
|
|
||||||
default="http://localhost:80/v1/vision/detection",
|
|
||||||
title="DeepStack API URL",
|
|
||||||
description="The URL of the DeepStack API.",
|
|
||||||
)
|
|
||||||
api_timeout: float = Field(
|
|
||||||
default=0.1,
|
|
||||||
title="DeepStack API timeout (in seconds)",
|
|
||||||
description="Maximum time allowed for a DeepStack API request.",
|
|
||||||
)
|
|
||||||
api_key: str = Field(
|
|
||||||
default="",
|
|
||||||
title="DeepStack API key (if required)",
|
|
||||||
description="Optional API key for authenticated DeepStack services.",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DeepStack(DetectionApi):
|
|
||||||
type_key = DETECTOR_KEY
|
|
||||||
|
|
||||||
def __init__(self, detector_config: DeepstackDetectorConfig):
|
|
||||||
self.api_url = detector_config.api_url
|
|
||||||
self.api_timeout = detector_config.api_timeout
|
|
||||||
self.api_key = detector_config.api_key
|
|
||||||
self.labels = detector_config.model.merged_labelmap
|
|
||||||
self.session = requests.Session()
|
|
||||||
|
|
||||||
def get_label_index(self, label_value):
|
|
||||||
if label_value.lower() == "truck":
|
|
||||||
label_value = "car"
|
|
||||||
for index, value in self.labels.items():
|
|
||||||
if value == label_value.lower():
|
|
||||||
return index
|
|
||||||
return -1
|
|
||||||
|
|
||||||
def detect_raw(self, tensor_input):
|
|
||||||
image_data = np.squeeze(tensor_input).astype(np.uint8)
|
|
||||||
image = Image.fromarray(image_data)
|
|
||||||
self.w, self.h = image.size
|
|
||||||
with io.BytesIO() as output:
|
|
||||||
image.save(output, format="JPEG")
|
|
||||||
image_bytes = output.getvalue()
|
|
||||||
data = {"api_key": self.api_key}
|
|
||||||
|
|
||||||
try:
|
|
||||||
response = self.session.post(
|
|
||||||
self.api_url,
|
|
||||||
data=data,
|
|
||||||
files={"image": image_bytes},
|
|
||||||
timeout=self.api_timeout,
|
|
||||||
)
|
|
||||||
except requests.exceptions.RequestException as ex:
|
|
||||||
logger.error("Error calling deepstack API: %s", ex)
|
|
||||||
return np.zeros((20, 6), np.float32)
|
|
||||||
|
|
||||||
response_json = response.json()
|
|
||||||
detections = np.zeros((20, 6), np.float32)
|
|
||||||
if response_json.get("predictions") is None:
|
|
||||||
logger.debug(f"Error in parsing response json: {response_json}")
|
|
||||||
return detections
|
|
||||||
|
|
||||||
for i, detection in enumerate(response_json.get("predictions")):
|
|
||||||
logger.debug(f"Response: {detection}")
|
|
||||||
if detection["confidence"] < 0.4:
|
|
||||||
logger.debug("Break due to confidence < 0.4")
|
|
||||||
break
|
|
||||||
label = self.get_label_index(detection["label"])
|
|
||||||
if label < 0:
|
|
||||||
logger.debug("Break due to unknown label")
|
|
||||||
break
|
|
||||||
detections[i] = [
|
|
||||||
label,
|
|
||||||
float(detection["confidence"]),
|
|
||||||
detection["y_min"] / self.h,
|
|
||||||
detection["x_min"] / self.w,
|
|
||||||
detection["y_max"] / self.h,
|
|
||||||
detection["x_max"] / self.w,
|
|
||||||
]
|
|
||||||
|
|
||||||
return detections
|
|
||||||
@@ -128,10 +128,10 @@ class TestMigrateModels(unittest.TestCase):
|
|||||||
migrated = migrate_models(
|
migrated = migrate_models(
|
||||||
{
|
{
|
||||||
"detectors": {
|
"detectors": {
|
||||||
"ds": {
|
"remote": {
|
||||||
"type": "deepstack",
|
"type": "zmq",
|
||||||
"api_url": "http://host:5000/v1/vision/detection",
|
"endpoint": "tcp://host:5555",
|
||||||
"api_key": "secret",
|
"request_timeout_ms": 200,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,9 +139,9 @@ class TestMigrateModels(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
migrated["models"][0]["devices"],
|
migrated["models"][0]["devices"],
|
||||||
["deepstack:http://host:5000/v1/vision/detection"],
|
["zmq:tcp://host:5555"],
|
||||||
)
|
)
|
||||||
self.assertTrue(any("api_key" in message for message in logs.output))
|
self.assertTrue(any("request_timeout_ms" in message for message in logs.output))
|
||||||
|
|
||||||
def test_mixed_detector_types_are_logged(self):
|
def test_mixed_detector_types_are_logged(self):
|
||||||
with self.assertLogs("frigate.util.config", level=logging.ERROR) as logs:
|
with self.assertLogs("frigate.util.config", level=logging.ERROR) as logs:
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, "config.yml")
|
|||||||
DETECTOR_DEVICE_FIELDS = {
|
DETECTOR_DEVICE_FIELDS = {
|
||||||
"cpu": "num_threads",
|
"cpu": "num_threads",
|
||||||
"rknn": "num_cores",
|
"rknn": "num_cores",
|
||||||
"deepstack": "api_url",
|
|
||||||
"degirum": "location",
|
"degirum": "location",
|
||||||
"zmq": "endpoint",
|
"zmq": "endpoint",
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,6 @@ DETECTOR_DEVICE_FIELDS = {
|
|||||||
# detectors that use them are being reworked, so they are dropped rather than
|
# detectors that use them are being reworked, so they are dropped rather than
|
||||||
# carried over.
|
# carried over.
|
||||||
DROPPED_DETECTOR_OPTIONS = {
|
DROPPED_DETECTOR_OPTIONS = {
|
||||||
"deepstack": ["api_timeout", "api_key"],
|
|
||||||
"degirum": ["zoo", "token"],
|
"degirum": ["zoo", "token"],
|
||||||
"zmq": ["request_timeout_ms", "linger_ms"],
|
"zmq": ["request_timeout_ms", "linger_ms"],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user