1
This commit is contained in:
@@ -9,6 +9,9 @@ class DetectionResult {
|
||||
/// 轨迹已确认(多帧稳定/高分/活动确认),false = 候选,渲染为虚线
|
||||
final bool confirmed;
|
||||
|
||||
/// 类别索引:0 = 目标物种(红色框),>0 = suspect(黄色框);-1 = 未知
|
||||
final int classId;
|
||||
|
||||
/// 产出该框的模型(数据集 id 与名称;无来源为 -1/空)
|
||||
final int modelId;
|
||||
final String modelName;
|
||||
@@ -21,6 +24,7 @@ class DetectionResult {
|
||||
required this.right,
|
||||
required this.bottom,
|
||||
this.confirmed = true,
|
||||
this.classId = -1,
|
||||
this.modelId = -1,
|
||||
this.modelName = '',
|
||||
});
|
||||
@@ -46,6 +50,7 @@ class DetectionResult {
|
||||
right: right ?? this.right,
|
||||
bottom: bottom ?? this.bottom,
|
||||
confirmed: confirmed ?? this.confirmed,
|
||||
classId: classId,
|
||||
modelId: modelId,
|
||||
modelName: modelName,
|
||||
);
|
||||
|
||||
@@ -148,6 +148,7 @@ class DetectorWorker {
|
||||
bottom: v[5] as double,
|
||||
modelId: v.length > 6 ? (v[6] as num).toInt() : -1,
|
||||
modelName: v.length > 7 ? v[7] as String : '',
|
||||
classId: v.length > 8 ? (v[8] as num).toInt() : -1,
|
||||
);
|
||||
}).toList();
|
||||
final motion = (list[5] as List)
|
||||
@@ -421,6 +422,7 @@ Future<void> _workerMain(SendPort mainPort) async {
|
||||
r.bottom,
|
||||
r.modelId,
|
||||
r.modelName,
|
||||
r.classId,
|
||||
])
|
||||
.toList(),
|
||||
motionRegions
|
||||
|
||||
@@ -479,6 +479,7 @@ class TfliteDetector {
|
||||
top: (cy - h / 2).clamp(0.0, 1.0),
|
||||
right: (cx + w / 2).clamp(0.0, 1.0),
|
||||
bottom: (cy + h / 2).clamp(0.0, 1.0),
|
||||
classId: bestCls,
|
||||
modelId: modelId,
|
||||
modelName: modelName,
|
||||
));
|
||||
|
||||
@@ -39,7 +39,8 @@ class VisualPrior {
|
||||
if (results.isEmpty || width <= 0 || height <= 0) return results;
|
||||
final kept = <DetectionResult>[];
|
||||
for (final r in results) {
|
||||
final lowConfPheasant = r.label == 'pheasant' && r.score < maxScore;
|
||||
final lowConfPheasant =
|
||||
(r.classId == 0 || r.label == 'pheasant') && r.score < maxScore;
|
||||
if (lowConfPheasant &&
|
||||
_reject(r, planes, strides, width, height, isBgra, rgbaOrder)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user