Published
Edited
Jan 10, 2019
Insert cell
Insert cell
image = new Promise((resolve, reject) => {
const image = new Image;
image.crossOrigin = "anonymous";
image.src = "https://storage.googleapis.com/learnjs-data/images/cat.jpeg";
image.onload = () => resolve(image);
image.onerror = reject;
})
Insert cell
Insert cell
Insert cell
Insert cell
pixels = dl.fromPixels(image)
Insert cell
Insert cell
resized = dl.image.resizeBilinear(pixels, [227, 227])
Insert cell
Insert cell
squeezenet = {
window.dl = dl;
const squeezenet = await require("deeplearn-squeezenet@0.2.0/dist/bundle.js");
const squeezeNet = new squeezenet.SqueezeNet();
await squeezeNet.load();
return squeezeNet;
}
Insert cell
Insert cell
logits = squeezenet.predict(resized)
Insert cell
Insert cell
classes = Object.entries(await squeezenet.getTopKClasses(logits, 10))
Insert cell
Insert cell
dl = require("deeplearn@0.5.1/dist/deeplearn.js")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more