Google News
logo
ml5.js - Interview Questions
How do I use ml5.js?
Step 1 : Call your ml5 function. 
const myClassifier = await ml5.imageClassifier(‘MobileNet’);
 
Step 2 : Apply your ml5 function - e.g. to an image, video, or text. 
const results = await myClassifier.classify(myCatImage);
 
Step 3 : Do something with the results.
// An array of objects with “label” and “confidence”
// [ { label: ‘cat’, confidence: 0.74 } ]
console.log(results);
 
We can run a model in the browser with ml5.js in three simple steps.
 
First, create a model.
 
Secondly, ask the model to classify or predict something based on a input, like an image or a text.
 
And step three, getting the results.
 
It also has great integration with p5.js, a JavaScript library for creating graphics and animations in the browser, which makes it easier to get inputs from webcam or microphones and also to show the outputs with canvas, image or audio.
Advertisement