{"id":21514148,"url":"https://github.com/allenpandas/blip-imagecaption","last_synced_at":"2025-10-25T08:47:39.328Z","repository":{"id":218367117,"uuid":"746242157","full_name":"Allenpandas/BLIP-ImageCaption","owner":"Allenpandas","description":"BLIP-ImageCaption","archived":false,"fork":false,"pushed_at":"2024-01-21T13:59:17.000Z","size":1895,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-24T02:19:44.562Z","etag":null,"topics":["blip","image-caption","image-caption-generation","image-caption-generator","image-captioning","image-captions","imagecaptioning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Allenpandas.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}},"created_at":"2024-01-21T13:52:56.000Z","updated_at":"2024-01-29T06:12:50.000Z","dependencies_parsed_at":"2024-01-21T14:47:37.848Z","dependency_job_id":"58744424-c3d8-44f3-8f57-8e241f246ac0","html_url":"https://github.com/Allenpandas/BLIP-ImageCaption","commit_stats":null,"previous_names":["allenpandas/blip-imagecaption"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Allenpandas%2FBLIP-ImageCaption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Allenpandas%2FBLIP-ImageCaption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Allenpandas%2FBLIP-ImageCaption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Allenpandas%2FBLIP-ImageCaption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Allenpandas","download_url":"https://codeload.github.com/Allenpandas/BLIP-ImageCaption/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244060809,"owners_count":20391603,"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":["blip","image-caption","image-caption-generation","image-caption-generator","image-captioning","image-captions","imagecaptioning"],"created_at":"2024-11-23T23:42:21.708Z","updated_at":"2025-10-25T08:47:34.296Z","avatar_url":"https://github.com/Allenpandas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## BLIP-ImageCaption\n\n本仓库节选了BLIP论文中 Image Caption预测部分的代码，在源代码的基础上进行优化，原论文内容及实现参考下列资料：\n\n**Github 地址：** https://github.com/Allenpandas/BLIP-ImageCaption\n\n**论文链接：** https://arxiv.org/abs/2201.12086\n\n## 1.环境准备\n\n**步骤0：** 从 [官方网站 ](https://docs.conda.io/en/latest/miniconda.html)下载并安装 Miniconda。\n\n**步骤1：** 创建并激活一个 conda 环境，本仓库建议使用 python3.8、PyTorch1.10.0【原文推荐的环境为PyTorch 1.10.x】、cuda11.3 版本，推荐使用 `环境名-python版本-cuda版本` 的方式进行 conda 环境的命名。\n\n```shell\nconda create --name BLIPIC-py3.8-cu11.3 python=3.8 -y\nconda activate BLIPIC-py3.8-cu11.3\n```\n\n**步骤2（可忽略）：** 若安装 GPU 版本的 PyTorch，参考 [Pytorch官网 ](https://pytorch.org/get-started/previous-versions/) ，使用以下脚本。\n\n```shell\nconda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge\n```\n\n## 2.安装流程\n\n**步骤1：** 克隆本仓库。\n\n```shell\ngit clone https://github.com/Allenpandas/BLIP-ImageCaption.git\ncd BLIP-ImageCaption/\n```\n\n**步骤2：** 安装所需要的依赖包。\n\n```shell\npip install -r requirements.txt\n```\n\n## 3.推理预测\n\n**步骤1：** 下载 [预训练的模型](https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base_caption_capfilt_large.pth)，将模型放置在根目录下。\n\n**步骤2：** 执行推理脚本 `python image_caption.py --image_dir /path/to/image_directory --model_dir /path/to/pre-train_model _directory --output_json_dir /path/to/output_json_directory`，其中：\n\n- `--image_dir` 是待处理的图像目录，默认为： `./demo` 目录；\n- `--model_dir` 是ImageCaption预训练模型的地址，默认为： `./model_base_caption_capfilt_large.pth`；\n- `--outout_json_dir` 是输出结果的目录，默认为： `./output` 目录。\n\n**示例脚本：**\n\n```shell\npython image_caption.py \\\n--image_dir './demo' \\\n--model_dir './model_base_caption_capfilt_large.pth' \\\n--output_json_dir './output'\n```\n\n**输入图像：** `./demo` 目录下的 `000000.png` （上图）和 `000074.png` （下图）。\n\n\u003cp\u003e\u003cimg src=\"./demo/000000.png\" \u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cimg src=\"./demo/000074.png\"\u003e\u003c/p\u003e\n\n**输出示例：** `./output/output.json`\n\n```json\n[\n  {\n    \"id\": 1,\n    \"filename\": \"000000.png\",\n    \"caption\": \"a man walking down a sidewalk next to a blue building\"\n  },\n  {\n    \"id\": 2,\n    \"filename\": \"000074.png\",\n    \"caption\": \"a group of people walking down a sidewalk\"\n  }\n]\n```\n\n## Acknowledgement\n\nThe implementation of BLIP relies on resources from [ALBEF](https://github.com/salesforce/ALBEF), [Huggingface Transformers](https://github.com/huggingface/transformers), and [timm](https://github.com/rwightman/pytorch-image-models/tree/master/timm). We thank the original authors for their open-sourcing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenpandas%2Fblip-imagecaption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallenpandas%2Fblip-imagecaption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallenpandas%2Fblip-imagecaption/lists"}