mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-08 14:35:26 +03:00
Compare commits
23 Commits
c73fb3caf0
...
8bf18e84ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bf18e84ae | ||
|
|
3db479e6ce | ||
|
|
76555ec694 | ||
|
|
46d395f869 | ||
|
|
d0dc7c3580 | ||
|
|
9a898bf130 | ||
|
|
0d96942555 | ||
|
|
a779b86b29 | ||
|
|
b7bb7d5a1b | ||
|
|
750aa34e92 | ||
|
|
68cbf0fb14 | ||
|
|
7ca04fed8c | ||
|
|
8c4b95383b | ||
|
|
6e8d6acfa7 | ||
|
|
d9c3ecf8d1 | ||
|
|
eccca00f69 | ||
|
|
7395903aea | ||
|
|
c8c5a70881 | ||
|
|
5afaa079a7 | ||
|
|
2fcc801588 | ||
|
|
1a6d04fde7 | ||
|
|
4a1b7a1629 | ||
|
|
8eace9c3e7 |
@ -24,8 +24,12 @@ from frigate.log import redirect_output_to_logger, suppress_stderr_during
|
||||
from frigate.models import Event, Recordings, ReviewSegment
|
||||
from frigate.types import ModelStatusTypesEnum
|
||||
from frigate.util.downloader import ModelDownloader
|
||||
from frigate.util.file import get_event_thumbnail_bytes
|
||||
from frigate.util.image import get_image_from_recording
|
||||
from frigate.util.file import get_event_thumbnail_bytes, load_event_snapshot_image
|
||||
from frigate.util.image import (
|
||||
calculate_region,
|
||||
get_image_from_recording,
|
||||
relative_box_to_absolute,
|
||||
)
|
||||
from frigate.util.process import FrigateProcess
|
||||
|
||||
BATCH_SIZE = 16
|
||||
@ -713,7 +717,7 @@ def collect_object_classification_examples(
|
||||
This function:
|
||||
1. Queries events for the specified label
|
||||
2. Selects 100 balanced events across different cameras and times
|
||||
3. Retrieves thumbnails for selected events (with 33% center crop applied)
|
||||
3. Crops each event's clean snapshot around the object bounding box
|
||||
4. Selects 24 most visually distinct thumbnails
|
||||
5. Saves to dataset directory
|
||||
|
||||
@ -832,66 +836,106 @@ def _select_balanced_events(
|
||||
|
||||
def _extract_event_thumbnails(events: list[Event], output_dir: str) -> list[str]:
|
||||
"""
|
||||
Extract thumbnails from events and save to disk.
|
||||
Extract a training image for each event.
|
||||
|
||||
Preferred path: load the full-frame clean snapshot and crop around the
|
||||
stored bounding box with the same calculate_region(..., max(w, h), 1.0)
|
||||
call the live ObjectClassificationProcessor uses, so wizard examples
|
||||
are framed like inference-time inputs.
|
||||
|
||||
Fallback: if no clean snapshot exists (snapshots disabled, or only a
|
||||
legacy annotated JPG is on disk), center-crop the stored thumbnail
|
||||
using a step ladder sized from the box/region area ratio.
|
||||
|
||||
Args:
|
||||
events: List of Event objects
|
||||
output_dir: Directory to save thumbnails
|
||||
output_dir: Directory to save crops
|
||||
|
||||
Returns:
|
||||
List of paths to successfully extracted thumbnail images
|
||||
List of paths to successfully extracted images
|
||||
"""
|
||||
thumbnail_paths = []
|
||||
image_paths = []
|
||||
|
||||
for idx, event in enumerate(events):
|
||||
try:
|
||||
thumbnail_bytes = get_event_thumbnail_bytes(event)
|
||||
img = _load_event_classification_crop(event)
|
||||
if img is None:
|
||||
continue
|
||||
|
||||
if thumbnail_bytes:
|
||||
nparr = np.frombuffer(thumbnail_bytes, np.uint8)
|
||||
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
|
||||
if img is not None:
|
||||
height, width = img.shape[:2]
|
||||
|
||||
crop_size = 1.0
|
||||
if event.data and "box" in event.data and "region" in event.data:
|
||||
box = event.data["box"]
|
||||
region = event.data["region"]
|
||||
|
||||
if len(box) == 4 and len(region) == 4:
|
||||
box_w, box_h = box[2], box[3]
|
||||
region_w, region_h = region[2], region[3]
|
||||
|
||||
box_area = (box_w * box_h) / (region_w * region_h)
|
||||
|
||||
if box_area < 0.05:
|
||||
crop_size = 0.4
|
||||
elif box_area < 0.10:
|
||||
crop_size = 0.5
|
||||
elif box_area < 0.20:
|
||||
crop_size = 0.65
|
||||
elif box_area < 0.35:
|
||||
crop_size = 0.80
|
||||
else:
|
||||
crop_size = 0.95
|
||||
|
||||
crop_width = int(width * crop_size)
|
||||
crop_height = int(height * crop_size)
|
||||
|
||||
x1 = (width - crop_width) // 2
|
||||
y1 = (height - crop_height) // 2
|
||||
x2 = x1 + crop_width
|
||||
y2 = y1 + crop_height
|
||||
|
||||
cropped = img[y1:y2, x1:x2]
|
||||
resized = cv2.resize(cropped, (224, 224))
|
||||
output_path = os.path.join(output_dir, f"thumbnail_{idx:04d}.jpg")
|
||||
cv2.imwrite(output_path, resized)
|
||||
thumbnail_paths.append(output_path)
|
||||
resized = cv2.resize(img, (224, 224))
|
||||
output_path = os.path.join(output_dir, f"thumbnail_{idx:04d}.jpg")
|
||||
cv2.imwrite(output_path, resized)
|
||||
image_paths.append(output_path)
|
||||
|
||||
except Exception as e:
|
||||
logger.debug(f"Failed to extract thumbnail for event {event.id}: {e}")
|
||||
logger.debug(f"Failed to extract image for event {event.id}: {e}")
|
||||
continue
|
||||
|
||||
return thumbnail_paths
|
||||
return image_paths
|
||||
|
||||
|
||||
def _load_event_classification_crop(event: Event) -> np.ndarray | None:
|
||||
"""Prefer a snapshot-based object crop; fall back to a center-cropped thumbnail."""
|
||||
if event.data and "box" in event.data:
|
||||
snapshot, _ = load_event_snapshot_image(event, clean_only=True)
|
||||
if snapshot is not None:
|
||||
abs_box = relative_box_to_absolute(snapshot.shape, event.data["box"])
|
||||
if abs_box is not None:
|
||||
xmin, ymin, xmax, ymax = abs_box
|
||||
box_w = xmax - xmin
|
||||
box_h = ymax - ymin
|
||||
if box_w > 0 and box_h > 0:
|
||||
x1, y1, x2, y2 = calculate_region(
|
||||
snapshot.shape,
|
||||
xmin,
|
||||
ymin,
|
||||
xmax,
|
||||
ymax,
|
||||
max(box_w, box_h),
|
||||
1.0,
|
||||
)
|
||||
cropped = snapshot[y1:y2, x1:x2]
|
||||
if cropped.size > 0:
|
||||
return cropped
|
||||
|
||||
thumbnail_bytes = get_event_thumbnail_bytes(event)
|
||||
if not thumbnail_bytes:
|
||||
return None
|
||||
|
||||
nparr = np.frombuffer(thumbnail_bytes, np.uint8)
|
||||
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
if img is None or img.size == 0:
|
||||
return None
|
||||
|
||||
height, width = img.shape[:2]
|
||||
crop_size = 1.0
|
||||
|
||||
if event.data and "box" in event.data and "region" in event.data:
|
||||
box = event.data["box"]
|
||||
region = event.data["region"]
|
||||
|
||||
if len(box) == 4 and len(region) == 4:
|
||||
box_w, box_h = box[2], box[3]
|
||||
region_w, region_h = region[2], region[3]
|
||||
box_area = (box_w * box_h) / (region_w * region_h)
|
||||
|
||||
if box_area < 0.05:
|
||||
crop_size = 0.4
|
||||
elif box_area < 0.10:
|
||||
crop_size = 0.5
|
||||
elif box_area < 0.20:
|
||||
crop_size = 0.65
|
||||
elif box_area < 0.35:
|
||||
crop_size = 0.80
|
||||
else:
|
||||
crop_size = 0.95
|
||||
|
||||
crop_width = int(width * crop_size)
|
||||
crop_height = int(height * crop_size)
|
||||
x1 = (width - crop_width) // 2
|
||||
y1 = (height - crop_height) // 2
|
||||
cropped = img[y1 : y1 + crop_height, x1 : x1 + crop_width]
|
||||
if cropped.size == 0:
|
||||
return None
|
||||
|
||||
return cropped
|
||||
|
||||
@ -726,7 +726,20 @@ def ffprobe_stream(ffmpeg, path: str, detailed: bool = False) -> sp.CompletedPro
|
||||
if detailed and format_entries:
|
||||
cmd.extend(["-show_entries", f"format={format_entries}"])
|
||||
cmd.extend(["-loglevel", "error", clean_path])
|
||||
return sp.run(cmd, capture_output=True)
|
||||
try:
|
||||
return sp.run(cmd, capture_output=True, timeout=6)
|
||||
except sp.TimeoutExpired as e:
|
||||
logger.info(
|
||||
"ffprobe timed out while probing %s (transport=%s)",
|
||||
clean_camera_user_pass(path),
|
||||
rtsp_transport or "default",
|
||||
)
|
||||
return sp.CompletedProcess(
|
||||
args=cmd,
|
||||
returncode=1,
|
||||
stdout=e.stdout or b"",
|
||||
stderr=(e.stderr or b"") + b"\nffprobe timed out",
|
||||
)
|
||||
|
||||
result = run()
|
||||
|
||||
@ -832,11 +845,23 @@ async def get_video_properties(
|
||||
"-show_streams",
|
||||
url,
|
||||
]
|
||||
proc = None
|
||||
try:
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, _ = await proc.communicate()
|
||||
try:
|
||||
stdout, _ = await asyncio.wait_for(proc.communicate(), timeout=6)
|
||||
except asyncio.TimeoutError:
|
||||
logger.info(
|
||||
"ffprobe timed out while probing %s (transport=%s)",
|
||||
clean_camera_user_pass(url),
|
||||
rtsp_transport or "default",
|
||||
)
|
||||
proc.kill()
|
||||
await proc.wait()
|
||||
return False, 0, 0, None, -1
|
||||
|
||||
if proc.returncode != 0:
|
||||
return False, 0, 0, None, -1
|
||||
|
||||
|
||||
@ -52,6 +52,21 @@
|
||||
"max_not_heard": {
|
||||
"description": "Ennyi másodperc után fejeződik be a hangesemény, ha a beállított hangtípus nem észlelhető.",
|
||||
"label": "Időtúllépés befejezése"
|
||||
},
|
||||
"min_volume": {
|
||||
"label": "Minimális hangerő",
|
||||
"description": "Minimum RMS hangerő a hangérzékelés futtatásához; az alacsonyabb értékek növelik az érzékenységet (pl: 200 magas, 500 közepes, 1000 alacsony érzékenységet jelent)."
|
||||
},
|
||||
"listen": {
|
||||
"label": "Hallgatási típúsok",
|
||||
"description": "Lista a hangalapú eseményekről amit érzékelni szeretnél (angolul) (például: bark, fire_alarm, scream, speech, yell)."
|
||||
},
|
||||
"filters": {
|
||||
"label": "Audio szűrők (filters)",
|
||||
"description": "Hangtípusonkénti szűrőbeállítások (filter), mint például a téves találatok számát mérsékelő konfidencia-küszöbök."
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "Eredeti audio állapot"
|
||||
}
|
||||
},
|
||||
"audio_transcription": {
|
||||
|
||||
@ -61,10 +61,38 @@
|
||||
"max_not_heard": {
|
||||
"description": "Ennyi másodperc után fejeződik be a hangesemény, ha a beállított hangtípus nem észlelhető.",
|
||||
"label": "Időtúllépés befejezése"
|
||||
},
|
||||
"min_volume": {
|
||||
"label": "Minimális hangerő",
|
||||
"description": "Minimum RMS hangerő a hangérzékelés futtatásához; az alacsonyabb értékek növelik az érzékenységet (pl: 200 magas, 500 közepes, 1000 alacsony érzékenységet jelent)."
|
||||
},
|
||||
"listen": {
|
||||
"label": "Hallgatási típúsok",
|
||||
"description": "Lista a hangalapú eseményekről amit érzékelni szeretnél (angolul) (például: bark, fire_alarm, scream, speech, yell)."
|
||||
},
|
||||
"filters": {
|
||||
"label": "Audio szűrők (filters)",
|
||||
"description": "Hangtípusonkénti szűrőbeállítások (filter), mint például a téves találatok számát mérsékelő konfidencia-küszöbök."
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "Eredeti audio állapot"
|
||||
}
|
||||
},
|
||||
"auth": {
|
||||
"label": "Azonosítás"
|
||||
"label": "Azonosítás",
|
||||
"description": "Bejelentkezési és munkamenet-beállítások, többek között süti- és lekérdezési korlátok (rate limit) megadásához.",
|
||||
"enabled": {
|
||||
"label": "Bejelentkezés engedélyezése",
|
||||
"description": "Natív bejelentkezés (azonosítás) engedélyezése a Frigate felületén."
|
||||
},
|
||||
"reset_admin_password": {
|
||||
"label": "Admin jelszó visszaállítása",
|
||||
"description": "Ha igaz, akkor visszaállítja az admin felhasználó jelszavát, és induláskor a naplóba írja ki az új jelszót."
|
||||
},
|
||||
"cookie_name": {
|
||||
"label": "JWT süti neve",
|
||||
"description": "A süti neve ami a JWT tokent tárolja a natív bejelentkezéshez."
|
||||
}
|
||||
},
|
||||
"audio_transcription": {
|
||||
"label": "Hang Feliratozás",
|
||||
|
||||
@ -29,7 +29,12 @@
|
||||
},
|
||||
"detect": {
|
||||
"global": {
|
||||
"resolution": "Globális Felbontás"
|
||||
"resolution": "Globális Felbontás",
|
||||
"tracking": "Globális követés"
|
||||
},
|
||||
"cameras": {
|
||||
"resolution": "Felbontás",
|
||||
"tracking": "Követés (tracking)"
|
||||
}
|
||||
},
|
||||
"snapshots": {
|
||||
@ -39,5 +44,15 @@
|
||||
"cameras": {
|
||||
"display": "Kijelző"
|
||||
}
|
||||
},
|
||||
"objects": {
|
||||
"global": {
|
||||
"tracking": "Globális objektumkövetés",
|
||||
"filtering": "Globális szűrés (filtering)"
|
||||
},
|
||||
"cameras": {
|
||||
"tracking": "Követés",
|
||||
"filtering": "Szűrés (filtering)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,5 +11,15 @@
|
||||
"required": "Ezt a mezőt kötelező kitölteni",
|
||||
"type": "Érvénytelen értéktípus",
|
||||
"enum": "Az engedélyezett értékek közül legalább egy kell legyen",
|
||||
"const": "Az érték nem egyezik a várt állandóval"
|
||||
"const": "Az érték nem egyezik a várt állandóval",
|
||||
"uniqueItems": "Minden elemnek egyedinek kell lennie",
|
||||
"format": "Érvénytelen formátum",
|
||||
"additionalProperties": "Ismeretlen tulajdonság nem engedélyezett",
|
||||
"oneOf": "Pontosan az egyik engedélyezett sémának kell megfelelnie",
|
||||
"anyOf": "Legalább az egyik engedélyezett sémának kell megfelelnie",
|
||||
"ffmpeg": {
|
||||
"inputs": {
|
||||
"rolesUnique": "Mindegyik szerepkör (role) csak egy bemeneti (input) streamhez rendelhető hozzá."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,5 +25,8 @@
|
||||
"headings": {
|
||||
"cases": "Esetek",
|
||||
"uncategorizedExports": "Kategória nélküli exportok"
|
||||
},
|
||||
"toolbar": {
|
||||
"addExport": "Export hozzáadása"
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,14 @@
|
||||
"websocket": {
|
||||
"label": "Üzenetek",
|
||||
"pause": "Szüneteltetés",
|
||||
"resume": "Folytatás"
|
||||
"resume": "Folytatás",
|
||||
"filter": {
|
||||
"all": "Összes téma (topic)",
|
||||
"topics": "Témák (topics)",
|
||||
"events": "Események",
|
||||
"reviews": "Értékelések (reviews)",
|
||||
"face_recognition": "Arcfelismerés"
|
||||
}
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
|
||||
@ -1282,7 +1282,8 @@
|
||||
},
|
||||
"hikvision": {
|
||||
"substreamWarning": "Substream 1 este limitat la o rezoluție mică. Multe camere Hikvision suportă substream-uri adiționale care trebuie activate din setările camerei. Se recomandă verificarea și utilizarea acestora."
|
||||
}
|
||||
},
|
||||
"resolutionUnknown": "Rezoluția acestui stream nu a putut fi sondată. Ar trebui să setezi manual rezoluția de detecție în Setări sau în configurația ta."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -62,15 +62,24 @@
|
||||
"toast": {
|
||||
"success": "导出成功。进入 导出 页面查看文件。",
|
||||
"error": {
|
||||
"failed": "导出失败:{{error}}",
|
||||
"failed": "未能加入导出队列:{{error}}",
|
||||
"endTimeMustAfterStartTime": "结束时间必须在开始时间之后",
|
||||
"noVaildTimeSelected": "未选择有效的时间范围"
|
||||
},
|
||||
"view": "查看"
|
||||
"view": "查看",
|
||||
"queued": "导出已加入队列。请在导出页面查看进度。",
|
||||
"batchSuccess_other": "已开始 {{count}} 个导出,正在打开合集。",
|
||||
"batchPartial": "已开始 {{total}} 个导出中的 {{successful}} 个。失败的摄像头:{{failedCameras}}",
|
||||
"batchFailed": "启动导出失败(共 {{total}} 个)。失败的摄像头:{{failedCameras}}",
|
||||
"batchQueuedSuccess_other": "已排队 {{count}} 个导出,正在打开合集。",
|
||||
"batchQueuedPartial": "已将 {{total}} 个导出中的 {{successful}} 个加入队列。失败的摄像头:{{failedCameras}}",
|
||||
"batchQueueFailed": "未能将 {{total}} 个导出加入队列。失败的摄像头:{{failedCameras}}"
|
||||
},
|
||||
"fromTimeline": {
|
||||
"saveExport": "保存导出",
|
||||
"previewExport": "预览导出"
|
||||
"previewExport": "预览导出",
|
||||
"queueingExport": "正在加入导出队列…",
|
||||
"useThisRange": "使用此范围"
|
||||
},
|
||||
"case": {
|
||||
"label": "合集",
|
||||
@ -107,7 +116,9 @@
|
||||
"exportingButton": "导出中…",
|
||||
"toast": {
|
||||
"started_other": "已开始 {{count}} 个导出。正在打开合集。",
|
||||
"startedNoCase_other": "已开始 {{count}} 个导出。"
|
||||
"startedNoCase_other": "已开始 {{count}} 个导出。",
|
||||
"partial": "已启动 {{total}} 个导出,其中 {{successful}} 个成功。失败项:{{failedItems}}",
|
||||
"failed": "启动导出失败(共 {{total}} 个)。失败项:{{failedItems}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -156,6 +167,14 @@
|
||||
"markAsReviewed": "标记为已核查",
|
||||
"deleteNow": "立即删除",
|
||||
"markAsUnreviewed": "标记为未核查"
|
||||
},
|
||||
"shareTimestamp": {
|
||||
"label": "分享该时间片段",
|
||||
"title": "分享该时间片段",
|
||||
"description": "分享带当前录制的播放时间的地址,或选择自定义时间。请注意,这不是公开的分享链接,只有具有 Frigate 和此摄像头访问权限的用户才能访问。",
|
||||
"custom": "自定义时间",
|
||||
"button": "分享时间片段地址",
|
||||
"shareTitle": "Frigate 核查时间:{{camera}}"
|
||||
}
|
||||
},
|
||||
"imagePicker": {
|
||||
|
||||
@ -404,35 +404,35 @@
|
||||
},
|
||||
"object_prompts": {
|
||||
"label": "目标提示",
|
||||
"description": "用于自定义特定标签的 GenAI 输出的按目标提示。"
|
||||
"description": "按目标设置提示词,让生成式 AI 对不同标签的输出进行定制。"
|
||||
},
|
||||
"objects": {
|
||||
"label": "GenAI 目标",
|
||||
"description": "默认发送给 GenAI 的目标标签列表。"
|
||||
"label": "生成式 AI 目标",
|
||||
"description": "默认发送给生成式 AI 的目标标签列表。"
|
||||
},
|
||||
"required_zones": {
|
||||
"label": "必需区域",
|
||||
"description": "目标必须进入才能符合 GenAI 描述生成条件的区域。"
|
||||
"description": "目标必须进入这些区域,才会触发生成式 AI 描述生成。"
|
||||
},
|
||||
"debug_save_thumbnails": {
|
||||
"label": "保存缩略图",
|
||||
"description": "保存发送给 GenAI 的缩略图用于调试和核查。"
|
||||
"description": "保存发送给生成式 AI 的缩略图用于调试和核查。"
|
||||
},
|
||||
"send_triggers": {
|
||||
"label": "GenAI 触发器",
|
||||
"description": "定义何时应将帧发送给 GenAI(结束时、更新后等)。",
|
||||
"label": "生成式 AI 触发器",
|
||||
"description": "定义画面帧应在何时发送给生成式 AI(如检测结束时、更新后等)。",
|
||||
"tracked_object_end": {
|
||||
"label": "结束时发送",
|
||||
"description": "当追踪目标结束时向 GenAI 发送请求。"
|
||||
"description": "目标追踪结束时向生成式 AI 发送请求。"
|
||||
},
|
||||
"after_significant_updates": {
|
||||
"label": "早期 GenAI 触发器",
|
||||
"description": "在追踪目标进行指定次数的重大更新后向 GenAI 发送请求。"
|
||||
"label": "生成式 AI 提前触发",
|
||||
"description": "在追踪目标发生指定次数的重要变化后,向生成式 AI 发送请求。"
|
||||
}
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "原始 GenAI 状态",
|
||||
"description": "指示原始静态配置中是否启用了 GenAI。"
|
||||
"label": "原配置生成式 AI 状态",
|
||||
"description": "表示在原始静态配置中是否已启用生成式 AI。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -583,43 +583,43 @@
|
||||
}
|
||||
},
|
||||
"genai": {
|
||||
"label": "GenAI 配置",
|
||||
"label": "生成式 AI 配置",
|
||||
"description": "控制使用生成式 AI 为核查项生成描述和摘要。",
|
||||
"enabled": {
|
||||
"label": "开启 GenAI 描述",
|
||||
"description": "为核查项启用或禁用 GenAI 生成的描述和摘要。"
|
||||
"label": "开启生成式 AI 描述",
|
||||
"description": "为核查项开启或关闭使用生成式 AI 生成描述和摘要。"
|
||||
},
|
||||
"alerts": {
|
||||
"label": "为警报开启 GenAI",
|
||||
"description": "使用 GenAI 为警报项生成描述。"
|
||||
"label": "为警报开启生成式 AI",
|
||||
"description": "使用生成式 AI 为警报项生成描述。"
|
||||
},
|
||||
"detections": {
|
||||
"label": "为检测开启 GenAI",
|
||||
"description": "使用 GenAI 为检测项生成描述。"
|
||||
"label": "为检测开启生成式 AI",
|
||||
"description": "使用生成式 AI 为检测项生成描述。"
|
||||
},
|
||||
"image_source": {
|
||||
"label": "核查图像来源",
|
||||
"description": "发送给 GenAI 的图像来源('preview' 或 'recordings');'recordings' 使用更高质量的帧但消耗更多 token。"
|
||||
"description": "发送给生成式 AI 的画面来源('preview' 或 'recordings');'recordings' 使用更高质量的画面帧,但会消耗更多的 token。"
|
||||
},
|
||||
"additional_concerns": {
|
||||
"label": "额外关注事项",
|
||||
"description": "GenAI 在评估此摄像头活动时应考虑的额外关注事项或备注列表。"
|
||||
"description": "生成式 AI 在分析此摄像头的监控行为时,需要额外注意的事项或说明列表。"
|
||||
},
|
||||
"debug_save_thumbnails": {
|
||||
"label": "保存缩略图",
|
||||
"description": "保存发送给 GenAI 提供商的缩略图用于调试和核查。"
|
||||
"description": "保存发送给生成式 AI 提供商的缩略图用于调试和核查。"
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "原始 GenAI 状态",
|
||||
"description": "追踪原始静态配置中是否启用了 GenAI 核查。"
|
||||
"label": "原配置生成式 AI 状态",
|
||||
"description": "记录在静态配置中最初是否已启用生成式 AI 核查功能。"
|
||||
},
|
||||
"preferred_language": {
|
||||
"label": "首选语言",
|
||||
"description": "向 GenAI 提供商请求生成响应的首选语言。"
|
||||
"description": "向生成式 AI 提供商请求生成响应的首选语言。"
|
||||
},
|
||||
"activity_context_prompt": {
|
||||
"label": "活动上下文提示",
|
||||
"description": "描述什么是和什么不是可疑活动的自定义提示,为 GenAI 摘要提供上下文。"
|
||||
"description": "自定义提示词,用于说明可疑行为与非可疑行为的界定,为生成式 AI 生成摘要提供上下文依据。"
|
||||
}
|
||||
},
|
||||
"description": "控制此摄像头的警报、检测和生成式 AI 核查总结的设置,这些设置会被界面与存储功能使用。"
|
||||
|
||||
@ -1470,7 +1470,7 @@
|
||||
},
|
||||
"provider": {
|
||||
"label": "提供商",
|
||||
"description": "要使用的 GenAI 提供商(例如:ollama、gemini、openai)。"
|
||||
"description": "要使用的生成式 AI 提供商(例如:ollama、gemini、openai 等。国产大模型厂商可使用 openai 接口)。"
|
||||
},
|
||||
"roles": {
|
||||
"label": "功能",
|
||||
@ -1478,7 +1478,7 @@
|
||||
},
|
||||
"provider_options": {
|
||||
"label": "提供商选项",
|
||||
"description": "传递给 GenAI 客户端的附加提供商特定选项。"
|
||||
"description": "要传递给生成式 AI 客户端的、与服务提供商相关的额外配置项。"
|
||||
},
|
||||
"runtime_options": {
|
||||
"label": "运行时选项",
|
||||
@ -1622,35 +1622,35 @@
|
||||
},
|
||||
"object_prompts": {
|
||||
"label": "目标提示",
|
||||
"description": "用于自定义特定标签的 GenAI 输出的按目标提示。"
|
||||
"description": "按目标设置提示词,让生成式 AI 对不同标签的输出进行定制。"
|
||||
},
|
||||
"objects": {
|
||||
"label": "GenAI 目标",
|
||||
"description": "默认发送给 GenAI 的目标标签列表。"
|
||||
"label": "生成式 AI 目标",
|
||||
"description": "默认发送给生成式 AI 的目标标签列表。"
|
||||
},
|
||||
"required_zones": {
|
||||
"label": "必需区域",
|
||||
"description": "目标必须进入才能符合 GenAI 描述生成条件的区域。"
|
||||
"description": "目标必须进入这些区域,才会触发生成式 AI 描述生成。"
|
||||
},
|
||||
"debug_save_thumbnails": {
|
||||
"label": "保存缩略图",
|
||||
"description": "保存发送给 GenAI 的缩略图用于调试和核查。"
|
||||
"description": "保存发送给生成式 AI 的缩略图用于调试和核查。"
|
||||
},
|
||||
"send_triggers": {
|
||||
"label": "GenAI 触发器",
|
||||
"description": "定义何时应将帧发送给 GenAI(结束时、更新后等)。",
|
||||
"label": "生成式 AI 触发器",
|
||||
"description": "定义画面帧应在何时发送给生成式 AI(如检测结束时、更新后等)。",
|
||||
"tracked_object_end": {
|
||||
"label": "结束时发送",
|
||||
"description": "当追踪目标结束时向 GenAI 发送请求。"
|
||||
"description": "目标追踪结束时向生成式 AI 发送请求。"
|
||||
},
|
||||
"after_significant_updates": {
|
||||
"label": "早期 GenAI 触发器",
|
||||
"description": "在追踪目标进行指定次数的重大更新后向 GenAI 发送请求。"
|
||||
"label": "生成式 AI 提前触发",
|
||||
"description": "在追踪目标发生指定次数的重要变化后,向生成式 AI 发送请求。"
|
||||
}
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "原始 GenAI 状态",
|
||||
"description": "指示原始静态配置中是否启用了 GenAI。"
|
||||
"label": "原配置生成式 AI 状态",
|
||||
"description": "表示在原始静态配置中是否已启用生成式 AI。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1802,43 +1802,43 @@
|
||||
}
|
||||
},
|
||||
"genai": {
|
||||
"label": "GenAI 配置",
|
||||
"label": "生成式 AI 配置",
|
||||
"description": "控制使用生成式 AI 为核查项生成描述和摘要。",
|
||||
"enabled": {
|
||||
"label": "开启 GenAI 描述",
|
||||
"description": "为核查项启用或禁用 GenAI 生成的描述和摘要。"
|
||||
"label": "开启生成式 AI 描述",
|
||||
"description": "为核查项开启或关闭使用生成式 AI 生成描述和摘要。"
|
||||
},
|
||||
"alerts": {
|
||||
"label": "为警报开启 GenAI",
|
||||
"description": "使用 GenAI 为警报项生成描述。"
|
||||
"label": "为警报开启生成式 AI",
|
||||
"description": "使用生成式 AI 为警报项生成描述。"
|
||||
},
|
||||
"detections": {
|
||||
"label": "为检测开启 GenAI",
|
||||
"description": "使用 GenAI 为检测项生成描述。"
|
||||
"label": "为检测开启生成式 AI",
|
||||
"description": "使用生成式 AI 为检测项生成描述。"
|
||||
},
|
||||
"image_source": {
|
||||
"label": "核查图像来源",
|
||||
"description": "发送给 GenAI 的图像来源('preview' 或 'recordings');'recordings' 使用更高质量的帧但消耗更多 token。"
|
||||
"description": "发送给生成式 AI 的画面来源('preview' 或 'recordings');'recordings' 使用更高质量的画面帧,但会消耗更多的 token。"
|
||||
},
|
||||
"additional_concerns": {
|
||||
"label": "额外关注事项",
|
||||
"description": "GenAI 在评估此摄像头活动时应考虑的额外关注事项或备注列表。"
|
||||
"description": "生成式 AI 在分析此摄像头的监控行为时,需要额外注意的事项或说明列表。"
|
||||
},
|
||||
"debug_save_thumbnails": {
|
||||
"label": "保存缩略图",
|
||||
"description": "保存发送给 GenAI 提供商的缩略图用于调试和核查。"
|
||||
"description": "保存发送给生成式 AI 提供商的缩略图用于调试和核查。"
|
||||
},
|
||||
"enabled_in_config": {
|
||||
"label": "原始 GenAI 状态",
|
||||
"description": "追踪原始静态配置中是否启用了 GenAI 核查。"
|
||||
"label": "原配置生成式 AI 状态",
|
||||
"description": "记录在静态配置中最初是否已启用生成式 AI 核查功能。"
|
||||
},
|
||||
"preferred_language": {
|
||||
"label": "首选语言",
|
||||
"description": "向 GenAI 提供商请求生成响应的首选语言。"
|
||||
"description": "向生成式 AI 提供商请求生成响应的首选语言。"
|
||||
},
|
||||
"activity_context_prompt": {
|
||||
"label": "活动上下文提示",
|
||||
"description": "描述什么是和什么不是可疑活动的自定义提示,为 GenAI 摘要提供上下文。"
|
||||
"description": "自定义提示词,用于说明可疑行为与非可疑行为的界定,为生成式 AI 生成摘要提供上下文依据。"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -285,7 +285,10 @@
|
||||
"zones": "区",
|
||||
"ratio": "比例",
|
||||
"area": "大小",
|
||||
"score": "分数"
|
||||
"score": "分数",
|
||||
"computedScore": "计算得分",
|
||||
"topScore": "最高得分",
|
||||
"toggleAdvancedScores": "切换高级分数"
|
||||
}
|
||||
},
|
||||
"annotationSettings": {
|
||||
|
||||
@ -54,5 +54,75 @@
|
||||
},
|
||||
"caseCard": {
|
||||
"emptyCase": "暂无导出文件"
|
||||
},
|
||||
"jobCard": {
|
||||
"defaultName": "{{camera}} 导出",
|
||||
"queued": "队列中",
|
||||
"running": "运行中",
|
||||
"preparing": "准备中",
|
||||
"copying": "复制中",
|
||||
"encoding": "编码中",
|
||||
"encodingRetry": "重试编码中",
|
||||
"finalizing": "正在完成"
|
||||
},
|
||||
"caseView": {
|
||||
"noDescription": "没有描述",
|
||||
"createdAt": "已创建 {{value}}",
|
||||
"exportCount_one": "1 个导出",
|
||||
"exportCount_other": "{{count}} 个导出",
|
||||
"cameraCount_one": "1 个摄像头",
|
||||
"cameraCount_other": "{{count}} 个摄像头",
|
||||
"showMore": "显示更多",
|
||||
"showLess": "显示更少",
|
||||
"emptyTitle": "该合集为空",
|
||||
"emptyDescription": "将现有未分类的导出添加进来,以便整理该条目。",
|
||||
"emptyDescriptionNoExports": "目前没有可添加的未分类导出项。"
|
||||
},
|
||||
"caseEditor": {
|
||||
"createTitle": "创建合集",
|
||||
"editTitle": "编辑合集",
|
||||
"namePlaceholder": "合集名称",
|
||||
"descriptionPlaceholder": "为该合集添加备注或相关说明"
|
||||
},
|
||||
"addExportDialog": {
|
||||
"title": "将导出添加到 {{caseName}}",
|
||||
"searchPlaceholder": "搜索未分类的导出项",
|
||||
"empty": "未找到匹配的未分类导出。",
|
||||
"addButton_one": "添加 1 个导出",
|
||||
"addButton_other": "添加 {{count}} 个导出",
|
||||
"adding": "添加中…"
|
||||
},
|
||||
"selected_one": "已选择 {{count}} 个",
|
||||
"selected_other": "已选择 {{count}} 个",
|
||||
"bulkActions": {
|
||||
"addToCase": "添加至合集",
|
||||
"moveToCase": "移动至合集",
|
||||
"removeFromCase": "从合集中移除",
|
||||
"delete": "删除",
|
||||
"deleteNow": "立即删除"
|
||||
},
|
||||
"bulkDelete": {
|
||||
"title": "删除导出",
|
||||
"desc_one": "你确定要删除 {{count}} 个导出吗?",
|
||||
"desc_other": "确定要删除 {{count}} 个导出吗?"
|
||||
},
|
||||
"bulkRemoveFromCase": {
|
||||
"title": "从合集中移除",
|
||||
"desc_one": "你确定要从该合集中移除这 {{count}} 个导出吗?",
|
||||
"desc_other": "你确定要从该合集中移除这 {{count}} 个导出吗?",
|
||||
"descKeepExports": "导出将被移至未分类。",
|
||||
"descDeleteExports": "导出将被永久删除。",
|
||||
"deleteExports": "选择删除导出"
|
||||
},
|
||||
"bulkToast": {
|
||||
"success": {
|
||||
"delete": "已删除导出",
|
||||
"reassign": "已更新合集分配",
|
||||
"remove": "已从合集中移除导出"
|
||||
},
|
||||
"error": {
|
||||
"deleteFailed": "删除导出失败:{{errorMessage}}",
|
||||
"reassignFailed": "更新合集分配失败:{{errorMessage}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1338,7 +1338,8 @@
|
||||
},
|
||||
"hikvision": {
|
||||
"substreamWarning": "子码流1当前被锁定为低分辨率。多数海康威视的摄像头都支持额外的子码流,这些子码流需要在摄像头设置中手动启用。如果你的设备支持,建议你检查并使用这些高分辨率子码流。"
|
||||
}
|
||||
},
|
||||
"resolutionUnknown": "无法检测此视频流的分辨率。你需要在设置或配置文件中手动指定检测分辨率。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1661,6 +1662,10 @@
|
||||
"placeholder": "选择模型…",
|
||||
"search": "搜索模型…",
|
||||
"noModels": "暂无模型"
|
||||
},
|
||||
"knownPlates": {
|
||||
"namePlaceholder": "例如:老婆的车",
|
||||
"platePlaceholder": "车牌号或正则表达式"
|
||||
}
|
||||
},
|
||||
"cameraConfig": {
|
||||
|
||||
@ -17,6 +17,9 @@ import { useUserPersistence } from "@/hooks/use-user-persistence";
|
||||
import { Skeleton } from "../ui/skeleton";
|
||||
import { Button } from "../ui/button";
|
||||
import { FaCircleCheck } from "react-icons/fa6";
|
||||
import { FaExclamationTriangle } from "react-icons/fa";
|
||||
import { MdOutlinePersonSearch } from "react-icons/md";
|
||||
import { ThreatLevel } from "@/types/review";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getTranslatedLabel } from "@/utils/i18n";
|
||||
@ -127,6 +130,11 @@ export function AnimatedEventCard({
|
||||
true,
|
||||
);
|
||||
|
||||
const threatLevel = useMemo<ThreatLevel>(
|
||||
() => (event.data.metadata?.potential_threat_level ?? 0) as ThreatLevel,
|
||||
[event],
|
||||
);
|
||||
|
||||
const aspectRatio = useMemo(() => {
|
||||
if (
|
||||
!config ||
|
||||
@ -152,7 +160,15 @@ export function AnimatedEventCard({
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
className="pointer-events-none absolute left-2 top-1 z-40 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100"
|
||||
className={cn(
|
||||
"absolute left-2 top-1 z-40 transition-opacity",
|
||||
threatLevel === ThreatLevel.SECURITY_CONCERN &&
|
||||
"pointer-events-auto bg-severity_alert opacity-100 hover:bg-severity_alert",
|
||||
threatLevel === ThreatLevel.NEEDS_REVIEW &&
|
||||
"pointer-events-auto bg-severity_detection opacity-100 hover:bg-severity_detection",
|
||||
threatLevel === ThreatLevel.NORMAL &&
|
||||
"pointer-events-none bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100",
|
||||
)}
|
||||
size="xs"
|
||||
aria-label={t("markAsReviewed")}
|
||||
onClick={async () => {
|
||||
@ -160,7 +176,13 @@ export function AnimatedEventCard({
|
||||
updateEvents();
|
||||
}}
|
||||
>
|
||||
<FaCircleCheck className="size-3 text-white" />
|
||||
{threatLevel === ThreatLevel.SECURITY_CONCERN ? (
|
||||
<FaExclamationTriangle className="size-3 text-white" />
|
||||
) : threatLevel === ThreatLevel.NEEDS_REVIEW ? (
|
||||
<MdOutlinePersonSearch className="size-3 text-white" />
|
||||
) : (
|
||||
<FaCircleCheck className="size-3 text-white" />
|
||||
)}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("markAsReviewed")}</TooltipContent>
|
||||
|
||||
@ -389,7 +389,7 @@ export default function LiveCameraView({
|
||||
return "mse";
|
||||
}, [lowBandwidth, mic, webRTC, isRestreamed]);
|
||||
|
||||
useKeyboardListener(["m"], (key, modifiers) => {
|
||||
useKeyboardListener(["m", "Escape"], (key, modifiers) => {
|
||||
if (!modifiers.down) {
|
||||
return true;
|
||||
}
|
||||
@ -407,6 +407,12 @@ export default function LiveCameraView({
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "Escape":
|
||||
if (!fullscreen) {
|
||||
navigate(-1);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user