This repository contains the source code for my master's thesis on "A Quantitative Evaluation of Representational Similarity Analysis in Image Classification Networks", submitted in the Department of General Psychology at the University of Giessen in partial fulfillment of the requirements for the degree of Master of Science in "Mind, Brain and Behavior".
This section will guide you through setting up the project locally.
- Python 3.11.9 (or higher)
- Poetry 2.1.0 (or higher)
- Git (optional, for cloning the repository)
This project uses Poetry for dependency management. If you don't have Poetry installed, you can install it using one of the following methods:
curl -sSL https://install.python-poetry.org | python3 - --version 2.1.0
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - --version 2.1.0
The official installer creates a poetry wrapper in a platform-specific directory:
- Unix →
$HOME/.local/bin - Windows →
%APPDATA%\Python\Scripts
In order to invoke Poetry as poetry, you can add the appropriate directory to your $PATH variable. Once Poetry is properly installed and in your $PATH, run
poetry --version
to check that everything is working as expected.
For detailed installation instructions and troubleshooting, visit the Poetry documentation.
Configure Poetry to not create its own virtual environments:
poetry config virtualenvs.create false
-
Clone the repository (or download and extract the ZIP file):
git clone https://github.com/mrvnthss/rsa-vision-networks.git cd rsa-vision-networks -
Set up a virtual environment using your preferred tool, e.g., using pyenv and the pyenv-virtualenv plugin:
pyenv install 3.11.9 pyenv-virtualenv 3.11.9 rsa-vision-networks-3.11.9 pyenv local rsa-vision-networks-3.11.9 -
Activate the virtual environment:
pyenv activateNote: If the pyenv-virtualenv plugin has been set up in the shell configuration (i.e.,
eval "$(pyenv virtualenv-init -)"is included in the configuration file), the virtual environment will automatically be activated once it has been set up as outlined in the steps above. -
Install dependencies using Poetry:
poetry installThis will install all required dependencies listed in
pyproject.tomlusing the exact versions specified in thepoetry.lockfile.
rsa-vision-networks/
├── data
│ ├── processed
│ └── raw
├── models
├── notebooks
│ ├── 0.2-mt-misc.ipynb
│ ├── 1.1-mt-basic-training-routine.ipynb
│ ├── 2.0-mt-parsing-tensorboard-data.ipynb
│ ├── 3.0-mt-pre-trained-weights.ipynb
│ ├── 4.12-mt-data-analysis-lenet-fashionmnist.ipynb
│ ├── 5.4-mt-rsa-lenet-fashionmnist.ipynb
│ ├── 6.3-mt-differentiable-spearman.ipynb
│ ├── 7.1-mt-rsa-modified-lenet-fashionmnist.ipynb
│ ├── 8.0-mt-optuna-studies.ipynb
│ ├── 9.2-mt-analyzing-results-main-experiments.ipynb
│ └── hist
├── out
├── reports
│ ├── data
│ └── figures
├── src
│ ├── base_classes
│ ├── conf
│ │ ├── criterion
│ │ ├── dataset
│ │ ├── experiment
│ │ ├── main_scheduler
│ │ ├── model
│ │ ├── optimizer
│ │ ├── optuna
│ │ ├── performance
│ │ ├── repr_similarity
│ │ ├── transform
│ │ ├── warmup_scheduler
│ │ ├── compute_dataset_stats.yaml
│ │ ├── test_classifier.yaml
│ │ ├── train_classifier.yaml
│ │ ├── train_classifier_cv.yaml
│ │ ├── train_classifier_optuna.yaml
│ │ ├── train_similarity.yaml
│ │ └── train_similarity_cv.yaml
│ ├── dataloaders
│ ├── datasets
│ ├── models
│ ├── rsa
│ ├── schedulers
│ ├── training
│ ├── utils
│ ├── visualization
│ ├── __init__.py
│ ├── compute_dataset_stats.py
│ ├── config.py
│ ├── test_classifier.py
│ ├── train_classifier.py
│ ├── train_classifier_cv.py
│ ├── train_classifier_optuna.py
│ ├── train_similarity.py
│ └── train_similarity_cv.py
├── LICENSE
├── optuna_studies.sqlite3
├── poetry.lock
├── pyproject.toml
└── README.md
data/→ Image datasets used in the project.models/→ Model checkpoints along with corresponding training configurations and log files.notebooks/→ Jupyter notebooks for data exploration, analysis, and visualization.out/→ Output files (logs, checkpoints) generated when running experiments.reports/→ Figures created for the thesis, raw data from simulations.src/→ Source code for the project.LICENSE→ MIT License file.optuna_studies.sqlite3→ SQLite database containing the results of hyperparameter optimization studies.poetry.lock→ Dependency lock file automatically created by Poetry.pyproject.toml→ Project configuration file for dependency management with Poetry.
Important
The directories data/, out/, and report/data as well as the optuna_studies.sqlite3 database are not included in this repository. Raw image data are automatically downloaded and placed in the data/ directory when datasets are first initialized. Output files such as model checkpoints, log files, TensorBoard logs, and simulated data, as well as the SQLite database optuna_studies are available for download from Zenodo.
- PEP8 formatting
- Generally following the Google Python Style Guide
- Maximum line length of 99 characters (72 characters for docstrings) in source code
- Maximum line length of 119 characters in Jupyter notebooks
This project is licensed under the MIT License. The MIT License is a permissive free software license that offers significant freedom to use, modify, distribute, and sell the software and its derivatives, with minimal restrictions. Key points of the MIT License include:
-
Permission to Use: You are free to use the software for any purpose, including commercial applications.
-
Permission to Modify: You have the right to modify the software in any way you see fit.
-
Permission to Distribute: You can distribute the software and your modifications to anyone, under the same license terms.
-
Permission to Sublicense: You can grant a sublicense to modify and distribute the software to others under your own terms.
-
No Warranty: The software is provided "as is", without warranty of any kind.
To comply with the MIT License, you must include the original copyright notice and the license text with any substantial portions of the software you distribute. The simplicity of the MIT License promotes open and unrestricted adoption and reuse of software.
For more detailed information, please review the full LICENSE text.
