{"id":48395790,"url":"https://github.com/naver-ai/pcmepp","last_synced_at":"2026-04-06T01:22:33.300Z","repository":{"id":170814666,"uuid":"646650125","full_name":"naver-ai/pcmepp","owner":"naver-ai","description":"Official Pytorch implementation of \"Improved Probabilistic Image-Text Representations\" (ICLR 2024)","archived":false,"fork":false,"pushed_at":"2024-04-08T06:24:50.000Z","size":16044,"stargazers_count":39,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-14T00:19:55.456Z","etag":null,"topics":["cross-modal-retrieval","iclr2024","probabilistic-embeddings","probabilistic-machine-learning"],"latest_commit_sha":null,"homepage":"https://naver-ai.github.io/pcmepp/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naver-ai.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-29T03:01:06.000Z","updated_at":"2024-05-10T08:04:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"9595b027-f750-494c-b54f-e99a35dbaf15","html_url":"https://github.com/naver-ai/pcmepp","commit_stats":null,"previous_names":["naver-ai/pcmepp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/naver-ai/pcmepp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naver-ai%2Fpcmepp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naver-ai%2Fpcmepp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naver-ai%2Fpcmepp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naver-ai%2Fpcmepp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naver-ai","download_url":"https://codeload.github.com/naver-ai/pcmepp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naver-ai%2Fpcmepp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31455833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-modal-retrieval","iclr2024","probabilistic-embeddings","probabilistic-machine-learning"],"created_at":"2026-04-06T01:22:32.606Z","updated_at":"2026-04-06T01:22:33.295Z","avatar_url":"https://github.com/naver-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Improved Probabilistic Image-Text Representations (PCME++) (ICLR 2024)\n\nOfficial Python implementation of PCME++ | [Paper](https://arxiv.org/abs/2305.18171) | [Project page](https://naver-ai.github.io/pcmepp/)\n\n[Sanghyuk Chun](https://sanghyukchun.github.io/home/)\n\nThis codebase is built upon the following repositories\n\n- https://github.com/woodfrog/vse_infty\n- https://github.com/naver-ai/pcme\n- https://github.com/openai/CLIP\n\n## Updates\n\n- 08 Apr, 2024: HuggingFace model for ImageNet zero-shot is released. See [hf_example.py](https://github.com/naver-ai/pcmepp/blob/main/hf_example.py) for more details\n- 07 Aug, 2023: Code is released!\n\n## Installation\n\nPlease check the library version before you run the code:\n\n```\nlightning==2.0.1\ntorch==2.0\ntorchtext==0.15.1\ntorchvision==0.15.1\ntransformers\n```\n\nOr, simply run pip install (I strongly recommend making a new virtual environment before you run this):\n\n```\npip3 install -r requirements.txt\n```\n\n## Dataset preparation\n\nStep 1. Download COCO 2014 images from the official website: https://cocodataset.org/#download I may assume that your dataset file directory looks like\n\n```\n/path/to/dataset\n└── images\n    ├── train2014 # approximately 82k images are here\n    └── val2014   # approximately 40k images are here\n```\n\nStep 2. Download annotation files from [this link](https://github.com/naver-ai/pcmepp/releases/download/v0.1.0/coco_annotations.tar.gz) and untar the annotations to the dataset path. It will make your dataset file directory will be\n\n```\n/path/to/dataset\n└── images\n    └── ...\n├── id_mapping.json # mapping file for image and captions\n├── cxc_annots      # annotations for CxC evaluation of VSE infty codebase\n└── precomp         # caption annotations are here\n    ├── train_caps.txt\n    ├── train_ids.txt\n    ├── dev_caps.txt\n    ├── dev_ids.txt\n    ├── test_caps.txt\n    ├── test_ids.txt\n    ├── testall_caps.txt\n    └── testall_ids.txt\n```\n\n## Quick start\n\n- Most of the experiments are reproducible with a single V100. If you want to use multiple GPUs (e.g., larger batch size, or larger model), you should specify `--train__dist_train` option.\n- If you would like to run multiple experiments using this repository, it would be better to specify your `expname` using `train__expname`. The default `expname` is `results`, and all logs and weights will be dumped to `results`, if `expname` is not specified.\n\nYou can reproduce the main results by the following commands:\n\n```\n# PCME++ ViT-B/32 backbone\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/pcmepp.yaml --dataloader__data_path /path/to/dataset\n\n# PCME++ ViT-B/16 backbone\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/pcmepp.yaml --dataloader__data_path /path/to/dataset --model__backbone_source clip_ViT-B/16\n\n# PCME++ ViT-L/14 backbone\nCUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train.py ./configs/pcmepp.yaml --dataloader__data_path /path/to/dataset --model__backbone_source clip_ViT-L/14 --model__img_dim 1024 --dataloader__batch_size 16 --train__dist_train\n```\n\nThis repository also provides `noise ratio` option as follows:\n\n```\n# PCME++ ViT-B/32 backbone with noise ratio 20%\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/pcmepp.yaml --dataloader__data_path /path/to/dataset --dataloader__noise_ratio 0.2\n\n# PCME++ ViT-B/32 backbone with noise ratio 50%\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/pcmepp.yaml --dataloader__data_path /path/to/dataset --dataloader__noise_ratio 0.5\n```\n\nYou can train the baselines methods using the following commands:\n\n```\n# ViT-B/32 backbones. Changing backbone is the same as the PCME++ backbone changes\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/others/vse_infty.yaml --dataloader__data_path /path/to/dataset\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/others/info_nce.yaml --dataloader__data_path /path/to/dataset\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/others/pcmepp_mu_only.yaml --dataloader__data_path /path/to/dataset\nCUDA_VISIBLE_DEVICES=0 python3 train.py ./configs/others/pcme.yaml --dataloader__data_path /path/to/dataset\n\n# only exception is InfoNCE + multiple GPUs\nCUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train.py ./configs/others/info_nce.yaml --dataloader__data_path /path/to/dataset --model__backbone_source clip_ViT-L/14 --model__img_dim 1024 --dataloader__batch_size 16 --train__dist_train --train__all_gather_infonce\n```\n\n## Official weights\n\nWe will provide the official weights for each model in the paper.\n\n## How to cite\n\n```\n@inproceedings{chun2024pcmepp,\n    title={Improved Probabilistic Image-Text Representations},\n    author={Chun, Sanghyuk},\n    year={2024},\n    booktitle={International Conference on Learning Representations (ICLR)},\n}\n```\n\nI would like to suggest citing [PCME](https://github.com/naver-ai/pcme) and [ECCV Caption](https://github.com/naver-ai/eccv-caption), too.\n```\n@inproceedings{chun2021pcme,\n    title={Probabilistic Embeddings for Cross-Modal Retrieval},\n    author={Chun, Sanghyuk and Oh, Seong Joon and De Rezende, Rafael Sampaio and Kalantidis, Yannis and Larlus, Diane},\n    year={2021},\n    booktitle={Conference on Computer Vision and Pattern Recognition (CVPR)},\n}\n\n@inproceedings{chun2022eccv_caption,\n    title={ECCV Caption: Correcting False Negatives by Collecting Machine-and-Human-verified Image-Caption Associations for MS-COCO}, \n    author={Chun, Sanghyuk and Kim, Wonjae and Park, Song and Chang, Minsuk Chang and Oh, Seong Joon},\n    year={2022},\n    booktitle={European Conference on Computer Vision (ECCV)},\n}\n```\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2023-present NAVER Cloud Corp.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaver-ai%2Fpcmepp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaver-ai%2Fpcmepp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaver-ai%2Fpcmepp/lists"}