3 ms·
The demo uses WebGL, and if you can't get the demo to work, you can here(https://github.com/Erkaman/regl-cnn https://github.com/Erkaman/regl-cnn) find a recorde
by erkaman 10y ago
The demo uses WebGL, and if you can't get the demo to work, you can
here(https://github.com/Erkaman/regl-cnn https://github.com/Erkaman/regl-cnn) find a recorded gif that shows what it is supposed to look like.
This demo does handwritten digit recognition by evaluating a
Convolutional Neural Network on the GPU with WebGL. The network was
trained in TensorFlow by this script here(https://github.com/Erkaman/regl-cnn/blob/gh-pages/scripts/create_cnn.py https://github.com/Erkaman/regl-cnn/blob/gh-pages/scripts/cr...), and the network was then
reimplemented on the GPU by hand with WebGL. The main purpose of the
demo was to demonstate how our WebGL framework
regl(https://github.com/mikolalysenko/regl https://github.com/mikolalysenko/regl) can be used to greatly
simplify GPGPU programming in WebGL. The secondary purpose was to test
whether evaluating Deep Learning networks in WebGL is doable. To our
knowledge(but we may be wrong!), our implementation is the first
implementation ever to attempt GPU accelerating neural networks with
WebGL And we hope that this implementation will provide a foundation
for people who, like us, wish to experiment with Deep Learning and
WebGL The GPU implementation can be found here(https://github.com/Erkaman/regl-cnn/blob/gh-pages/src/gpu.js https://github.com/Erkaman/regl-cnn/blob/gh-pages/src/gpu.js)
Note that this network will probably be slower than the corresponding
network implemented on the CPU. This is because of the overhead
associated with transferring data to and from the GPU. But in the
future we will attempt implementing more complex networks in the browser,
such as Neural Style(https://arxiv.org/pdf/1508.06576v2.pdf https://arxiv.org/pdf/1508.06576v2.pdf), and then we think that we will see a
significant speedup compared to the CPU.
Lastly, if anyone has any questions, I will be glad to answer them
here.
- rawnlq 10y agoAre there any plans to make the porting automatic with some sort of compile to JS?
- erkaman 10y agoI had plans to do that, but that means implementing all of TensorFlows functionality in Javascript, which is a huge pain and lots of work. But if we restricted all networks to a strict subset of TensorFlow, it can be done, I think.
- transcranial 10y agoNice work! I've also tried my hands at use WebGL to do deep learning in the browser (e.g. https://github.com/scienceai/neocortex/blob/master/src/lib/webgl/matmul-webgl.js https://github.com/scienceai/neocortex/blob/master/src/lib/w...). The conclusion I came to was that there are just way too many limitations for it to really pay off. The need to encode everything in textures etc limits the data shape and dimensionality, not to mention the complexity cost. If you can get more complex networks working I'll be really impressed! MXnet.js [1] is an emscripten port of the base C++ framework. It runs entirely in the browser and works fairly well. The actual code produced by emscripten isn't that large, but the model weights can become an issue. I've tried to get emscripten working on tensorflow, even just for forward prediction, but have been pretty much gotten nowhere. Of course this doesn't let you harness GPU power. Lots of cool potential applications of doing deep learning over the web are just waiting to be discovered and built. [1] https://github.com/dmlc/mxnet.js https://github.com/dmlc/mxnet.js
- erkaman 10y agoWow, so there are other people who have tried doing deep learning in WebGL! But I will also give it a try, and see if I can do it better than you.
- blobert 10y agoI grew up in Germany and my 7s (written with the slash through it) is recognized as a 3 or 8 :\
- Asooka 10y agoWeird, my 7 with a slash is consistently (2/2 times) recognised as a 7. Maybe you need to write the slash without connecting it to the bottom with a little loop? Otherwise it's a real shame that these networks are only trained on American handwriting (is it even handwriting? most Americans seem to print-write).
- blobert 10y agoHmmm... I don't connect with a loop. See the following: http://i.imgur.com/H7sYLNn.png http://i.imgur.com/H7sYLNn.png I'd love to see what yours looks like.
- calebegg 10y agoNot the person you were talking to, but here's mine: http://imgur.com/a/7OIgK http://imgur.com/a/7OIgK (American here). I did get it saying 3 a few times, but 7 most of the time.
- kcimc 10y agoVery well done, but not the first: 2 years ago Jetpac released DeepBeliefSDK (https://github.com/jetpacapp/DeepBeliefSDK https://github.com/jetpacapp/DeepBeliefSDK). They were acquired by Google and development stopped. But the demo has been ported (http://waylonflinn.github.io/DeepBeliefSDK/ http://waylonflinn.github.io/DeepBeliefSDK/) using a newer toolkit called webblas (https://github.com/waylonflinn/weblas https://github.com/waylonflinn/weblas). Reddit discussion about webblas at (https://www.reddit.com/r/MachineLearning/comments/41luif/gpu_based_browser_blas_request_for_feedback/ https://www.reddit.com/r/MachineLearning/comments/41luif/gpu...) which has some more links and thoughts about this kind of thing. One more toolkit, written during a hackathon and still getting started, is gpu.js (https://github.com/gpujs/gpu.js/ https://github.com/gpujs/gpu.js/).