MDProp: Official Implementation of ACML 2023 Paper: "Advancing Deep Metric Learning With Adversarial Robustness"
The following software packages are required to use this repository:
- Python 3.6 or higher
- PyTorch 1.9 or higher
- torchvision
- numpy
- scikit-learn
Inside the parent directory, you'll find scripts for training and evaluating Deep Metric Learning models using MDProp and the multisimilarity loss. MDProp is implemented with three separate batch normalization layers, optimized for clean data, single-targeted adversarial data, and multi-targeted adversarial data. Optimal results are achieved with 5 attack targets in multi-targeted attacks.
Steps for Usage:
- Download the CUB200, CARS196, and SOP datasets and extract them to a suitable directory.
- Download the official PyTorch ResNet50 parameters from here and place them in the
paramsfolder. - Update the data paths (
--source_path) intrain.sh. - Run the
train.shscript. Results will be saved in theTraining_Resultsfolder.
Note: There may be minor variations in results due to GPU architecture, the number of GPUs used, and dataloader workers.
For parameter descriptions, consult the parameters.py file.
The repository and the results are configured for an embedding size of 128.
The MDProp_Supplmentary_Material.pdf file provides supplementary explanations cited in the paper.
Feel free to raise issues or submit pull requests for any questions or improvements.