RN 0.75裸项目(非Expo)中使用react-native-fast-tflite加载TFLite文件失败求助
RN 0.75裸项目(非Expo)中使用react-native-fast-tflite加载TFLite文件失败求助
各位好,我现在在做一个裸React Native 0.75项目(不是Expo环境),想用react-native-fast-tflite加载我的TFLite模型文件,但一直卡壳,来求助大家!
我试过两种方式放置TFLite文件:先是按照文档建议放到asset文件夹里,没效果;后来又移到ios文件夹中。放到ios文件夹后,用const path = RNFS.exists(${RNFS.MainBundlePath}/file.tflite)检测,返回结果是true,说明文件路径是能找到的,但把这个path传入await loadTensorflowModel(path, 'core-ml')时直接报错了,具体两个错误:
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'Tflite' could not be foundModel load failed: [TypeError: Cannot read property 'loadTensorflowModel' of undefined]
我已经做过的尝试还有:
- 在metro.config.js里添加了
assetExts: [...defaultConfig.resolver.assetExts, 'tflite'],把tflite后缀加入了Metro的资源解析列表 - 反复在assets目录和ios目录之间挪动TFLite文件,都没解决问题
有没有遇到过类似情况的朋友?或者知道哪里配置遗漏的,麻烦指点一下!
内容来源于stack exchange
相关产品推荐
相关产品推荐

