Google News
logo
ml5.js - Interview Questions
Loading a pre-trained Model in ml5.NeuralNetwork.
Loading a pre-trained Model : If you've trained a model using the ml5.neuralNetwork and saved it out using the ml5.neuralNetwork.save() then you can load in the model, the weights, and the metadata.
const options = {
    task: 'classification' // or 'regression'
  }
  const nn = ml5.neuralNetwork(options);
  
  const modelDetails = {
    model: 'model/model.json',
    metadata: 'model/model_meta.json',
    weights: 'model/model.weights.bin'
  }
  nn.load(modelDetails, modelLoaded)

  function modelLoaded(){
    // continue on your neural network journey
    // use nn.classify() for classifications or nn.predict() for regressions
  }
Advertisement