Live data from Hacker News

Keras.js – Run trained Keras models in your browser

github.com

11–20 of 28 posts

Re: Keras.js – Run trained Keras models in your browser

#12
post #7

cool but.. >Offload computation entirely to client browsers i'm not sure that's a big benefit really

They're using pre trained models though, like

https://github.com/heuritech/convnets-keras

I don't think they expect people to train them in the browser, just run the pretrained ones for image recognition or something

Re: Keras.js – Run trained Keras models in your browser

#14
post #5

What sort of performance can be expected compared to running in the terminal? How large NNs will this scale to in practice? I see a 50-layer resnet is mentioned; but not 1000-layers?

You mean with tensorflow or theano as the backend? They have all kinds of optimizations that isn't possible to replicate here yet. There is certainly room for optimization! Also, 1000-layer resnets should theoretically be possible, but probably isn't that practical. Lots of exciting work happening in searching for more efficient architectures.

Re: Keras.js – Run trained Keras models in your browser

#15
post #12
post #7

cool but.. >Offload computation entirely to client browsers i'm not sure that's a big benefit really

They're using pre trained models though, like https://github.com/heuritech/convnets-keras I don't think they expect people to train them in the browser, just run the pretrained ones for image recognition or something

Training may not yet be available, but how about inference?

Re: Keras.js – Run trained Keras models in your browser

#16

This is great! The network visualizations are also pretty sweet. How are those generated?

Thanks. Nothing fancy with the network architecture diagrams. The layers are just div elements with the layer name as the id. There's a definition of inbound/outbound connections by layer names, extracted from the keras json config, which is used to draw SVG paths.

Re: Keras.js – Run trained Keras models in your browser

#19
post #12

Earlier quoted context omitted.

They're using pre trained models though, like https://github.com/heuritech/convnets-keras I don't think they expect people to train them in the browser, just run the pretrained ones for image recognition or something

Training may not yet be available, but how about inference?

Inference is what this does

Re: Keras.js – Run trained Keras models in your browser

#20
post #2

This is awesome! Can you describe how you implemented the WebGL ops a bit more? Did you have to write your own convolution kernel with GLSL for example?

Thanks! For WebGL, credit goes to https://github.com/waylonflinn/weblas . I only really use GEMM, but it works quite well. In keras.js, convolution is implemented with the oft-used im2col transformation to turn it into a matrix multiply followed by reshape. Convolution kernels directly GLSL could potentially provide speed gains I'm sure, but I can't even imagine writing it for tensors of arbitrary shape.

Check out the Winograd optimisations used in Nervana's neon - very fast

https://www.nervanasys.com/winograd-2/

Post reply on HN