Skip to content

liuziyue/onnxjs-demo

 
 

Repository files navigation

ONNX.js Demo

ONNX.js demo is an interactive demo portal showing real use cases running ONNX.js runtime in VueJS. It currently supports four examples for you to quickly experience the power of ONNX.js runtime.

The demo is available here ONNX.js demo website.

NOTE: Currently, the supported platforms are Edge/Chrome/Firefox/Electron/Node.js (support for other platforms is coming soon).

Use Cases

The demo provides four scenarios based on four different ONNX pre-trained deep learning models.

1. SqueezeNet

SqueezeNet is a light-weight convolutional network for image classification. In the demo, you can select or upload an image and see which category it's from in miliseconds.

2. ResNet-50

ResNet-50 is a highly-accurate deep convolutional network for image classification. It is trained on 1000 pre-defined classes. Similar to the SqueezeNet demo, you can select or upload an image and see which category it's from.

3. FER+ Emotion Recognition

Emotion Ferplus is a deep convolutional neural network for emotion recognition in faces. In the demo, you can choose to either select an image with any human face or to start a webcam and see what emotion it's showing.

4. Yolo

Yolo is a real-time neural network for object detection. It can detect 20 different objects such as person, potted plant and chair. In the demo, you can choose to either select an image or start a webcam to see what objects are in it.

5. MNIST

MNIST is a convolutional neural network that predicts handwritten digits. In the demo, you can draw any number on the canvas and the model will tell you what number it is!

Run ONNX.js Demo

Install Dependencies

npm install

Serve the demo

Serve the demo in localhost

npm run serve

This will start a dev server and run ONNX.js demo on your localhost.

Deploy the demo

npm run build

This will pack the source files into /docs folder and be ready for deployment.

- Electron support

After the source files are ready for deployment, you can run the following to serve the demo as a Windows desktop app using Electron.

npm run electron-packager

This will create a new /ONNXjs-demo-win32-x64 folder. Run /ONNXjs-demo-win32-x64/ONNXjs-demo.exe to enjoy Electron desktop app.

Credits

This demo is adapted from keras.js demo. Modifications have been made to the UI and the backend uses ONNX.js.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

demos to show the capabilities of ONNX.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 62.6%
  • Vue 35.4%
  • JavaScript 1.3%
  • Other 0.7%