Skip to content

About

This Repository contains the lab Programs for On-Going Deep Learning Lab (CSL DC302 J26) Summer 2026

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Repository contains the lab Programs for On-Going Deep Learning Lab Practicals (CSL DC 302 J26) Summer 2026

Python 3.12+ uv 0.8.19 PyTorch 2.11.0

Practicals

Topic: Perceptron and MLP practicals

Practical Name Jupyter Notebook
1. Single-layer perceptron on synthetic data Write a Python program using PyTorch to:

(a) Generate a 2D linearly separable dataset using make_blobs or make_classification.

(b) Implement a single‑layer perceptron with nn.Linear, train it using gradient descent, and plot the decision boundary.

Practical 01
2. Perceptron for MNIST 0 vs 1

Write a program using PyTorch and torchvision.datasets.MNIST to:

(a) Load only digits 0 and 1, flatten each image to a vector.

(b) Train a single‑layer perceptron with sigmoid activation to classify 0 vs 1 and print training and test accuracy.

Practical 02
3. Multilayer perceptron for full MNIST Write a PyTorch program to:

(a) Load the full MNIST dataset with DataLoader.

(b) Build an MLP with at least two hidden layers and ReLU, train it with cross‑entropy loss, and report accuracy and confusion matrix on the test set.​

Practical 03
4. Manual backprop vs autograd

Write a program that:

(a)Creates a tiny 2‑2‑1 network for binary classification on a small synthetic dataset.

(b) Computes gradients manually in NumPy/PyTorch, then compares them with gradients obtained from loss.backward() to verify correctness.

Practical 04
5. Effect of learning rate and initialization

Using the MLP from Practical 3, write a program that:

(a) Trains the same model with at least three different learning rates and two different initializations.

(b) Logs and plots loss curves, and prints a short text summary comparing convergence behavior.

Practical 05
6. Optimizer comparison: SGD, momentum, RMSProp, Adam

Extend the MNIST MLP program to:

(a) Train the same model separately with SGD, SGD+momentum, RMSProp, and Adam.

(b) For each optimizer, plot training and validation loss vs epochs and tabulate final test accuracy.​

Practical 06
7. Regularization: L2, dropout, and early stopping

Write a program that:

(a) Adds L2 weight decay and dropout layers to the MLP.

(b) Implements early stopping based on validation loss and compares three runs: no regularization, L2 only, L2+dropout+early stopping.

Practical 07
8. Bias-variance via model capacity

Write a PyTorch program to:

(a) Train three MLPs of different sizes (small, medium, very deep/wide) on a fixed train/validation split.

(b) Print training and validation accuracy for each model and comment in code or markdown which model is high‑bias, which is high‑variance.

Practical 08

Topic: CNN practicals

Practical Name Jupyter Notebook
9. First CNN vs MLP on MNIST

Write a program to:

(a) Implement a simple CNN (Conv–ReLU–MaxPool–FC) and train it on MNIST.

(b) Compare parameter count, training time per epoch, and accuracy with the MLP from Practical 3.

Practical 09 Practical 09 v2
10. LeNet-style CNN with feature-map visualization

Write a PyTorch program that:

(a) Implements a LeNet‑like architecture for MNIST and trains it.

(b) For a few test images, hooks into intermediate convolutional layers and saves the corresponding feature maps as images.

Practical 10
11. Deeper VGG-style CNN on CIFAR-10

Write a program to:

(a) Load CIFAR‑10 and implement a VGG‑style CNN (several conv–ReLU–pool blocks).

(b) Train for a few epochs, then modify the network to include batch normalization and show how training loss and accuracy improve.

Practical 11
12. Transfer learning with pretrained ResNet

Write a program using torchvision.models.resnet18 to:

(a) Load a pretrained ResNet‑18, freeze all convolutional layers, and replace the final FC layer for a 5‑ or 10‑class image dataset.

(b) Fine‑tune the last layers and compare training from scratch vs transfer learning in terms of accuracy and epochs needed.

Practical 12
13. Grad-CAM or saliency maps for CNN

Using the best CNN or transfer‑learning model, write a program to:

(a) Implement Grad‑CAM or simple input‑gradient saliency maps for a few images.

(b) Save and display heatmaps overlaid on input images to analyze what the network is focusing on.​

Practical 13

Topic: Autoencoder and regularization practicals

Practical Name Jupyter Notebook
14. Basic autoencoder on MNIST

Write a PyTorch program that:

(a) Implements a fully connected autoencoder with a low‑dimensional bottleneck.

(b) Trains it on MNIST, plots reconstruction loss vs epochs, and saves side‑by‑side original vs reconstructed images for a batch.​

Practical 14
15. Denoising autoencoder with noise injection

Extend the autoencoder program to:

(a) Corrupt input images with Gaussian or salt‑and‑pepper noise before feeding them to the encoder.

(b) Train the model to reconstruct clean images and visually compare noisy inputs and denoised outputs.

Practical 15
16. Variational autoencoder (VAE) for digit generation

Write a program that:

(a) Implements a simple VAE on MNIST with a 2‑D latent space.

(b) After training, samples points from the latent space to generate new images and visualizes a 2‑D latent space grid of generated digits.

Practical 16

Topic: RNN and sequence modeling practicals

Practical Name Jupyter Notebook
17. Character-level RNN language model

Write a PyTorch program to:

(a) Read a small text file (public‑domain book excerpt), build a character vocabulary, and prepare input–target sequences.

(b) Implement a simple RNN or GRU using nn.RNN/nn.GRU, train to predict the next character, and generate sample text by sampling from the model.​

Practical 17
18. LSTM for sentiment classification (IMDB)

Write a program that:

(a) Loads the IMDB sentiment dataset or a similar movie‑review dataset, tokenizes text, and pads sequences.

(b) Builds an embedding layer + LSTM + linear classifier, trains for sentiment prediction, and prints accuracy and confusion matrix.​

Practical 18
19. Bidirectional LSTM/GRU for sequence tagging

Write a PyTorch program to:

(a) Prepare a small POS‑tagging or NER dataset (toy or standard) as sequences of word indices with corresponding tag indices

(b) Implement a bidirectional LSTM/GRU for sequence labeling and compare token‑level accuracy with a unidirectional LSTM model.​

Practical 19

Topic: Generative models: RBM and DBN

Practical Name Jupyter Notebook
20. Restricted Boltzmann Machine and Deep Belief Network

Write a program (can reuse or adapt an open‑source implementation) to:

(a) Implement an RBM using PyTorch, train it on MNIST with contrastive divergence to learn hidden features.

(b) Stack multiple trained RBMs into a Deep Belief Network, freeze RBM weights, train a final classifier layer, and compare its test accuracy with a standard MLP.

Practical 20

Environment Setup (uv)

This repository uses the uv package manager.

  1. Install uv:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Create and sync the project environment from pyproject.toml and uv.lock:

    uv sync
  3. Run Jupyter Lab inside the managed environment:

    uv run jupyter lab

Recommended Development Setup by OS

The practicals were developed and tested on Windows WSL2, macOS, and Linux using uv.

Windows (Recommended: WSL2 + Ubuntu + uv)

  1. Open PowerShell as Administrator and install WSL with Ubuntu:

    wsl --install
  2. Restart Windows if prompted, open Ubuntu, and complete first-time Linux username/password setup.

  3. Verify your distro is using WSL2:

    wsl -l -v
  4. Open the project inside the WSL2 filesystem.

  5. Install uv in WSL2:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  6. Sync dependencies and run Jupyter Lab:

    uv sync
    uv run jupyter lab

Recommendation: Use this setup for best compatibility with these practicals.

For detailed setup, see Microsoft Learn: Install WSL.

macOS (uv setup)

  1. Install uv:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. From the repository root:

    uv sync
    uv run jupyter lab

Linux (uv setup)

  1. Install uv:

    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. From the repository root:

    uv sync
    uv run jupyter lab

Contributing

If you face any issues with any practical, feel free to open an issue or submit a pull request.

jerry and duck handshake

License

This project is licensed under the MIT License. See LICENSE.

About

This Repository contains the lab Programs for On-Going Deep Learning Lab (CSL DC302 J26) Summer 2026

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages