Procrastinator
Procrastinator

Reputation: 141

How to run a pytorch model on the browser?

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?

Upvotes: 6

Views: 5751

Answers (3)

user26593513
user26593513

Reputation: 1

Another alternative is JS-PyTorch.

You can train and run models directly on the web (with GPU support).

Upvotes: 0

Ehtesham Iqbal
Ehtesham Iqbal

Reputation: 1

Just to update you. Tensorflow.js is suitable for the TensorFlow model while onnx runtime web is a good option for others. Things to do are;

  • Convert your model to onnx(see PyTorch export onnx)
  • Use onnxruntime web to use generated onnx with javascript(detailed at onnxruntime.ai)

If anyone knows more options, kindly add.

Upvotes: 0

marpor
marpor

Reputation: 153

There's TensorFlow.js.

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

Upvotes: 1

Related Questions