且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在javascript中从本地文件系统加载Tensorflow js模型

更新时间:2023-09-21 08:14:04

我知道您正在尝试在浏览器中加载模型,但是如果有人在这里尝试在Node中进行加载,方法如下:

I know you're trying to load your model in a browser but if anybody lands here that's trying to do it in Node, here's how:

const tf = require("@tensorflow/tfjs");
const tfn = require("@tensorflow/tfjs-node");
const handler = tfn.io.fileSystem("./path/to/your/model.json");
const model = await tf.loadModel(handler);