Developed on
python = 3.11 PyTorch = 2.1.0
Clone the repository locally
git clone https://github.com/MatousE/rot-invariance-analysis.git
cd rot-invariance-analysisAnd install the remaining requirements with
pip install -r requirements.txtTo extract the features of these models for a dataset under different rotations one must first define
a YAML file with the parameters of the experiment. An example is shown at args/get_rot_embeddings.yaml.
To see all supported models run
python -c 'from utils import SUPPORTED_MODELS; print(SUPPORTED_MODELS)'To run the experiment you simply run the following code
python get_rot_embeddings.py --yaml /path/to/yaml/file.yamlThe resulting features will be stored as a single .pth file
To extract the mutual
python m_knn_distance.py --embd_path /results/embeddings.pth --k 10 --batch_size 1024The results of which will be stored in a CSV file called m_knn.csv
To extract the cosine distance between the embeddings with no-rotation and with rotation one simply runs
python cosine_distance.py --embd_path /results/embeddings.pth