Initialize :
const classifier = ml5.imageClassifier(model, ?video, ?options, ?callback);
Parameters :
model : REQUIRED. A String value of a valid model OR a url to a model.json that contains a pre-trained model. Case insensitive. Models available are: 'MobileNet', 'Darknet' and 'Darknet-tiny','DoodleNet', or any image classification model trained in Teachable Machine. Below are some examples of creating a new image classifier:
* mobilenet :
const classifier = ml5.imageClassifier('MobileNet', modelReady);
* Darknet :
const classifier = ml5.imageClassifier('Darknet', modelReady);
* DoodleNet :
const classifier = ml5.imageClassifier('DoodleNet', modelReady);
* Custom Model from Teachable Machine :
const classifier = ml5.imageClassifier('path/to/custom/model.json', modelReady);
video : OPTIONAL. An HTMLVideoElement
callback : OPTIONAL. A function to run once the model has been loaded. If no callback is provided, it will return a promise that will be resolved once the model has loaded.
options : OPTIONAL. An object to change the defaults (shown below). The available options are :
{
version: 1,
alpha: 1.0,
topk: 3,
};