18 ms·
Neural Networks in JavaScript with Deeplearn.js
- visarga 9y agoHow does it compare to regular Python DL frameworks?
- ericand 9y agoThis explanation from a Google blogpost helped me: The API mimics the structure of TensorFlow and NumPy, with a delayed execution model for training (like TensorFlow), and an immediate execution model for inference (like NumPy). We have also implemented versions of some of the most commonly-used TensorFlow operations. With the release of deeplearn.js, we will be providing tools to export weights from TensorFlow checkpoints, which will allow authors to import them into web pages for deeplearn.js inference. https://research.googleblog.com/2017/08/harness-power-of-machine-learning-in.html https://research.googleblog.com/2017/08/harness-power-of-mac...
- yazr 9y agoDoes anyone have performance figures ? Is is 10x 100x 3x slower than standalone GPU lib ?!
- jorgemf 9y agoIt uses WebGL to use the GPU, so probably is closer to other standalone libs (but I guess it will depend on the kernels the Networks uses and how WebGL can handle them)
- brianchu 9y agoWhen possible, most DL frameworks take advantage of Nvidia's specialized CuDNN libraries, which often provide a 10x+ speedup (and are obviously not available via WebGL). So at least on the latest Nvidia cards, you will likely see a 10x slowdown, and probably even more.
- amelius 9y agoWhat is so appealing about a delayed execution model? Why can't we just perform tensor math as in numpy, and let the library figure out the fastest way to do it behind the scenes? I think the whole "graph" approach is making things needlessly complicated.
- nsthorat 9y agoAuthor of deeplearnjs here. We hear you, and we 100% agree. Stay tuned.
- amelius 9y agoThat's great to hear. By the way, if you'd make your interface more general than deep learning, your library could be the start of an alternative for numpy/scipy on JS, and it would be even faster than the original Python version because it uses the GPU. Just a thought ... (One small downside is that JS doesn't have the nice operator overloading that Python has, afaik)
- nsthorat 9y agoWe call ourselves deeplearn.js, but you can use it for general linear algebra! Our NDArrayMath layer is analogous to NumPy, and we support a large subset of it (we support many of the linear algebra kernels, broadcasting, axis reduction, etc).
- dsmilkov 9y agoCheck out our roadmap: https://deeplearnjs.org/docs/roadmap.html https://deeplearnjs.org/docs/roadmap.html (we are working on eager mode / define-by-run computation)
- quadrature 9y agoThat would be nice for experimentation but for production use cases knowing the whole graph unlocks a number of optimizations.
- 9y ago
- ericand 9y agoIf you are looking for it (like I was), here's a direct link to the deeplearn.js project: https://deeplearnjs.org/ https://deeplearnjs.org/
- nerfhammer 9y agoI was going to write a cynical complaint about how it's hardly useful without GPU support... but it's using WebGL to hit the GPU. Of course. And it's probably a million times easier than trying install a TensorFlow stack locally on your desktop.
- rawnlq 9y agoDumb question, but can someone give me a summary of how you can implement this in webgl? I thought there are only vertex/fragment shaders and compute shaders aren't supported yet? Do you just pretend everything is pixel data?
- kaoD 9y ago> Do you just pretend everything is pixel data? Pretty much. It's inconvenient because shaders are meant for vertices/fragments but it still works.
- nsthorat 9y agoAuthor of deeplearn.js here. A quick summary: We store NDArrays as floating point WebGLTextures (in rgba channels). Mathematical operations are defined as fragment shaders that operate on WebGLTextures and produce new WebGLTextures. The fragment shaders we write operate in the context of a single output value of our result NDArray, which gets parallelized by the WebGL stack. This is how we get the performance that we do.
- SoapSeller 9y agoWhich... is pretty much how GPGPU started in the early 2000. Sad/funny how we go through this cycle again. It will be interesting to see if the industry will produce a standard for GPGPU in the browser. Giving that the desktop standard is less common than a proprietary standard.
- banachtarski 9y agoThis is still done in pretty much every game engine I've worked with (for general computation used to support rendering as much as the rendering itself). It's frankly extremely practical and better than many GPGPU apis because it matches what the hardware is doing internally better (GPU core warps, texel caches, vertex caches, etc).
- rwieruch 9y agoOP here: Please checkout the GitHub repository of the Neural Network in JS too [0]. Would love to see some exciting discussions around machine learning in JS. I am exploring the topic heavily at the moment and I am keen to apply/write/educate/learn more about it. - [0] https://github.com/javascript-machine-learning/color-accessibility-neural-network-deeplearnjs https://github.com/javascript-machine-learning/color-accessi...
- XCSme 9y agoI would also recommend Synaptic.js http://caza.la/synaptic/ http://caza.la/synaptic/ It's easy to get started with, very good for learning the basics of NNs very quickly.
- jorgemf 9y agoI hope web pages don't grow to hundreds of megabytes just because they have a Neural Network embedded.
- nsthorat 9y agoThere is lots of work being done in model compression (quantization, simple factorization tricks, better conv kernels like depthwise separable convs, etc). We won’t let that happen!
- jorgemf 9y agoI am aware of that research, but even with a 20x decrease in size some models are still too big for web (think about world wide web, not internet in US).
- nsthorat 9y agoOften times researchers train huge models, but don't think about model size (because they don't have to). We've seen ~200MB production models get down to ~4MB and not lose much precision. I'm quite confident we'll continue that trend. Don't forget that folks were saying this about the web when images / rich media were becoming prevalent!
- niyazpk 9y ago>> We've seen ~200MB production models get down to ~4MB and not lose much precision. Details please. What techniques are used to reduce the model size?
- hidenotslide 9y agoI saw a talk on this paper a couple years ago. https://arxiv.org/abs/1503.02531 https://arxiv.org/abs/1503.02531 The method is to train a smaller model on the predictions of a large model or ensemble. I'd be interested in knowing other techniques as well.
- simonw 9y agoThis webcam demo with live updating visualization of the different network layers is extraordinary: https://deeplearnjs.org/demos/imagenet/ https://deeplearnjs.org/demos/imagenet/
- bduerst 9y agoI dunno, it says I have the highest probability of being a shower cap or a bandaid. I personally like this one the best (also uses deeplearn.js): https://teachablemachine.withgoogle.com/ https://teachablemachine.withgoogle.com/
- sillysaurus3 9y agoHorrifying: https://i.imgur.com/RepliZd.png https://i.imgur.com/RepliZd.png I dig it.