Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Just for fun, I've implemented a Convolutional Neural Network (CNN) that predicts handwritten digits... Fully using #glsl and fragment shaders! The model exactly has 2023 parameters and its inner activations are displayed as you draw Try it out live!

118,358 Aufrufe • vor 3 Jahren •via X (Twitter)

9 Kommentare

Profilbild von Sebastian Aaltonen
Sebastian Aaltonenvor 3 Jahren

Nice! To improve the recognition, you should randomly offset the training data. The NIST data is centered. If you offset the data the network learns to detect non-centered digits too.

Profilbild von kishimisu
kishimisuvor 3 Jahren

Thanks! I did try data augmentation and had way better results in python, but when converting the model to glsl I decided to downscale it a lot to reduce compilation time (it started with 70x more parameters) and it became too small to handle augmented data

Profilbild von Panthaa / Yohan Bensemhoun
Panthaa / Yohan Bensemhounvor 3 Jahren

6 is a problem ;)

Profilbild von kishimisu
kishimisuvor 3 Jahren

Indeed, this is the model’s weak spot! I had to make compromises between the model size and accuracy in order to make it work smoothly inside glsl shaders. 2023 trainable parameters is order of magnitudes lower than typical CNN implementations for this task!

Profilbild von Luky - A$AP Luky
Luky - A$AP Lukyvor 3 Jahren

@__jrm_filipe Niiice! For a reason I never get to have the 6 predicted

Profilbild von kishimisu
kishimisuvor 3 Jahren

@__jrm_filipe Yes this is the weak spot of this very tiny model!

Profilbild von FuckTheAlgo
FuckTheAlgovor 3 Jahren

@mayfer The visualization is super sick

Profilbild von FuckTheAlgo
FuckTheAlgovor 3 Jahren

@mayfer Is reimplementing papers in shadertoy the best way to learn 🤔

Profilbild von kishimisu
kishimisuvor 3 Jahren

@mayfer Not sure if it’s the best way ahah but it definitely made me understand more profoundly how CNNs work as I had to implement every step from scratch

Ähnliche Videos

Fukushima's video (1986) shows a CNN that recognises handwritten digits [3], three years before LeCun's video (1989). CNN timeline taken from [5]: ★ 1969: Kunihiko Fukushima published rectified linear units or ReLUs [1] which are now extensively used in CNNs. ★ 1979: Fukushima published the basic CNN architecture with convolution layers and downsampling layers [2]. He called it neocognitron. It was trained by unsupervised learning rules. Compute was 100 times more expensive than in 1989, and a billion times more expensive than today. ★ 1986: Fukushima's video on recognising hand-written digits [3]. ★ 1988: Wei Zhang et al had the first "modern" 2-dimensional CNN trained by backpropagation, and also applied it to character recognition [4]. Compute was about 10 million times more expensive than today. ★ 1989-: later work by others [5]. REFERENCES (more in [5]) [1] K. Fukushima (1969). Visual feature extraction by a multilayered network of analog threshold elements. IEEE Transactions on Systems Science and Cybernetics. 5 (4): 322-333. This work introduced rectified linear units or ReLUs, now widely used in CNNs and other neural nets. [2] K. Fukushima (1979). Neural network model for a mechanism of pattern recognition unaffected by shift in position—Neocognitron. Trans. IECE, vol. J62-A, no. 10, pp. 658-665, 1979. The first deep convolutional neural network architecture, with alternating convolutional layers and downsampling layers. In Japanese. English version: 1980. [3] Movie produced by K. Fukushima, S. Miyake and T. Ito (NHK Science and Technical Research Laboratories), in 1986. YouTube: [4] W. Zhang, J. Tanida, K. Itoh, Y. Ichioka. Shift-invariant pattern recognition neural network and its optical architecture. Proc. Annual Conference of the Japan Society of Applied Physics, 1988. First "modern" backpropagation-trained 2-dimensional CNN, applied to character recognition. [5] J. Schmidhuber (AI Blog, 2025). Who invented convolutional neural networks?

Jürgen Schmidhuber

705,664 Aufrufe • vor 7 Monaten