- compute_feature_activations.py -> runs 1 iteration on frozen model and gets the last layer activations
- spuriosity_metrics.py -> z-score spuriosity calculation
- test_process_feature_labels.ipynb -> Unit tests notebook to explore the functionality of this module.
- annotations_processor.py -> takes as input multi-human labeling results for each (feature,class) pair and aggregates it class-wise.
- test_spuriosity_calculation.ipynb -> Unit tests notebook to explore the functionality of this module.
https://github.com/mmoayeri/spuriosity-rankings/blob/main/spuriosity_rankings.py
First try:
conda env create -f full_conda_without_builds_environment.yml
Second try:
conda env create -f conda_environment.yml
Third try:
Some packages might not be available on conda, use below if that's the case.
pip install -r pip_requirements.txt
wget -O robust_resnet50.pth https://www.dropbox.com/s/knf4uimlqsi1yz8/imagenet_l2_3_0.pt?dl=0
- The train is binned as bottom 100, top 100 and medium 100 as sorted by spuriosity.
- For val there's only 50 images per class, so it's sorted as bottom 25 percentile, 25-75 percentile and 75 and above percentile.