我正在尝试使用本地反应 CLI 离线对玉米叶病进行分类。我使用可教机器训练了 4 个班级的简单机器学习模型,并下载了tensorflow.js 格式模型(model.json 和weights.bin 文件)。
我正在使用此代码从媒体 Google
加载我的模型const modelJSON = require('../assets/model.json');
const modelWeights = require('../assets/weights.bin');
const loadModel = async()=>{
//.ts: const loadModel = async ():Promise<void|tf.LayersModel>=>{
const model = await tf.loadLayersModel(bundleResourceIO(modelJSON, modelWeights)
).catch((e)=>{
console.log("[LOADING ERROR] info:",e)
})
return model
}
这样做时我收到此错误
错误:找不到本机模块“ExponentGLObjectManager”,js引擎:Jsonload处的hermes(http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.bestproject&modulesOnly=false&runModule=true:314338 :41)
我尝试了不同的加载模型的方法,但我有相同的错误消息。
尝试在react-native中加载
@tensorflow/tfjs
时,我遇到了相同的错误消息。我通过添加将js引擎从hermes切换到jsc
"expo": {..., "jsEngine": "jsc",}
到我的 app.json
文件并使用 expo 重建项目。
看来 Hermes 与 TensorFlow.js 有一些兼容性问题,但我找不到任何具体细节。