Google News
logo
ml5.js - Interview Questions
What are the Methods in ml5.image?
.classify()

*
Given an image or video, returns an array of objects containing class names and probabilities
 
If you DID NOT specify an image or video in the constructor...
classifier.classify(input, ?numberOfClasses, ?callback);
 
If you DID specify an image or video in the constructor...
classifier.classify(?numberOfClasses , ?callback);
 
Inputs :
 
* input : HTMLImageElement | ImageData | HTMLCanvasElement | HTMLVideoElement. NOTE: Videos can also be added in the constructor and then do not need to be specified again as an input.

* numberOfClasses : Number. The number of classes you want to return.

* callback : Function. A function to handle the results of .segment(). Likely a function to do something with the segmented image.

Outputs :
 
* Object : Returns an array of objects. Each object contains {label, confidence}.
Advertisement