karpathy / convnetjs

Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.
MIT License
10.85k stars 2.04k forks source link

[Question] Why use javascript ? #72

Open howardyclo opened 7 years ago

howardyclo commented 7 years ago

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 ?

davidparks21 commented 7 years ago

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.

uiteoi commented 7 years ago

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.

MariasStory commented 7 years ago

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.

ghost commented 7 years ago

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.)

radioman commented 7 years ago

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.

ktamiola commented 7 years ago

@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.

damienstanton commented 7 years ago

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.

jefffriesen commented 7 years ago

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.

damienstanton commented 7 years ago

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

yuu2lee4 commented 6 years ago

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

damienstanton commented 6 years ago

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.

yuu2lee4 commented 6 years ago

A new framework http://propelml.org

yuu2lee4 commented 6 years ago

tensorflowJS https://js.tensorflow.org/

photopea commented 4 years ago

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