Exp 6 — Conv layers performance (MNIST)

Record-ready template Fill placeholders with your dataset, code, outputs, plots, and viva.
AIML355 • Fundamentals of Deep Learning Lab

EXP06 — Effect of Convolution Layers on MNIST

Record-ready template Replace placeholders with your final work (code + outputs + screenshots).
Submission checklist
Aim ✓ • Environment ✓ • Dataset ✓ • Procedure ✓ • Code ✓ • Output ✓ • Discussion ✓ • Viva ✓

1) Aim

To study performance using convolution layers in Python (MNIST dataset).

Learning outcomes
  • Implement baseline dense model vs CNN model for MNIST.
  • Vary conv layer depth/filters and observe accuracy/training time.
  • Plot and compare learning curves and final metrics.

2) Requirements / Environment

Software
  • Python 3.10+ (recommended)
  • TensorFlow/Keras (or PyTorch where applicable)
  • NumPy, Pandas, Matplotlib
  • Jupyter/Colab optional
Hardware
  • CPU is OK for small runs; GPU optional
  • RAM: 4–8 GB+ recommended
Reproducibility
Record library versions and random seed in your final report.

3) Dataset

  • Source: Use a relevant dataset and cite the source in your report.
  • Features/Labels: [Describe X and y; mention classes if classification]
  • Split: [Train/Validation/Test or K-fold]
  • Preprocessing: [Scaling/Normalization, resizing, tokenization, etc.]

4) Procedure / Steps

  1. Load dataset and perform preprocessing.
  2. Define model architecture and justify key choices.
  3. Compile model (loss + optimizer + metrics).
  4. Train with validation and log curves.
  5. Evaluate on test set and compute required metrics.
  6. Summarize observations and limitations.
Model hint
Compare: (A) MLP baseline, (B) CNN with 1–3 conv blocks.

5) Code (Skeleton)

Paste your complete runnable code below (or attach notebook link in the final submission).

import tensorflow as tf
from tensorflow import keras

# TODO: load MNIST
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data()
x_train = x_train[..., None]/255.0
x_test  = x_test[..., None]/255.0

# Baseline (MLP)
mlp = keras.Sequential([
  keras.layers.Input(shape=(28,28,1)),
  keras.layers.Flatten(),
  keras.layers.Dense(128, activation='relu'),
  keras.layers.Dense(10, activation='softmax')
])

# CNN
cnn = keras.Sequential([
  keras.layers.Input(shape=(28,28,1)),
  keras.layers.Conv2D(32,3,activation='relu'),
  keras.layers.MaxPooling2D(),
  keras.layers.Conv2D(64,3,activation='relu'),
  keras.layers.MaxPooling2D(),
  keras.layers.Flatten(),
  keras.layers.Dense(128, activation='relu'),
  keras.layers.Dense(10, activation='softmax')
])

6) Results / Output

  • Metrics: [Write your final values: accuracy/F1 or MAE/MSE]
  • Plots: [Attach loss/metric curves; prediction vs actual plots if forecasting]
  • Screenshots: [Paste screenshots of outputs, confusion matrix, sample predictions]

7) Observations / Discussion

  • [Observation 1: what changed when you tuned epochs/batch size?]
  • [Observation 2: evidence of overfitting/underfitting?]
  • [Observation 3: what improved performance (augmentation, regularization, fine-tuning)?]

8) Conclusion

Write 3–6 lines summarizing what you implemented, key result, and what you learned.

9) Viva Questions

  1. Compare MLP vs CNN for MNIST. Why CNN usually performs better?
  2. How does number of filters affect capacity?
  3. What is the difference between training and validation data?
  4. Explain overfitting and two ways to reduce it.
  5. Why do we normalize/scale inputs?
  6. What does batch size and epoch mean?
  7. How do you choose a loss function for a task?

10) Post-lab Assignment

  • Try 1 conv block vs 2 vs 3 and compare accuracy/time.
  • Try different kernel sizes (3x3 vs 5x5).
Tip: press Esc to close.