This demo classifies the content of images using MobileNet v2. The known
categories are listed in imagenet-classes.js
. The model works best when
there is an obvious central subject in the image, and the subject is a common
kind of object.
-
Build the main RTen project. See the README.md file at the root of the repository.
-
In this directory, run
npm install
-
Download and convert the ONNX MobileNet model:
curl -L https://github.com/onnx/models/raw/main/vision/classification/mobilenet/model/mobilenetv2-10.onnx -o mobilenet.onnx rten-convert mobilenet.onnx mobilenet.rten
-
Follow either of the subsections below to run the example in Node or the browser
$ node classify-node.js espresso.png
# Example output
Most likely categories:
- espresso
- chocolate sauce, chocolate syrup
- cup
- ice cream, icecream
- plate
-
Start a web server:
python -m http.server 3010
-
Click "Choose file" and select a photo or image to classify