How to run a pytorch model on the browser?

Viewed 1054

I would like to know what are the options I have to run an object detection model in the browser, until now I have found the next options:

  1. Streamlit: is very simple but requires the server resources to run, including its own camera. Besides, I believe is not possible to be implemented as a website.
  2. Brython: is a JS substitute? I couldnt find the way how to load pytorch or libraries.
  3. Onnx: Seems to be a very good option, however I dont quite understand how to run the model in JS, since I have been using python and pytorch only, What is the learning roadmap? What is the relation with Webassembly?
  4. NCNN: This is the method I know the least, It seems to be able to work on basically any device, Webassembly, windows, android..., but again, I cant understand how to use my python-pytorch model to this framework since I dont know the roadmap.

Are there other options?

1 Answers

There's TensorFlow.js.

You still need to convert your model with something like ONNX, though.

Related