Skip to content

JannesB24/udl_project

Repository files navigation

Note: This project requires Python 3.11 or higher.

Python License: MIT Code style: ruff

udl_project

This repository was created for the seminar "Understanding Deep Learning" which took place in the summer term of 2025 at the University of Osnabrück.

What this repository shows

This project demonstrates a small residual network (ResNet) that initially struggles to accurately classify the dataset mentioned in the prerequisites. Various regularization techniques are applied and compared to improve its performance. The goal is to showcase a comprehensive comparison of different regularization techniques and their impact on the model's performance.

  • L2 Regularization (Section 9.1.2 from book)
  • Early Stopping (Section 9.3.1 from book)
  • Ensembling (Section 9.3.2 from book)
  • Dropout (Section 9.3.3 from book)
  • Data Augmentation (Section 9.3.8 from book)

Dataset

A flower dataset will be downloaded from kaggle via the kagglehub python package. For transfer learning a tiny food dataset will be used.

Project Setup

.
├── Makefile (*project setup on Linux based systems*)
├── README.md
├── artifacts (*place to store output from the project e.g. stored model*)
│   ├── (various artifacts)
├── infrastructure (*(pinned) dependencies*)
│   ├── requirements-dev.txt
│   ├── requirements.in
│   └── requirements.txt
├── master_comparison.ipynb
├── pyproject.toml
├── test_augmentation.ipynb
└── udl_project (source code)

To create the tree view, run:

tree -I '.*|*data*'

Ignoring hidden and explicitly named files.

Notebook

The top-level notebook master_comparison.ipynb contains the plots from all implemented trained models with their regularization technique with a given EPOCHS.

Code Setup

We strongly recommend a Linux-based system. If you are using Windows, consider installing WSL to use a Linux subsystem on Windows. We suggest using the latest Ubuntu.

✅ Make should come pre-installed.

🚀 To set up the project, execute:

make setup

This creates a local virtual environment (.venv) and installs the required dependencies as listed in infrastructure/requirements.txt into it.

To set up the project on Windows, see the instructions in the Code Setup section above.

Running the Code

The project can be executed by running the udl_project/master_comparison.py script.

python -m udl_project.master_comparison

Troubleshooting (If Nothing Works)

If the convenience setup does not work, you can set up the project manually by following these instructions:

python -m venv .venv # assuming python is installed properly
source .venv/bin/activate
pip install --upgrade pip
pip install -r infrastructure/requirements.txt

Development Setup

We strongly recommend a Linux based system. If you are using Windows consider installing WSL to use a Linux subsystem on Windows. We suggest using the latest Ubuntu.

✅ Make should come pre-installed.

🛠️ Install uv using pipx as described in the official documentation.

🚀 To set up the project, execute:

make setup-dev

This installs the additional development dependencies as listed in infrastructure/requirements-dev.txt.

To activate the pre-commit hooks, run:

pre-commit install

This will help you maintain clean code with each commit.

To run the pre-commit hooks manually, execute:

pre-commit run --all-files

or

make run-pc

To set up the project on Windows, see the instructions in the Development Setup section above.

Help wanted for Windows setup

If you have gone through the setup and are still searching for a Windows solution, you have found the right place.

If you are truly interested in using Windows (my sincerest condolences, though AMD GPUs are also challenging in WSL) and manage to get the repository running, please help us by contributing to the project. If interested, look for the maintainer names on studip (no emails in repos 🤐) and contact them to get access.

We acknowledge the feedback that it probably will not work on Windows.

AI usage disclaimer

GitHub Copilot is being used in this project for the following purposes:

  • Automatically reviewing Pull Requests, creating commit messages, descriptions.
  • Suggestions for documentation
  • Giving explanation on code snippets
  • Support with arising bugs

The idea and the work on the code itself is the work of the authors.

About

This repository was created for the seminar "Understanding Deep Learning," which took place in the summer term of 2025 at the University of Osnabrück.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors