pyodide / pyodide-blog

The Pyodide blog
https://blog.pyodide.org
Mozilla Public License 2.0
13 stars 11 forks source link

Post idea: running neural networks in Pyodide with OpenCV #28

Open ryanking13 opened 2 years ago

ryanking13 commented 2 years ago

Recently we added OpenCV to Pyodide. While testing OpenCV, I was able to run Pytorch neural network (converted to ONNX) in Pyodide using OpenCV DNN modules, though it is inference only and of course very slow (no GPU).

I would like to share some ideas about it, which also include some examples of handling images and dealing with the file system.

You can test it here: https://ryanking13.github.io/style-transfer-pyodide/

Demo video

https://user-images.githubusercontent.com/24893111/167838009-da09d694-82f8-4382-bc69-c21fbe3c0d0a.mp4

rth commented 2 years ago

Very nice demo, looking forward to reading your post!

On the demo page, you might want to put a sentence mentioning OpenCV and ONNX (or put it in the title). And also enable re-sizing by default, otherwise it's will take a long time if the user uploads some high res image.

Personal opinion, and feel free to ignore, but it would be nice if the post also answered the question:

There is opencv-wasm and ONNX which work already in the browser, so why do we need Pyodide to do this?