---
title: ofa_image-caption_coco_6b_en
canonical_url: "https://www.modelscope.cn/models/iic/ofa_image-caption_coco_6b_en"
md_url: "https://www.modelscope.cn/models/iic/ofa_image-caption_coco_6b_en.md"
repository: iic/ofa_image-caption_coco_6b_en
chinese_name: "OFA图像描述-英文-通用领域-6B"
last_updated: 2023-01-17
license: "Apache License 2.0"
pipeline_tag: image-captioning
tasks:
  - image-captioning
model_type:
  - ofa
architectures:
  - OFAModel
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - multi-modal
downloads: 951
stars: 4
tags:
  - Alibaba
  - OFA
  - M6
  - ICML2022
  - "arxiv:2202.03052"
  - "图到文"
---

# ofa_image-caption_coco_6b_en

> ofa_image-caption_coco_6b_en - iic 在 ModelScope 开源的模型。根据用户输入的任意图片，AI智能创作模型写出“一句话描述”，可用于图像标签和图像简介。

iic/ofa_image-caption_coco_6b_en 是 ModelScope 魔搭社区上的image-captioning模型，采用 Apache License 2.0 许可。

- **Repository**: iic/ofa_image-caption_coco_6b_en
- **License**: Apache License 2.0
- **Tasks**: image-captioning
- **Tags**: Alibaba, OFA, M6, ICML2022, arxiv:2202.03052, 图到文
- **Downloads**: 951
- **Stars**: 4
- **Last updated**: 2023-01-17

Source: https://www.modelscope.cn/models/iic/ofa_image-caption_coco_6b_en

---

# OFA-图像描述(英文)

## News
- 2022年11月：
  - 发布ModelScope 1.0版本，以下能力请使用1.0.2及以上版本。
  - 新增[OFA Tutorial](https://modelscope.cn/docs/OFA_Tutorial#1.4%20%E5%A6%82%E4%BD%95%E8%AE%AD%E7%BB%83)。


## 图像描述是什么？
如果你希望为一张图片配上一句文字，或者打个标签，OFA模型就是你的绝佳选择。你只需要输入任意1张你的图片，很快你就能收获一段精准的描述。

本系列还有如下模型，欢迎试用：
- [tiny-通用场景-英文](https://modelscope.cn/models/damo/ofa_image-caption_coco_distilled_en/summary)
- [large-通用场景-英文](https://modelscope.cn/models/damo/ofa_image-caption_coco_large_en/summary)
- [huge-通用场景-中文](https://modelscope.cn/models/damo/ofa_image-caption_coco_huge_en/summary)
- [base-电商场景-中文](https://modelscope.cn/models/damo/ofa_image-caption_muge_base_zh/summary)

## 快速玩起来
玩转OFA只需区区以下6行代码，就是如此轻松！如果你觉得还不够方便，请点击右上角Notebook按钮，我们为你提供了配备了的环境，CPU和GPU都支持哦，你只需要在notebook里输入提供的代码，就可以把OFA玩起来了! 
注：因为本模型参数量大小6B，所以需要显存大于40G的GPU机器。

<p align="center">
    <img src="resources/donuts.jpg" alt="donuts" width="200" />

```python
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys

img_captioning = pipeline(Tasks.image_captioning, model='damo/ofa_image-caption_coco_6b_en', model_revision='v1.0.0')
result = img_captioning('https://shuangqing-public.oss-cn-zhangjiakou.aliyuncs.com/donuts.jpg')
print(result[OutputKeys.CAPTION]) # 
```


## OFA是什么？
OFA(One-For-All)是通用多模态预训练模型，使用简单的序列到序列的学习框架统一模态（跨模态、视觉、语言等模态）和任务（如图片生成、视觉定位、图片描述、图片分类、文本生成等），详见我们发表于ICML 2022的论文：[OFA: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence Learning Framework](https://arxiv.org/abs/2202.03052)，以及我们的官方Github仓库[https://github.com/OFA-Sys/OFA](https://github.com/OFA-Sys/OFA)。
<br><br>

<p align="center">
    <br>
    <img src="resources/OFA_logo_tp_path.svg" width="150" />
    <br>
<p>
<br>

<p align="center">
        <a href="https://github.com/OFA-Sys/OFA">Github</a>&nbsp ｜ &nbsp<a href="https://arxiv.org/abs/2202.03052">Paper </a>&nbsp ｜ &nbspBlog
</p>

<p align="center">
    <br>
        <video src="https://xingchen-data.oss-cn-zhangjiakou.aliyuncs.com/maas/resources/modelscope_web/demo.mp4" loop="loop" autoplay="autoplay" muted width="80%"></video>
    <br>
</p>

### OFA模型规模：

<table border="1" width="100%">
    <tr align="center">
        <th>Model</th><th>Params-en</th><th>Params-zh</th><th>Backbone</th><th>Hidden size</th><th>Intermediate size</th><th>Num. of heads</th><th>Enc layers</th><th>Dec layers</th>
    </tr>
    <tr align="center">
        <td>OFA<sub>Tiny</sub></td><td>33M</td><td>-</td><td>ResNet50</td><td>256</td><td>1024</td><td>4</td><td>4</td><td>4</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Medium</sub></td><td>93M</td><td>-</td><td>ResNet101</td><td>512</td></td><td>2048</td><td>8</td><td>4</td><td>4</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Base</sub></td><td>180M</td><td>160M</td><td>ResNet101</td><td>768</td></td><td>3072</td><td>12</td><td>6</td><td>6</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Large</sub></td><td>470M</td><td>440M</td><td>ResNet152</td><td>1024</td></td><td>4096</td><td>16</td><td>12</td><td>12</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Huge</sub></td><td>930M</td><td>-</td><td>ResNet152</td><td>1280</td></td><td>5120</td><td>16</td><td>24</td><td>12</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>6B</sub></td><td>6B</td><td>-</td><td>ViT-huge</td><td>2560</td></td><td>10240</td><td>32</td><td>36</td><td>24</td>
    </tr>
</table>
<br>


## 为什么OFA是图像描述的最佳选择？
OFA在图像描述（image captioning）任务的权威数据集Microsoft COCO Captions官方榜单成功登顶（6B模型还在优化中，目前没有测试集的分）想看榜单，点[这里](https://competitions.codalab.org/competitions/3221#results)），并在经典测试集Karpathy test split取得CIDEr 154.9的分数。具体如下：

<table border="1" width="100%">
    <tr align="center">
        <th>Stage</th><th colspan="4">Cross Entropy Optimization</th><th colspan="4">CIDEr Optimization</th>
    </tr>
    <tr align="center">
        <td>Metric</td><td>BLEU-4</td><td>METEOR</td><td>CIDEr</td><td>SPICE</td><td>BLEU-4</td><td>METEOR</td><td>CIDEr</td><td>SPICE</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Base</sub></td><td>41.0</td><td>30.9</td><td>138.2</td><td>24.2</td><td>42.8</td><td>31.7</td><td>146.7</td><td>25.8</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Large</sub></td><td>42.4</td><td>31.5</td><td>142.2</td><td>24.5</td><td>43.6</td><td>32.2</td><td>150.7</td><td>26.2</td>
    </tr>
    <tr align="center">
        <td>OFA<sub>Huge</sub></td><td>43.9</td><td>31.8</td><td>145.3</td><td>24.8</td><td>44.9</td><td>32.5</td><td>154.9</td><td>26.6</td>
    </tr>
</table>
<br>

## 模型训练流程

### 训练数据介绍
本模型训练数据集是MS COCO Caption。

### 训练流程
finetune能力请参考[OFA Tutorial](https://modelscope.cn/docs/OFA_Tutorial#1.4%20%E5%A6%82%E4%BD%95%E8%AE%AD%E7%BB%83) 1.4节。

## 模型局限性以及可能的偏差
训练数据集自身有局限，有可能产生一些偏差，请用户自行评测后决定如何使用。
## 相关论文以及引用
如果你觉得OFA好用，喜欢我们的工作，欢迎引用：
```
@article{wang2022ofa,
  author    = {Peng Wang and
               An Yang and
               Rui Men and
               Junyang Lin and
               Shuai Bai and
               Zhikang Li and
               Jianxin Ma and
               Chang Zhou and
               Jingren Zhou and
               Hongxia Yang},
  title     = {OFA: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence
               Learning Framework},
  journal   = {CoRR},
  volume    = {abs/2202.03052},
  year      = {2022}
}
```
