匿名用户2024年07月31日
35阅读
所属分类aipytorch
开源地址https://modelscope.cn/models/xiajinpeng123/BLIP2-Chinese
授权协议Apache License 2.0

作品详情

BLIP2-Qformer

简介 Brief Introduction

首个开源的中文BLIP2模型。我们遵循BLIP2的实验设置,采用itc、itm、lm损失,基于2亿中文图文对训练5个epoch,得到第一个中文版本的blip2模型。

The first open source Chinese BLIP2. We follow the experimental setup of BLIP2, we adopted itc, itm and lm losses, trained 5 epochs based on 200 million Chinese image pairs, and obtained the first Chinese version of BLIP2.

下游效果 Performance

Zero-Shot image-to-text-retrieval

model COCO-CN Flickr30k-CN
cn_clip 60.4 80.2
cn_blip2(ours) 70.3 85.7

Zero-Shot text-to-image-retrieval

model COCO-CN Flickr30k-CN
cn_clip 64.0 68.0
cn_blip2(ours) 71.4 70.46

使用 Usage

from modelscope.hub.snapshot_download import snapshot_download
model_path = snapshot_download('xiajinpeng123/BLIP2-Chinese',revision='v1.0.0')
import os
os.chdir(model_path)
import sys
sys.path.insert(0, model_path)
import ms_wrapper
from modelscope.pipelines import pipeline
img = [f"{model_path}/test1.jpg",f"{model_path}/test3.jpg"]
txt=["两台汽车","白色标记","两辆汽车停在公路上","两只小鸟在树上"]
input_dict=dict()
input_dict['img']=img
input_dict['text']=txt
weight_path = f"{model_path}/checkpoint_04.pth"

inference = pipeline('image-text-retrieval', model='xiajinpeng123/BLIP2-Chinese',model_revision='v1.0.0', weight_path=weight_path,device="cuda") # GPU环境可以设置为True
output = inference(input_dict)

print(output)
 git clone https://www.modelscope.cn/xiajinpeng123/BLIP2-Chinese.git

使用方式及场景

使用方式:

  • 对输入的图像、文本数据进行特征提取

使用场景:

  • 通用的图文跨模态检索任务
  • 通用图文特征提取器

模型局限性以及可能的偏差

  • 训练数据集自身有局限,有可能产生一些偏差,请用户自行评测后决定如何使用。

如果喜欢,敬请下载收藏!

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论