mil-tokyo / webdnn

The Fastest DNN Running Framework on Web Browser
https://mil-tokyo.github.io/webdnn
Other
1.98k stars 146 forks source link

What the model is #928

Closed photopea closed 5 years ago

photopea commented 5 years ago

In the guide, I see the code

WebDNN.load('./model')

But it is never mentioned, what the model should be. As I understand, this is a web tool, but we need to use your native tools, to convert models in various formats into a specific JSON format for WebDNN.js? Would it be too hard to build such convertor right into WebDNN.js ?

I thought there exists some standard format for these models, into which the "trainers" like Tensorflow can export, and "executors" like WebDNN can import.

milhidaka commented 5 years ago

The ./model is directory of model files in webdnn's original format. This is converted from model file trained in tensorflow, caffe etc. by python tool provided in webdnn.

In the following tutorial, command like python train_mnist_keras.py --model fc does the conversion. https://github.com/mil-tokyo/webdnn/tree/master/example/mnist

photopea commented 5 years ago

So your Python tool converts models from other formats into one common forman? Is there a chance, that you describe that common format? Then, model training tools could export directily in that format, instead of you writing scripts for each tool.

milhidaka commented 5 years ago

The converted model format is backend-specific and depends on model optimization algorithm implemented in the converter. Backend means WebMetal, WebAssembly, etc. Therefore, it is difficult to implement export tool on deep learning framework side. My plan to simplify the system is to limit input model format to ONNX.

photopea commented 4 years ago

Hi, I made a parser for .caffemodel = Protocol Buffers + caffe-specific scheme. It is about 65 lines of Javascript without any dependencies. It is here on lines 115 - 180: https://github.com/photopea/UNN.js/blob/master/UNN.util.js

I used it to load , parse and run some .coffemodel models completely in a web browser. I think all your non-JS tools can be easily rewritten into JS, allowing your users do everything in a browser.

photopea commented 4 years ago

By the way, I made a parser for ONNX in Javascript. ONNX is also based on Protocol Buffers, just like Caffe, and is extremely easy to parse.

By the way, do you know ONNX.js from Microsoft? I think it is a competitor to WebDNN. It beats Keras.js and TensorFlow.js https://github.com/microsoft/onnxjs