我正在使用帶有tflite包的顫振的 tflite。我使用的模型是由我的團隊成員創建的。該模型識別葉片病害并將其分為 3 個階段。但我每次都得到相同的輸出,
response: [{confidence: 0.9917954802513123, index: 0, label: 0 early blight}]
只有信心略有變化。
影像分析功能,
runAnalyze() async {
if (pickedImage != null) {
try {
final temp = (await Tflite.runModelOnImage(
imageMean: 127.5,
imageStd: 127.5,
path: pickedImage!.path,
numResults: 1,
threshold: .5,
));
print('response: $temp');
setState(() {
errorText = temp.toString();
});
} on PlatformException catch (err) {
print('error: $err');
errorText = err.toString();
}
}}
在 main 上加載模型,
void main() async{
WidgetsFlutterBinding.ensureInitialized();
print(await Tflite.loadModel(
model: 'assets/converted_model.tflite',
labels: 'assets/labels.txt',
));
runApp(const MyApp());
}
uj5u.com熱心網友回復:
請將 , 更改numResults: 1為 label.txt 中的專案數,即如果您的 label.txt 包含 6 種疾病,則numResult = 6
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/470220.html
