tensorflowjs的mnist数字识别模型文件

时间:2021-11-26 14:50:11
【文件属性】:

文件名称:tensorflowjs的mnist数字识别模型文件

文件大小:223KB

文件格式:ZIP

更新时间:2021-11-26 14:50:11

mnist tensorflowjs

实例代码使用,其中输入包含数字矩阵,和keepprob import * as tf from '@tensorflow/tfjs'; import {loadFrozenModel} from '@tensorflow/tfjs-converter'; const MODEL_DIR = './static/tfjsmodel/'; const MODEL_URL = 'tensorflowjs_model.pb'; const WEIGHTS_URL = 'weights_manifest.json'; this.model = await tf.loadFrozenModel( MODEL_DIR + MODEL_URL, MODEL_DIR + WEIGHTS_URL); let x = tf.tensor(this.img, [1, 28, 28, 1]) x.print() console.log(this.img) let p = this.model.predict({ "Placeholder": x, "Placeholder_2": tf.scalar(1.), }) p.print() console.log(p) let ctx = document.getElementById('num') tf.toPixels(tf.tensor(this.img, [28, 28, 1]), ctx) this.num = p.dataSync()[0]


【文件预览】:
weights_manifest.json
tensorflowjs_model.pb
group1-shard1of1

网友评论