{"id":18322601,"url":"https://github.com/tencentarc/bebr","last_synced_at":"2025-09-03T20:49:35.789Z","repository":{"id":172959771,"uuid":"596549133","full_name":"TencentARC/BEBR","owner":"TencentARC","description":"Official code for \"Binary embedding based retrieval at Tencent\"","archived":false,"fork":false,"pushed_at":"2024-03-07T05:37:58.000Z","size":72416,"stargazers_count":43,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-01T16:11:11.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TencentARC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","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,"publiccode":null,"codemeta":null}},"created_at":"2023-02-02T12:35:24.000Z","updated_at":"2025-04-24T07:27:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f4c3bff-d7ea-4a2d-8d6c-9b078b871082","html_url":"https://github.com/TencentARC/BEBR","commit_stats":null,"previous_names":["tencentarc/bebr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TencentARC/BEBR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FBEBR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FBEBR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FBEBR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FBEBR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TencentARC","download_url":"https://codeload.github.com/TencentARC/BEBR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FBEBR/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273509080,"owners_count":25118446,"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-09-03T02:00:09.631Z","response_time":76,"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":[],"created_at":"2024-11-05T18:25:18.118Z","updated_at":"2025-09-03T20:49:35.726Z","avatar_url":"https://github.com/TencentARC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BEBR\n\n## Approach\n![BEBR](BEBR.png)\n\n## Usage\nFirst, install Pytorch 1.13.1 (or later) and torchvision, as well as some additional dependencies\n```bash\n$ conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia\n$ git clone https://github.com/ganyk/BEBR.git\n$ pip install -r requirements\n```\n\n## Evaluation\nPre-computed hash features, recurrent binary features and float features are provided for evaluation.\n```bash\n# run evaluation on hash features\n$ python tools/eval.py --image_feat dataset/hash/feat_image.npy --txt_feat dataset/hash/feat_txt.npy\n\n# float features\n$ python tools/eval.py --image_feat dataset/float_finetune/feat_image.npy --txt_feat dataset/float_finetune/feat_txt.npy\n\n# recurrent binary features\n$ python tools/eval.py --image_feat dataset/bebr/feat_image.npy --txt_feat dataset/bebr/feat_txt.npy\n```\n\nThe results should be consistent with those in the paper:\n\n| Embedding | Bits  | Recall@1 | Recall@5 | Recall@10 |\n|:---------:|:-----:| :-------:| :-------:| :--------:|\n| hash      | 1024  | 0.348    | 0.632    | 0.730     |\n| bebr      | 1024  | 0.360    | 0.646    | 0.751     |\n| float     | 16384 | 0.361    | 0.649    | 0.744     |\n\n\n## Train\n\n### Prepare data\n1. Download COCO datasets and uncompress them\n```bash\n$ mkdir dataset/coco \u0026 cd dataset/coco\n$ wget http://images.cocodataset.org/zips/train2017.zip\n$ wget http://images.cocodataset.org/zips/val2017.zip\n$ wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip\n\nunzip train2017.zip \u0026 unzip val2017.zip \u0026 unzip annotations_trainval2017.zip\n```\n\n2. Use clip RN101 model to generate float features which will be used as input to train binary model\n```bash\n$ python tools/gen_clip_feat_train.py\n$ python tools/gen_clip_feat_eval.py\n```\n\n### Train binary model\n```bash\n# train hash model\n$ sh train_local.sh configs/hash.yaml\n# train bebr model\n$ sh train_local.sh configs/bebr.yaml\n```\n\n### finetune float feature\nThe training process of binary model can be seened as a finetune process. For fair comparison, we also finetune the clip features using MLPs whose input and output are both float features.\n```bash\n$ sh train_local.sh configs/float.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencentarc%2Fbebr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftencentarc%2Fbebr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencentarc%2Fbebr/lists"}