Skip to content

Latest commit

 

History

History

README.md

MobileNet image classification

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.

Setup

  1. Build the main RTen project for WebAssembly. See the README.md file at the root of the repository.

  2. In this directory, run npm install

  3. Download the ONNX MobileNet model from the ONNX Model Zoo:

    curl -L https://github.com/onnx/models/raw/main/Computer_Vision/mobilenetv2_110d_Opset18_timm/mobilenetv2_110d_Opset18.onnx -o mobilenet.onnx
  4. Follow either of the subsections below to run the example in Node or the browser

Running in Node

$ node classify-node.js ../../tools/test-images/sofa-cats.jpg

# Example output

Most likely categories:
  - Egyptian cat
  - tabby, tabby cat
  - tiger cat
  - lynx, catamount
  - marmoset

Running in a browser

  1. Start a web server:

    python -m http.server 3010
    
  2. Open http://localhost:3010/

  3. Click "Choose file" and select a photo or image to classify