This commit is contained in:
2026-08-28 17:33:35 +08:00
parent ad17e915fc
commit df1eacbda8
21 changed files with 48 additions and 36 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ class _CameraScreenState extends State<CameraScreen> {
const SizedBox(height: 8),
const Text(
'阈值越低识别越灵敏(低分框越多,误报也可能增加);'
'鸡模型置信度普遍在 10%~20%,场景识别不到时可适当调低。',
'环颈雉鸡模型置信度普遍在 10%~20%,场景识别不到时可适当调低。',
style: TextStyle(color: Colors.white54, fontSize: 12),
),
],
@@ -39,7 +39,7 @@ class CameraUiState {
/// 检测结果置信度分级与轨迹确认。
///
/// - [highConf]0.35):高于此分直接确认显示;真实鸡多为 0.1~0.2
/// - [highConf]0.35):高于此分直接确认显示;真实环颈雉鸡多为 0.1~0.2
/// 高于 0.35 视为强证据。
/// - 低于 0.35 的框:需要多帧稳定([confirmFrames] 帧)或 活动证据
/// (运动区域/背景新出现区域重叠)才确认显示。
@@ -105,7 +105,7 @@ class CameraViewModel extends ChangeNotifier {
visible.add(r.copyWith(confirmed: t.confirmed));
}
// 提醒:仅新确认的鸡轨迹(确认瞬间触发一次,10s 同类冷却在 Reminder 内)
// 提醒:仅新确认的环颈雉鸡轨迹(确认瞬间触发一次,10s 同类冷却在 Reminder 内)
for (final t in _tracks.values) {
if (t.label != 'pheasant' || !t.confirmed || t.reminded) continue;
final age = now - t.firstSeenMs;
@@ -152,7 +152,7 @@ class CameraViewModel extends ChangeNotifier {
for (final t in _tracks.values) {
if (matched.contains(t.id)) continue;
final d = _centerDist(t.result, r);
// 同标签宽松匹配;跨标签(鸡↔疑似 抖动)收紧到 60%
// 同标签宽松匹配;跨标签(环颈雉鸡↔疑似 抖动)收紧到 60%
final limit = t.label == r.label ? bestD : associateRadius * 0.6;
if (d < limit) {
bestD = d;
@@ -181,7 +181,7 @@ class CameraViewModel extends ChangeNotifier {
/// 显示判定(按类别策略):
/// - 疑似(生境预警):设计意图是常驻静态预警,始终显示(渲染侧弱化)
/// - 鸡:确认轨迹直接显示;未确认的只有在高分或活动证据时才显示
/// - 环颈雉鸡:确认轨迹直接显示;未确认的只有在高分或活动证据时才显示
bool _shouldDisplay(_Track t, List<MotionRegion> motionRegions,
List<MotionRegion> noveltyRegions) {
if (t.label == 'suspect') return true;
@@ -196,7 +196,7 @@ class CameraViewModel extends ChangeNotifier {
motionRegions.any((m) => MotionAggregator.centerInRegion(r, m)) ||
noveltyRegions.any((m) => MotionAggregator.centerInRegion(r, m));
/// 物理合理性过滤:宽高比与相对尺寸(鸡 20-100px@720 量级,参照标注脚本)
/// 物理合理性过滤:宽高比与相对尺寸(环颈雉鸡 20-100px@720 量级,参照标注脚本)
bool _plausible(DetectionResult r) {
final h = r.height;
final w = r.width;
@@ -6,8 +6,8 @@ import '../detection/coordinate_mapper.dart';
import '../detection/detection_result.dart';
/// 检测框绘制分级:
/// - 鸡 confirmed:红色实线 3px(强证据)
/// - 鸡 candidate:红色虚线 2px 半透明(待确认,弱提示)
/// - 环颈雉鸡 confirmed:红色实线 3px(强证据)
/// - 环颈雉鸡 candidate:红色虚线 2px 半透明(待确认,弱提示)
/// - 疑似(生境预警):黄色虚线 2px 半透明(常驻静态预警,弱化渲染)
/// 标签附带距离估计(针孔模型 焦距px×参考体型/框高px)。
class DetectionOverlay extends StatelessWidget {
@@ -48,9 +48,9 @@ class _OverlayPainter extends CustomPainter {
'pheasant': Color(0xFFE53935),
'suspect': Color(0xFFFDD835),
};
static const _labels = {'pheasant': '', 'suspect': '疑似'};
static const _labels = {'pheasant': '环颈雉', 'suspect': '疑似'};
/// 参考体型(米):鸡身高 / 植被高度(参照旧 DistanceEstimator
/// 参考体型(米):环颈雉鸡身高 / 植被高度(参照旧 DistanceEstimator
static const _refSizeM = {'pheasant': 0.45, 'suspect': 0.50};
/// iPhone 13 主摄在 1280 高预览下的估算焦距 px5.1mm / 5.30mm 传感器),