Use concept whitening combined with the ResNet50 model to distinguish bird species using important features.
Team members: Alex Katopodis, Hung Le, Islina Shan Mentor: Prof. Cynthia Rudin, Duke University
Related research: Concept Whitening
Follow the instructions below to set up the environment, prepare the dataset, and run the training script.
The paths to this repository and the CUB dataset may contain sensitive information, hence they will be supplied to the scripts via a secrets.txt
file. In the slurm_scripts
directory, create a secrets.txt
file in the exact same format as the provided example sample_secrets.txt
.
It's recommended to use a virtual environment to install and manage the many Python dependencies in this project.
-
In this directory, run
python3 -m venv .venv source .venv/bin/activate pip3 install -r requirements.txt
-
If you have not already done so, set the variable
VENV_PATH
insecrets.txt
to be the absolute path to your virtual environment.
- Download and extract the CUB dataset here. Make sure to move or copy the file
attributes.txt
inside theattributes
directory inside the dataset if it is not already there. - Set the variable
CUB_PATH
insecrets.txt
to be the absolute path to your downloaded dataset. - In this directory, run
or, if you are using slurm,
./slurm_scripts/make_data.sh
sbatch slurm_scripts/make_data.sh
Note
Remember to make this script executable by running
sudo chmod +x slurm_scripts/make_data.sh
To train the model, run the following command
./slurm_scripts/train.sh
or, if you are using slurm,
sbatch slurm_scripts/train.sh
Note
Remember to make this script executable by running
sudo chmod +x slurm_scripts/make_data.sh
Note
Ensure you have enough disk space and memory to handle the dataset and model training.
The training script will save model checkpoints and logs in the checkpoints/
and logs/
directories, respectively.
You can adjust all the training parameters in config.yaml
as needed.