我正在关注TensorFlow.js - 使用迁移学习教程进行音频识别。当我按“火车”按钮调用 train() 函数时,错误如上。是我还是教程中有错误?
(我确实按照指南一步一步地进行了……并在最新版本的 chrome 中使用本地主机对其进行了测试)
第一个片段来自 index.js,第二个片段来自 index.html。
let recognizer;
function predictWord() {
// Array of words that the recognizer is trained to recognize.
const words = recognizer.wordLabels();
recognizer.listen(({scores}) => {
// Turn scores into a list of (score,word) pairs.
scores = Array.from(scores).map((s, i) => ({score: s, word: words[i]}));
// Find the most probable word.
scores.sort((s1, s2) => s2.score - s1.score);
document.querySelector('#console').textContent = scores[0].word;
}, {probabilityThreshold: 0.75});
}
async function app() {
recognizer …Run Code Online (Sandbox Code Playgroud)