cli to control zed camera start and stop. 2. measure now use every svo2 file for 1 fish, give intermideate result and final result with confidecne level(*).

This commit is contained in:
kevin
2026-04-16 11:38:30 +08:00
parent 9dce487c79
commit cc6cef0f73
57 changed files with 1877 additions and 386 deletions

View File

@@ -6,7 +6,7 @@ import sys
import tempfile
from datetime import datetime, timezone
from pathlib import Path
from typing import List
from typing import List, Tuple
from app.logging_config import format_json_pretty
from app.services.video_slice import get_video_duration, slice_video
@@ -102,7 +102,7 @@ def run_action_subprocess(mp4_path: Path, settings: Settings) -> str:
Path(out_json).unlink(missing_ok=True)
def run_full_action(mp4_path: Path, settings: Settings) -> tuple[HealthSnapshot, list[HealthSnapshot]]:
def run_full_action(mp4_path: Path, settings: Settings) -> Tuple[HealthSnapshot, List[HealthSnapshot]]:
"""运行 FishAction 健康检测。如果视频较长,会自动切片后分别检测。
每个切片被视为独立的视频,返回所有切片的结果列表。
@@ -112,7 +112,7 @@ def run_full_action(mp4_path: Path, settings: Settings) -> tuple[HealthSnapshot,
settings: 应用配置
Returns:
tuple[HealthSnapshot, list[HealthSnapshot]]: (第一个切片/完整视频的快照, 所有切片快照列表)
Tuple[HealthSnapshot, List[HealthSnapshot]]: (第一个切片/完整视频的快照, 所有切片快照列表)
- 如果视频被切片:返回 (第一个切片, 所有切片列表)
- 如果视频未被切片:返回 (完整视频快照, [完整视频快照])
"""
@@ -141,7 +141,7 @@ def run_full_action(mp4_path: Path, settings: Settings) -> tuple[HealthSnapshot,
)
# 处理每个切片
all_snaps: list[HealthSnapshot] = []
all_snaps = [] # type: List[HealthSnapshot]
for i, slice_file in enumerate(slice_files):
start_time = i * DEFAULT_SLICE_DURATION
end_time = min(start_time + DEFAULT_SLICE_DURATION, duration)