karpathy / convnetjs

Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Why use javascript ?

howardyclo opened this issue · comments

Hello, I'm a new comer to deep learning.
And I'm just curious about why you use javascript to implement convnet that need
expensive computation ? Why not just use python, or c++ ? Is there any specific reason ?

I believe this was just meant as a demo, it's not a framework to be used for production applications. The datasets are modest and the use of JavaScript makes it more simple to do the beautiful presentations without a lot dependencies and glue code complicating everything.

I think that JavaScript is perfectly fine for AI and in some cases there is no other option, such as running in a web browser or a (hybrid) mobile APP .

Performance-wise there is no reason to believe that JavaScript would perform significantly slower than Python. The reason why Python is used over C++ is not performance, it is the ecosystem.

For fast execution Python or C++ might not even be the best for neural networks as GPGPU computing could be the ultimate solution for fast parallel computing of lots of artificial neurons. In that case JavaScript would yield roughly the same performances as Python of C++.

Because it is about the ecosystem it is important to build one, this is what's missing for JavaScript, not fast computation as so far the cleat winner would be Python.

JS is the best solution and everyone should go for it. It is faster then everything else because it is distributed. It is not necessary the main idea of this framework, although, should be. Consider using only 10% of computer power on every visitor of a popular website and you can easily get hundreds/thousands computing hours a day. The best part, you get it for free.

Personally, I think Javascript is not exactly a good idea, despite my own interest in this. Some of the bigger deep networks are too big to fit into the browser. For example, VGG 19 layers, which is around 500MB+, something that size would be difficult to handle in browsers.

If you're looking to seriously train and play with deep learning, I'd suggest going with Caffe. Also, for beginners, Caffe is a lot friendly (more tutorials and various places to ask.)

there is port for c# https://github.com/cbovar/ConvNetSharp and behold it isn't worthless piece of garbage, it actually compiles! I guess you can convert it to c++ for turbo needs.

@YuChunLOL convnetjs is an excellent library for in-browser visualizations / interactive demos. However, given numerical performance of V8 (JavaScript) and derivates, it is far from being optimal for production use (read it number crunching and analysis). As @uiteoi suggested you might want to have a look on TensorFlow or Caffe.

@MariasStory

JS is the best solution and everyone should go for it. It is faster then everything else because it is distributed.

It seems you got confused here; a bit.

FYI those interested in a performant, modern browser-oriented implementation of neural nets should keep an eye on TensorFire, which uses WebGL and aims to be compatible with existing TensorFlow models.

Has anyone actually been able to use Tensorfire? I put my email on their list weeks ago but haven't heard from them. I can't find the github repo to be able to use it the library.

No, they have not released the source yet. Just demos. This is why I said it is worth keeping an eye on 😃

commented

Tok Uni did some perfect work base on javascript:
https://github.com/mil-tokyo

As an update to my earlier comments, I also recommend https://deeplearnjs.org/

Hardware-acceleration and integration with existing TensorFlow models make this one particularly nice.

commented

A new framework http://propelml.org

I made the library UNN.js, which can do the same things ConvNetJS does, but 4x faster :) (still in a single Javascript thread)

https://github.com/photopea/UNN.js