r/webdev • • 7h ago

Showoff Saturday Neural Canvas, CNN Visualization

Neural Canvas, CNN Visualization

Neural Canvas can now recognize basic shapes like apples, moons, cars, and more using Google's Quick, Draw! dataset.

20 classes with 1,000 samples per class

2 convolutional layers with 16 and 32 filters

2 fully connected layers with 60 and 40 neurons

91% test accuracy

Trained using JAX on Google Colab

Neural Canvas can visualize CNN feature maps in real time while drawing, showing how convolutional layers extract features from input images.

Built using p5.js for visualization and Math.js for neural network computations.

Select Model 7 to try the CNN trained on Google's Quick, Draw! dataset.

Any feedback is welcome!

GitHub: https://github.com/MuhammadEssa2002/neural_canvas

Live demo: https://muhammadessa2002.github.io/neural_canvas/

45 Upvotes

9 comments sorted by

3

u/ResidentPomegranate6 6h ago

solid. watch out splitting quick draw randomly though, samples from one doodle leak across train and test, split by drawing id instead.

1

u/Muhammad-Essa 6h ago

Thanks for the feedback! I used a random split, with 80% of the data for training and 20% for testing. I honestly hadn't considered the possibility of data leakage between the training and testing sets. I'll definitely investigate this. Thanks again for bringing this to my attention, sir!

1

u/TheMR-777 6h ago

It feels like the neural network works like a casino, where each node places a bet on what it believes it sees.

1

u/Muhammad-Essa 6h ago

Interesting analogy! But actually explaining how a neural network works internally is quite difficult.

We can somewhat explain how CNNs work. During training, the network learns to detect useful features such as edges, strokes, and patterns. It learns parameters (weights and biases) that help it recognize these features. These learned parameters are then applied to the input through mathematical operations such as matrix multiplication and convolution, eventually producing probabilities for different classes.

However, explaining exactly how a neural network learns these representations and why particular neurons respond to certain patterns is still a very challenging problem. We can understand the mathematics behind the operations, but understanding what is happening internally is a different story.

1

u/TheMR-777 3h ago

Ah, I see. This reminds me of the concept of "collective intelligence," where individual elements may not be intelligent on their own, but together they exhibit emergent intelligence.

Of course, I am not good enough with AI :) and not know the intrinsics, but I am trying to have an intuition for it.

Also, thanks for the explanation, pal. It was insightful indeed,

1

u/dusty_world_666 6h ago

Oddly satisfying

1

u/Ok_Party_4101 6h ago

Watching the first conv layer pick up edges in real time while drawing is super intuitive. Honestly one of the cleanest ways to explain how CNNs actually work.

1

u/SimpleFixSolutions 4h ago

Great for when I forget what a leaf is called lol. Good thing it recognises bad drawings