This repository contains official PyTorch ClusterFix implementation (WACV 2024) paper. Our proposal is an effective unsupervised debiasing framework that uses a re-weighting strategy based on cluster membership loss to mitigate bias signals.
In the first step, feature embeddings are extracted through a self-supervised or pretrained CNN to obtain pseudo labels. More in details:
- i) We trained a self-supervised network for features extraction
- ii) We applied k-means to obtain pseudo-labels
In a second step, the pre-trained model is fine-tuned using a multi-head approach: one head classify task-labels while the others the pseudo-labels:
- i) We used both target and pseudo label cross-entropy losses in the optimization process
- ii) The importance weight of each cluster is computed by the average of the both target and pseudo losses values of the elements it contains. The cluster weight then is updated at each iteration by averaging the previous step value with a momentum.
- iii) For each sample, we modulate the target-loss value with the weight of the cluster to which the sample belongs
- Install Dependecies
cd <repository>
conda create --name <env> --file requirements.txt
We provide two simple scripts to replicate our experiments. Default configurations for the ClusterFix experiments are in the configurations/ directory
- Set dataset folder "data_root" (es. "$root/data/" for CelebA or "$root/data/waterbird_complete95_forest2water2/ for Waterbirds"
- Set "checkpoint_root" for logging (es. "$root/experiments")
- "target_attr" for CelebA [Double_Chin, Wearing_Necklace, Chubby...]
- "target_attr" for Waterbirds [Object, Place]
- You can launch the training script:
run.py "./configutations/run_cfix_celebA"
@inproceedings{capitani2024clusterfix,
title={ClusterFix: A Cluster-Based Debiasing Approach without Protected-Group Supervision},
author={Capitani, Giacomo and Bolelli, Federico and Porrello, Angelo and Calderara, Simone and Ficarra, Elisa},
booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
pages={4870--4879},
year={2024}
}
Pseudo Attributes BPA