update tflite config

This commit is contained in:
Moe Poi ~ 2021-08-24 19:28:19 +07:00
parent 462f69b0d0
commit 99c138812b
2 changed files with 6 additions and 2 deletions

View file

@ -1,6 +1,8 @@
const String model = 'assets/datasets/model.tflite'; const String model = 'assets/datasets/model.tflite';
const String label = 'assets/datasets/label.txt'; const String label = 'assets/datasets/label.txt';
const String inputType = 'decodedWav'; const String inputType = 'decodedWav';
const int numOfInferences = 1;
const int sampleRate = 16000; const int sampleRate = 16000;
const int recordingLength = 16000; const int recordingLength = 16000;
const int bufferSize = 2000; const int bufferSize = 2000;
const double detectionThreshold = 0.5;

View file

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:easy_learn/view/widgets/custom_button.dart'; import 'package:easy_learn/view/widgets/custom_button.dart';
import 'package:easy_learn/view/widgets/score_board.dart'; import 'package:easy_learn/view/widgets/score_board.dart';
import 'package:easy_learn/view/widgets/list_contents_box.dart'; import 'package:easy_learn/view/widgets/list_contents_box.dart';
import 'package:easy_learn/config.dart' show model, label, inputType, sampleRate, recordingLength, bufferSize; import 'package:easy_learn/config.dart' show model, label, inputType, numOfInferences, sampleRate, recordingLength, bufferSize, detectionThreshold;
class Content extends StatefulWidget { class Content extends StatefulWidget {
@ -37,9 +37,11 @@ class _ContentState extends State<Content> {
void getResult() { void getResult() {
result = TfliteAudio.startAudioRecognition( result = TfliteAudio.startAudioRecognition(
inputType: inputType, inputType: inputType,
numOfInferences: numOfInferences,
sampleRate: sampleRate, sampleRate: sampleRate,
recordingLength: recordingLength, recordingLength: recordingLength,
bufferSize: bufferSize, bufferSize: bufferSize,
detectionThreshold: detectionThreshold
); );
result ?.listen( result ?.listen(