Files
observer/flutter_app/lib/detection/detection_result.dart
T
admin 6d7ba3b6ab refactor(app): 模型不再打包进 APK,移除内置资产回退逻辑(版本 1.0.5+6)
- 移除 pubspec 的 model.tflite/labels.txt 资产与 DetectorWorker 内置回退
- 无下载模型时仅预览;modelsLabel 改为未下载
- 未打包 release APK(77.4MB,不含模型)
2026-08-31 15:57:58 +08:00

65 lines
1.5 KiB
Dart

class DetectionResult {
final String label;
final double score;
final double left;
final double top;
final double right;
final double bottom;
/// 轨迹已确认(多帧稳定/高分/活动确认),false = 候选,渲染为虚线
final bool confirmed;
/// 产出该框的模型(数据集 id 与名称;无来源为 -1/空)
final int modelId;
final String modelName;
const DetectionResult({
required this.label,
required this.score,
required this.left,
required this.top,
required this.right,
required this.bottom,
this.confirmed = true,
this.modelId = -1,
this.modelName = '',
});
double get width => right - left;
double get height => bottom - top;
double get centerX => (left + right) / 2;
double get centerY => (top + bottom) / 2;
DetectionResult copyWith({
double? score,
double? left,
double? top,
double? right,
double? bottom,
bool? confirmed,
}) =>
DetectionResult(
label: label,
score: score ?? this.score,
left: left ?? this.left,
top: top ?? this.top,
right: right ?? this.right,
bottom: bottom ?? this.bottom,
confirmed: confirmed ?? this.confirmed,
modelId: modelId,
modelName: modelName,
);
}
class MotionRegion {
final double left;
final double top;
final double right;
final double bottom;
const MotionRegion(this.left, this.top, this.right, this.bottom);
double get centerX => (left + right) / 2;
double get centerY => (top + bottom) / 2;
}