{"id":13737995,"url":"https://github.com/Confusezius/ECCV2020_DiVA_MultiFeature_DML","last_synced_at":"2025-05-08T15:32:10.087Z","repository":{"id":45209818,"uuid":"290239544","full_name":"Confusezius/ECCV2020_DiVA_MultiFeature_DML","owner":"Confusezius","description":"(ECCV 2020) This repo contains code for \"DiVA: Diverse Visual Feature Aggregation for Deep Metric Learning\" (https://arxiv.org/abs/2004.13458), which extends vanilla DML with auxiliary and self-supervised features.","archived":false,"fork":false,"pushed_at":"2021-12-05T12:53:01.000Z","size":269,"stargazers_count":34,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-15T06:33:01.967Z","etag":null,"topics":["cars196","cub200-2011","deep-learning","deep-metric-learning","image-retrieval","metric-learning","stanford-online-products","wandb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Confusezius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-25T14:37:14.000Z","updated_at":"2024-07-09T14:07:56.000Z","dependencies_parsed_at":"2022-09-24T10:01:11.738Z","dependency_job_id":null,"html_url":"https://github.com/Confusezius/ECCV2020_DiVA_MultiFeature_DML","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confusezius%2FECCV2020_DiVA_MultiFeature_DML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confusezius%2FECCV2020_DiVA_MultiFeature_DML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confusezius%2FECCV2020_DiVA_MultiFeature_DML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Confusezius%2FECCV2020_DiVA_MultiFeature_DML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Confusezius","download_url":"https://codeload.github.com/Confusezius/ECCV2020_DiVA_MultiFeature_DML/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253096298,"owners_count":21853572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cars196","cub200-2011","deep-learning","deep-metric-learning","image-retrieval","metric-learning","stanford-online-products","wandb"],"created_at":"2024-08-03T03:02:08.482Z","updated_at":"2025-05-08T15:32:09.547Z","avatar_url":"https://github.com/Confusezius.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# DiVA: Including auxiliary and self-supervised features in Deep Metric Learning\n\n---\n## What can I find here?\n\nThis repository contains implementations for\n\n```\nDiVA: Diverse Visual Feature Aggregation for Deep Metric Learning\n```\n\naccepted to **ECCV 2020**.\n\n**Link**: https://arxiv.org/abs/2004.13458\n\nThe majority of this codebase is built upon research and implementations provided in\nPaper: https://arxiv.org/abs/2002.08473\nRepo: https://github.com/Confusezius/Revisiting_Deep_Metric_Learning_PyTorch\n\nThis repository contains the DiVA extension to standard Deep Metric Learning by extending auxiliary and self-supervised features for improved generalization to unseen test classes:\n\n**Contact**: Karsten Roth, karsten.rh1@gmail.com  \n\n*Suggestions are always welcome!*\n\nArchitecturally, running DiVA extends DML like this:\n![Architecture](Images/arch.jpeg)\n\n\n---\n## Some Notes:\n\nIf you use this code in your research, please cite\n```\n@misc{milbich2020diva,\n    title={DiVA: Diverse Visual Feature Aggregation for Deep Metric Learning},\n    author={Timo Milbich and Karsten Roth and Homanga Bharadhwaj and Samarth Sinha and Yoshua Bengio and Björn Ommer and Joseph Paul Cohen},\n    year={2020},\n    eprint={2004.13458},\n    archivePrefix={arXiv},\n    primaryClass={cs.CV}\n}\n```\n\n---\n## Requirements \u0026 Datasets:\n\n* PyTorch 1.2.0+ \u0026 Faiss-Gpu\n* Python 3.6+\n* pretrainedmodels, torchvision 0.3.0+\n\nfor a detailed installation script and download links to all benchmarks, please visit\nhttps://github.com/Confusezius/Revisiting_Deep_Metric_Learning_PyTorch\n\n\n---\n## Training:\n\n__Update 14/09/21:__ _There was a slight error in the uploaded `fast_moco.py` script resulting in negative reweighting different to that mentioned in the paper. As such, we have introduced the `--diva_fixed`-flag which can be used to run the corrected fast momentum contrast/nce objective. Performance however remains effectively the same, so it is not necessarily needed. Thanks to __BrandonHanx__ for noticing!_\n\n\nTraining is done by using `diva_main.py`, with settings available in `parameters.py`. Exemplary runs are provided in `SampleRuns/ECCV2020_DiVA_SampleRuns.sh`.\nLogging via `Weights and Biases` follows the same setup as in https://github.com/Confusezius/Revisiting_Deep_Metric_Learning_PyTorch.\n\nGenerally, a run can look like this:\n\n```\npython diva_main.py --dataset cub200 --log_online --project DiVA_SampleRuns --group CUB_DiVA-R50-512\n                    --diva_ssl fast_moco --source_path $datapath --tau 55 --gamma 0.2\n                    --diva_alpha_ssl 0.3 --diva_alpha_shared 0.3 --diva_alpha_intra 0.3\n                    --diva_rho_decorrelation 1500 1500 1500 --diva_features discriminative selfsimilarity shared intra\n                    --diva_sharing random --evaltypes all --diva_moco_temperature 0.01  --diva_moco_n_key_batches 30\n                    --n_epochs 350 --seed 0 --gpu 0 --samples_per_class 2\n                    --loss margin --batch_mining distance --arch resnet50_frozen_normalize\n                    --embed_dim 128 (--diva_fixed)\n```\n\nWe apply DiVA on CUB (`--dataset cub200`) and Margin Loss (`--loss margin`) with distance-based batchmining (`--batch_mining distance`).\n\nWe use the standard `discriminative` features, as well as self-supervised features `selfsimilarity` based on \"fast Momentum Contrast\" (`--diva_ssl fast_moco`), corresponding to the `DaNCE` objective in the original paper, as well as `shared` and intra_class features (`intra`), all of which we note in `--diva_features discriminative selfsimilarity shared intra`.\n\nEach auxiliary loss is weighted by `0.3` (see `--diva_alpha_ssl, --diva_alpha_shared, --diva_alpha_intra`). Each decorrelation (discriminative to ...) is weighted by `1500` (see `--diva_rho_decorrelation`). Finally, some self-supervision/MoCo specific hyperparameters (`--diva_moco_temperature, --diva_moco_n_key_batches`), corresponding to the temperature and number of key batches used in the NCE objective.\n\nFinally, each embedding space has dimensionality `--embed_dim 128`, meaning that during testing, we evaluate on a ResNet50 with a total dimensionality of `4 x 128 = 512`.\n\nWe also note that other self-supervision methods can be included as well (see `criteria/__init__.py` and `parameters.py`), e.g. Deep Clustering:\n\n```\npython diva_main.py --source_path $datapath --log_online --project DiVA_Experiments --diva_rho_decorrelation 500\n                    --diva_features discriminative dc --evaltypes all --diva_dc_update_f 2 --diva_dc_ncluster 300\n                    --n_epochs 200 --seed 0 --gpu $gpu --bs 104 --samples_per_class 2 --loss margin\n                    --batch_mining distance --arch bninception_normalize --embed_dim 256\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConfusezius%2FECCV2020_DiVA_MultiFeature_DML","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FConfusezius%2FECCV2020_DiVA_MultiFeature_DML","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConfusezius%2FECCV2020_DiVA_MultiFeature_DML/lists"}