{"id":13738162,"url":"https://github.com/jeromerony/dml_cross_entropy","last_synced_at":"2025-10-06T21:28:15.036Z","repository":{"id":63697954,"uuid":"245525962","full_name":"jeromerony/dml_cross_entropy","owner":"jeromerony","description":"Code for the paper \"A unifying mutual information view of metric learning: cross-entropy vs. pairwise losses\" (ECCV 2020 - Spotlight)","archived":false,"fork":false,"pushed_at":"2022-11-25T21:45:50.000Z","size":30,"stargazers_count":168,"open_issues_count":3,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-08T16:45:18.512Z","etag":null,"topics":["cross-entropy","deep-learning","metric-learning"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2003.08983","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeromerony.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-06T22:12:40.000Z","updated_at":"2025-04-05T08:34:14.000Z","dependencies_parsed_at":"2023-01-23T00:15:11.970Z","dependency_job_id":null,"html_url":"https://github.com/jeromerony/dml_cross_entropy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jeromerony/dml_cross_entropy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromerony%2Fdml_cross_entropy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromerony%2Fdml_cross_entropy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromerony%2Fdml_cross_entropy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromerony%2Fdml_cross_entropy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeromerony","download_url":"https://codeload.github.com/jeromerony/dml_cross_entropy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeromerony%2Fdml_cross_entropy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278684759,"owners_count":26028137,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cross-entropy","deep-learning","metric-learning"],"created_at":"2024-08-03T03:02:12.859Z","updated_at":"2025-10-06T21:28:15.003Z","avatar_url":"https://github.com/jeromerony.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## Requirements for the experiments\n\n - scikit-learn\n - pytorch \u003e= 1.4\n - sacred \u003e= 0.8\n - tqdm\n - visdom_logger https://github.com/luizgh/visdom_logger\n - faiss https://github.com/facebookresearch/faiss\n\n## Data management\n\nFor In-Shop, you need to manually download the data from https://drive.google.com/drive/folders/0B7EVK8r0v71pVDZFQXRsMDZCX1E (at least the `img.zip` and `list_eval_partition.txt`), put them in `data/InShop` and extract `img.zip`.\n\nYou can download and generate the `train.txt` and `test.txt` for every dataset using the `prepare_data.py` script with:\n```bash\npython prepare_data.py\n```\nThis will download and prepare all the necessary data for _CUB200_, _Cars-196_ and _Stanford Online Products_.\n\n## Usage\n\nThis repo uses `sacred` to manage the experiments.\nTo run an experiment (e.g. on CUB200):\n\n```bash\npython experiment.py with dataset.cub\n```\n\nYou can add an observer to save the metrics and files related to the expriment by adding `-F result_dir`:\n\n```bash\npython experiment.py -F result_dir with dataset.cub\n```\n\n## Reproducing the results of the paper\n\nCUB200\n```bash\npython experiment.py with dataset.cub model.resnet50 epochs=30 lr=0.02\n```\n\nCARS-196\n```bash\npython experiment.py with dataset.cars model.resnet50 epochs=100 lr=0.05 model.norm_layer=batch\n```\n\nStanford Online Products\n```bash\npython experiment.py with dataset.sop model.resnet50 epochs=100 lr=0.003 momentum=0.99 nesterov=True model.norm_layer=batch\n```\n\nIn-Shop\n```bash\npython experiment.py with dataset.inshop model.resnet50 epochs=100 lr=0.003 momentum=0.99 nesterov=True model.norm_layer=batch\n```\n\n## Citation\n```bibtex\n@inproceedings{boudiaf2020unifying,\n  title={A unifying mutual information view of metric learning: cross-entropy vs. pairwise losses},\n  author={Boudiaf, Malik and Rony, J{\\'e}r{\\^o}me and Ziko, Imtiaz Masud and Granger, Eric and Pedersoli, Marco and Piantanida, Pablo and {Ben Ayed}, Ismail},\n  booktitle={European Conference on Computer Vision},\n  pages={548--564},\n  year={2020},\n  organization={Springer}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeromerony%2Fdml_cross_entropy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeromerony%2Fdml_cross_entropy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeromerony%2Fdml_cross_entropy/lists"}