ml5.js aims to make machine learning accessible to a broad audience of artists, creative coders, and students. The library provides access to machine learning algorithms and models in the browser, building on top of TensorFlow.js
with no other external dependencies.
The library is supported by code examples, tutorials, and sample datasets with an emphasis on ethical computing. Bias in data, stereotypical harms, and responsible crowdsourcing are part of the documentation around data collection and usage.
// Create the classifier
const classifier = new ml5.ImageClassifier('MobileNet');
// Make a prediction
let prediction = classifier.predict(img, gotResults);
function gotResults(results) {
console.log(results);
}
ml5.js is a friendly high level interface to TensorFlow.js, a library for handling GPU-accelerated mathematical operations and memory management for machine learning algorithms.
ml5.js provides immediate access in the browser to pre-trained models for detecting human poses, generating text, styling an image with another, composing music, pitch detection, and common English language word relationships.
Additionally, ml5.js provides an API for training new models based on pre-trained ones as well as training from custom user data from scratch.