CodeLabClub / scratch3_knn

Scratch3 extension: knn classifier
22 stars 14 forks source link

tf.loadModel is not a function #2

Closed hyufeng closed 5 years ago

hyufeng commented 5 years ago

os: win10 chrome: 77.0.3865.90(正式版本) (64 位) node: v12.9.0

导入代码: ` require('babel-polyfill'); const Runtime = require('../../engine/runtime');

const Clone = require('../../util/clone'); const Cast = require('../../util/cast'); const Video = require('../../io/video'); const formatMessage = require('format-message');

const tf = require('@tensorflow/tfjs'); const mobilenetModule = require('./mobilenet'); const knnClassifier = require('@tensorflow-models/knn-classifier'); `

mobilenet.js:1130 Uncaught (in promise) TypeError: tf.loadModel is not a function at MobileNet. (mobilenet.js:1130) at step (mobilenet.js:54) at Object.next (mobilenet.js:35) at mobilenet.js:28 at new Promise () at __awaiter (mobilenet.js:24) at MobileNet.load (mobilenet.js:1123) at Object. (mobilenet.js:1105) at step (mobilenet.js:54) at Object.next (mobilenet.js:35)

重现错误: 安装依赖后,复制代码,点击插件图标后,在console中报此错。

wwj718 commented 5 years ago

@summerscar

summerscar commented 5 years ago

依赖引入按照这边的example呢 https://github.com/tensorflow/tfjs-models/tree/master/knn-classifier#via-npm @hyufeng

hyufeng commented 5 years ago

问题已经解决啦,是@tensorflow/tfjs这个库的版本更新啦,恢复到原来的0.10.0版本就解决啦

STEMbotixd commented 1 year ago

Uncaught (in promise) TypeError: tf.loadLayersModel is not a function at MobileNet. (mobilenet.js:1132:1) at step (mobilenet.js:55:1) at Object.next (mobilenet.js:36:1) at mobilenet.js:29:1 at new Promise () at __awaiter (mobilenet.js:25:1) at ./node_modules/blockzie-vm/src/extensions/scratch3_knn/mobilenet.js.MobileNet.load (mobilenet.js:1124:1) at Object. (mobilenet.js:1106:1) at step (mobilenet.js:55:1) at Object.next (mobilenet.js:36:1) sir please solve this error

STEMbotixd commented 1 year ago

update my @tensorflow/tfjs update package but error is same. Uncaught (in promise) TypeError: tf.loadLayersModel is not a function at MobileNet. (mobilenet.js:1132:1) at step (mobilenet.js:55:1) at Object.next (mobilenet.js:36:1) at mobilenet.js:29:1 at new Promise () at __awaiter (mobilenet.js:25:1) at ./node_modules/blockzie-vm/src/extensions/scratch3_knn/mobilenet.js.MobileNet.load (mobilenet.js:1124:1) at Object. (mobilenet.js:1106:1) at step (mobilenet.js:55:1) at Object.next (mobilenet.js:36:1)