This repository contains code for the spatial probes presented in Dual Computational Systems in the Development and Evolution of Mammalian Brains.
Tested in Python 3.10 with the following requirements:
pip install -q numpy pandas scipy scikit-learn matplotlib seaborn pillow ipykernel torch torchvision torchaudio altair datasets numba numbasom==0.0.5 tensorboard pysal vl-convert-python soundfile
apt-get install -y ffmpeg # required for audio model
Run sample experiments:
python main.py --fast
This will produce 5x5 unit SOM maps and receptive fields saved to output/ in about 5 minutes on a M1 Macbook Air on CPU. Alternatively, you can run the full 25x25 unit SOM displayed in the paper in about 2 hours with:
python main.py
For convenience, saved weights are used for Olfaction, Somatosensation, and TEM models but these can be retrained with:
python setup_base_models.py
Retraining Olfaction and Somatosensation requires 20gb of memory, and completes in ~10 minutes on an RTX 4090 GPU. The TEM model is much slower, requiring 4-6 hours. You can select which models to retrain in the config.py file. By default, TEM will not be retrained.
├── analysis/ # SOM computation and descriptive statistics
├── models/ # Model probing (organized by modality)
├── output/ # Saved experimental outputs
├── quickstart.ipynb # Basic experiment examples
├── main.py # Main experiment runner
├── setup.py # Download/train base models
└── config.py # Hyperparameter configuration
The main contribution of this repository is standardizing an interface to probe inputs across modalities. This wouldn't be possible without excellent existing repositories for each modality. While the paper contains the full list of citations, there are a handful of repositories that were particularly helpful for making this code, they are:
- Vision Model 👁️
- Olfaction Model 👃
- Touch Model 🖐️
- Memory Model 🧠
- Audio Model 👂
- Calculating SOMs 🗺️
If you find this repository helpful, please consider citing our paper:
@article {Imam2024.11.19.624321,
author = {Imam, Nabil and Kielo, Matthew and Trude, Brandon M. and Finlay, Barbara L.},
title = {Dual Computational Systems in the Development and Evolution of Mammalian Brains},
year = {2024},
doi = {10.1101/2024.11.19.624321},
publisher = {Cold Spring Harbor Laboratory},
URL = {https://www.biorxiv.org/content/early/2024/11/19/2024.11.19.624321},
}