Load Tensorflow js model from local file system in javascript

前端 未结 7 1202
一个人的身影
一个人的身影 2020-11-30 10:31

I have converted a keras model to tensorflow json format and saved it locally in my computer. I am trying to load that json model in a javascript code using the below comman

相关标签:
7条回答
  • 2020-11-30 11:32
    const tf = require('@tensorflow/tfjs');
    const tfnode = require('@tensorflow/tfjs-node');
    
    async function loadModel(){
        const handler = tfnode.io.fileSystem('tfjs_model/model.json');
        const model = await tf.loadLayersModel(handler);
        console.log("Model loaded")
    }
    
    
    loadModel();
    

    This worked for me in node. Thanks to jafaircl.

    0 讨论(0)
提交回复
热议问题