Stack: Python, Keras, TensorFlow, NumPy, pandas, PyTorch, Hugging Face Transformers, Google Colab · Repo: Axeloooo/Deep-Learning-and-Neural-Networks-with-Keras
Problem
This collection starts one level below the framework, with a hand-built forward pass and a NumPy backpropagation loop, and then climbs to Keras one task at a time: tabular regression, image classification, convolutional networks, sequence-to-sequence with attention and image captioning.
There is no application, package or test suite. The deliverable is eight notebooks meant to run in Google Colab, with committed outputs for the numeric ones. The last two keep blank practice exercises, so the VGG16 and BLIP notebook only runs fully once its task cells are filled in.
Architecture diagram
Google Colab runtime (each notebook stands alone; order = learning path)
1 forward-propagation (NumPy)
2 backward-propagation (XOR, NumPy)
3 activation functions and plots
4 regression with Keras <-- concrete-strength CSV
5 MNIST classification, Dense <-- keras.datasets.mnist
6 CNN: Conv2D + MaxPool <-- keras.datasets.mnist
7 LSTM encoder-decoder + SelfAttention layer
8 frozen-base classifier head + BLIP captioning layer
^ ^
| |
aircraft-damage Salesforce/blip-image-captioning-base
image archive (Hugging Face)
push to main --> semantic-release --> GitHub releaseThe attention notebook uses a custom scaled dot-product SelfAttention layer with decoder outputs as queries and encoder outputs as keys and values, on top of an LSTM encoder-decoder. Its filename says "transformers", but it is not a Transformer. Notebook 8 defines a frozen-base classifier head (512-512-1 with dropout 0.3) and wraps BLIP as a custom Keras layer with tf.py_function; loading VGG16 and training are left as exercises.
Key decisions
- From scratch first. The first two notebooks implement the forward pass, sigmoid, error and weight updates in NumPy before any Keras appears.
- Colab as the supported runtime. The
!pip installcells stay commented out and Colab's preinstalled environment is used; there is no lockfile. - Reproducibility. Fixed seeds in the XOR and captioning notebooks, a rerunnable label-encoding cell in the CNN notebook, and committed outputs so results can be read without executing anything.
- Small, deliberate experiments. Regression compares a 2-layer and a 5-layer network; the CNN notebook varies block count, batch size and epochs; the Dense classifier is saved, reloaded and trained further.
Challenges
- Honest comparisons. The regression runs use different validation splits (0.3 and 0.1) and single runs, and the MNIST notebooks pass the test set as validation data, so the numbers below are monitoring figures, not controlled benchmarks.
- Custom pieces inside Keras. Cross-attention is a hand-written
Layer, and BLIP (a PyTorch model) is wrapped as a Keras layer throughtf.py_function. - Release automation on a notebook repo. The semantic-release workflow checks out full history (
fetch-depth: 0) and uses the Conventional Commits preset so it can read commit messages.
Results
Committed notebook outputs, which illustrate the runs rather than serve as benchmarks:
- XOR in NumPy: final outputs of about 0.0096, 0.9918, 0.9918 and 0.0084 for targets 0, 1, 1, 0, after 180,000 epochs.
- Concrete-strength regression: a 1,030-row dataset; validation loss ends at 132.4 for the 2-layer model and 14.5 for the 5-layer model, on different splits.
- MNIST Dense classifier: 98.11% accuracy, 98.16% after 20 further epochs.
- CNN: between 98.07% and 98.86% across four batch-size and depth configurations.
- The attention and VGG16/BLIP notebooks have no committed outputs, so no figures are quoted for them.