Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Month 3 — Exercises set

🟢 Easy

PyTorch Basics

  1. Create 5 tensors of different shapes and output their shape, dtype, device attributes.
  2. Compute gradients for simple functions with requires_grad=True.
  3. Create an nn.Module subclass — input → 3 hidden → output.

Training

  1. MLP 95%+ accuracy on MNIST.
  2. Compare optimizers: SGD, SGD+momentum, Adam, AdamW.
  3. Try learning rates 1e-1, 1e-3, 1e-5 to see the effect.

CNN

  1. Train SimpleCNN on CIFAR-10 (5 epochs).
  2. Load pretrained ResNet-18, classify an ImageNet image.
  3. Create an augmentation pipeline with torchvision.transforms.

RNN/LSTM

  1. Compare nn.RNN, nn.LSTM, nn.GRU on the same task.
  2. Next-step forecasting for sin function.
  3. Create a Bidirectional LSTM, difference from plain LSTM.

🟡 Medium

Production-ready training

  1. Full training pipeline: Mixed precision + early stopping + checkpoint + W&B logging.
  2. Hyperparameter tuning: Optuna for a PyTorch model.
  3. Multi-GPU(using Colab Pro or Kaggle): nn.DataParallel.

Transfer learning

  1. Flower classification: 102 types of flowers — pretrained EfficientNet, 92%+ accuracy.
  2. Custom domain: Collect your own images (phone camera), 5 classes, 50 images per class — use transfer learning.
  3. Few-shot learning: Try to get 90%+ accuracy with 5 images per class.

Time series

  1. Real stock data(yfinance): LSTM + sliding window forecasting.
  2. Multivariate: LSTM with multiple features (price, volume, indicators).
  3. Prophet vs LSTMcomparison.

Text

  1. IMDB sentiment: 85%+ accuracy with LSTM.
  2. News classification: 4-5 categories (AG News).
  3. Char-level language model: On Shakespeare or Uzbek text.

🔴 Hard

1. Production ML API

  • Image classification (EfficientNet) FastAPI
  • Multi-stage Dockerfile (build → runtime)
  • Async batching (time and GPU optimization)
  • Healthcheck, metrics endpoint
  • Load test (with Locust): optimization that can sustain 100 req/s

2. Distributed training

  • Kaggle Notebooks Pro or Colab Pro
  • 2 GPUs with DistributedDataParallel
  • Mixed precision + gradient accumulation
  • Compare training time with single GPU

3. Model interpretation service

  • Image classification with ResNet
  • Endpoint that also returns Grad-CAM
  • Streamlit or React UI

4. End-to-end CV pipeline

  • Data: collecting images from the web (Selenium or API)
  • Labelling (Label Studio or manual)
  • Training (PyTorch + W&B)
  • Deploying (FastAPI + Docker + Nginx)
  • Monitoring (Prometheus + Grafana)

Mini-projects

Mini-project 1: Plant Disease Detector

  • Dataset: PlantVillage (Kaggle)
  • Transfer learning with 95%+ accuracy
  • Mobile-friendly (TFLite or PyTorch Mobile)
  • Streamlit demo

Mini-project 2: Real-time Pose Estimation

  • MediaPipe or MMPose
  • Webcam streaming
  • WebSocket + FastAPI

Mini-project 3: Music Genre Classifier

  • GTZAN dataset
  • Mel-spectrogram + CNN
  • FastAPI: audio upload → genre

Mini-project 4: Time Series Anomaly Detection

  • Server metrics (CPU, RAM)
  • LSTM autoencoder
  • Real-time alert system

Quiz

Fundamentals

  1. How does backpropagation work (chain rule)?
  2. What is vanishing gradient and how is it solved?
  3. Relationship between batch size and learning rate?
  4. Why ReLU > Sigmoid (in modern NNs)?
  5. What does Dropout do during test?

PyTorch

  1. Difference between model.eval() and torch.no_grad()?
  2. What does state_dict() save?
  3. Effect of num_workers and pin_memory in DataLoader?
  4. When does mixed precision (AMP) help?
  5. Pros/cons of TorchScript and ONNX export?

CNN

  1. Why are 3x3 kernels widely used?
  2. When do you use Max vs Average pooling?
  3. Why is ResNet’s skip connection used?
  4. What is EfficientNet’s compound scaling?
  5. What is receptive field and how is it computed?

RNN

  1. Difference between RNN and Feedforward NN?
  2. LSTM gates and their roles?
  3. When does Bidirectional RNN help?
  4. Why gradient clipping is critical for RNN?
  5. Reasons for moving from RNN to Transformer?

✅ Month 3 final checklist

  • Wrote a simple NN with pure NumPy
  • nn.Module and training loop in PyTorch
  • Familiarity with TensorFlow/Keras
  • Image classification with CNN (CIFAR-10 or similar)
  • Transfer learning (with pretrained model)
  • Sequence task with RNN/LSTM (time series or text)
  • Experiment tracking in W&B or TensorBoard
  • DL model serving in FastAPI (CPU or GPU)
  • Capstone project on GitHub
  • LinkedIn post

Congratulations! Moving on to Month 4 — Computer Vision + NLP.