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
+4 -4
View File
@@ -16,12 +16,12 @@ Map<String, dynamic> _catalog(List<Map<String, dynamic>> models) =>
Map<String, dynamic> _item({String version = 'v1.0.0', String sha = ''}) => {
'datasetId': 7,
'datasetName': '鸡数据集',
'datasetName': '环颈雉鸡数据集',
'version': version,
'labels': ['pheasant', 'suspect'],
'sizeBytes': _modelBytes.length,
'sha256': sha.isEmpty ? _shaHex(_modelBytes) : sha,
'downloadUrl': '/download/models/鸡数据集/latest.tflite',
'downloadUrl': '/download/models/环颈雉鸡数据集/latest.tflite',
};
void main() {
@@ -60,7 +60,7 @@ void main() {
expect(m.ready, isTrue);
expect(m.error, isNull);
expect(m.models.length, 1);
expect(m.models.first.datasetName, '鸡数据集');
expect(m.models.first.datasetName, '环颈雉鸡数据集');
expect(m.models.first.bytes, _modelBytes);
expect(downloadHits, 1);
@@ -112,7 +112,7 @@ void main() {
expect(m2.models.length, 0, reason: '校验失败的模型不应加载');
expect(m2.error, isNotNull);
expect(m2.error, contains('鸡数据集'));
expect(m2.error, contains('环颈雉鸡数据集'));
});
test('目录下线:清理本地并清空模型', () async {
+4 -4
View File
@@ -17,9 +17,9 @@ DetectionResult box(String label, double score, double x, double y,
void main() {
test('不同模型同标签重复框:NMS 去重取高分', () {
// 鸡模型与野兔模型都检出了同一只"鸡"(不同模型对同一目标的重复框)
// 环颈雉鸡模型与野兔模型都检出了同一只"环颈雉鸡"(不同模型对同一目标的重复框)
final all = [
box('pheasant', 0.18, 0.3, 0.3, modelId: 1, modelName: '鸡模型'),
box('pheasant', 0.18, 0.3, 0.3, modelId: 1, modelName: '环颈雉鸡模型'),
box('pheasant', 0.55, 0.31, 0.3, modelId: 2, modelName: '野兔模型'),
];
final merged = mergeAcrossModels(all, 0.45);
@@ -39,8 +39,8 @@ void main() {
test('同模型内部与跨模型合并一致:远处不重叠保留', () {
final all = [
box('pheasant', 0.2, 0.1, 0.1, modelId: 1, modelName: '鸡模型'),
box('pheasant', 0.3, 0.8, 0.8, modelId: 1, modelName: '鸡模型'),
box('pheasant', 0.2, 0.1, 0.1, modelId: 1, modelName: '环颈雉鸡模型'),
box('pheasant', 0.3, 0.8, 0.8, modelId: 1, modelName: '环颈雉鸡模型'),
];
final merged = mergeAcrossModels(all, 0.45);
expect(merged.length, 2);