我正在尝试集成我的自定义YOLO模型(我尝试使用YOLOv3和YOLOv4)像https://stackoverflow.com/a/62990869/9420938中显示的那样扑动。然而,当我调用Tflite.detectObjectOnFrame()模型总是返回一个空数组。如果我调用Tflite.runModelOnFrame(),它返回对象的标签,但不返回边界框。有人知道会发生什么吗?
Tflite.loadModel(
model: "assets/yolov3-tiny-416.tflite",
labels: "assets/labels.txt",
numThreads: 1, // defaults to 1
isAsset: true, // defaults to true, set to false to load resources outside assets
useGpuDelegate: false // defaults to false, set to true to use GPU delegate
).then((res){
_initialized = res;
});
var recognitions = await Tflite.detectObjectOnFrame(
model: "YOLOv3",
bytesList: image.planes.map((plane) {return plane.bytes;}).toList(),// required
imageHeight: image.height,
imageWidth: image.width,
imageMean: 0,
imageStd: 255.0,
numResultsPerClass: 2,
numBoxesPerBlock: 5,
threshold: 0.3,
blockSize: 32,
asynch: true
);
确保你使用的是tflite_flutter_plugin和tflite_flutter_helper:https://pub.dev/packages/tflite_flutter
而不是tflite(目前只支持yolov2):https://pub.dev/packages/tflite
编辑:为了让v2以上的Yolo在tflite_flutter_plugin中工作,你应该遵循以下说明:https://github.com/TexMexMax/object_detection_flutter
注意:当编辑tflite_flutter_helper插件时,请确保删除其中的示例,因为这会导致错误并导致应用程序崩溃(这就是发生在我身上的事情)。