Pic2story
P
Pic2story
由abhijit2111開發
BLIP是一個統一的視覺-語言預訓練框架,擅長圖像描述生成和理解任務,通過引導描述生成有效利用噪聲網絡數據
下載量 140
發布時間 : 4/9/2024
模型概述
該模型是基於COCO數據集預訓練的圖像描述生成模型,採用ViT大型骨幹網絡架構,支持條件式和非條件式圖像描述生成
模型特點
統一視覺-語言框架
可靈活遷移至視覺-語言理解與生成任務
引導描述生成
通過描述生成器和過濾器有效利用噪聲網絡數據
多任務適配
支持圖像描述生成、圖文檢索和視覺問答等多種任務
模型能力
圖像描述生成
視覺-語言理解
條件式文本生成
非條件式文本生成
使用案例
內容生成
自動圖像標註
為圖片生成描述性文字
在COCO數據集上CIDEr指標提升2.8%
信息檢索
圖文檢索
根據文本查詢匹配相關圖像
平均召回率@1提升2.7%
智能問答
視覺問答
回答關於圖像內容的問題
VQA得分提升1.6%
🚀 BLIP:用於統一視覺語言理解和生成的語言 - 圖像預訓練引導
BLIP是一個新的視覺語言預訓練(VLP)框架,能夠靈活地遷移到視覺語言理解和生成任務中。它通過引導字幕有效地利用了嘈雜的網絡數據,在一系列視覺語言任務上取得了最先進的成果,還在零樣本遷移到視頻語言任務時表現出強大的泛化能力。
🚀 快速開始
本模型可用於有條件和無條件的圖像字幕生成。
使用PyTorch模型
在CPU上運行模型
點擊展開
import requests
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
# 有條件的圖像字幕生成
text = "a photography of"
inputs = processor(raw_image, text, return_tensors="pt")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
# 無條件的圖像字幕生成
inputs = processor(raw_image, return_tensors="pt")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
在GPU上運行模型
全精度
點擊展開
import requests
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large").to("cuda")
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
# 有條件的圖像字幕生成
text = "a photography of"
inputs = processor(raw_image, text, return_tensors="pt").to("cuda")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
# 無條件的圖像字幕生成
inputs = processor(raw_image, return_tensors="pt").to("cuda")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
半精度 (float16
)
點擊展開
import torch
import requests
from PIL import Image
from transformers import BlipProcessor, BlipForConditionalGeneration
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large", torch_dtype=torch.float16).to("cuda")
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
# 有條件的圖像字幕生成
text = "a photography of"
inputs = processor(raw_image, text, return_tensors="pt").to("cuda", torch.float16)
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
# >>> a photography of a woman and her dog
# 無條件的圖像字幕生成
inputs = processor(raw_image, return_tensors="pt").to("cuda", torch.float16)
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
>>> a woman sitting on the beach with her dog
✨ 主要特性
- 靈活遷移:能夠靈活地遷移到視覺語言理解和生成任務。
- 有效利用數據:通過引導字幕有效地利用嘈雜的網絡數據。
- 先進成果:在一系列視覺語言任務上取得了最先進的成果。
- 強大泛化:在零樣本遷移到視頻語言任務時表現出強大的泛化能力。
📚 詳細文檔
模型概述
該模型是在COCO數據集上預訓練的圖像字幕生成模型,採用了基礎架構(帶有ViT大骨幹網絡)。
關鍵論文解讀
來自論文《BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation》的作者在摘要中指出:
視覺語言預訓練(VLP)提升了許多視覺語言任務的性能。然而,大多數現有的預訓練模型僅在基於理解的任務或基於生成的任務中表現出色。此外,性能的提升主要是通過擴大從網絡收集的嘈雜圖像 - 文本對數據集來實現的,而網絡數據是次優的監督來源。在本文中,作者提出了BLIP,一個新的VLP框架,它可以靈活地遷移到視覺語言理解和生成任務中。BLIP通過引導字幕有效地利用了嘈雜的網絡數據,其中一個字幕生成器生成合成字幕,一個過濾器去除嘈雜的字幕。作者在廣泛的視覺語言任務上取得了最先進的結果,如圖像 - 文本檢索(平均召回率@1提高2.7%)、圖像字幕生成(CIDEr提高2.8%)和視覺問答(VQA分數提高1.6%)。BLIP在以零樣本方式直接遷移到視頻語言任務時也表現出強大的泛化能力。代碼、模型和數據集均已發佈。
📄 許可證
本項目採用BSD 3 - 條款許可證。
BibTex和引用信息
@misc{https://doi.org/10.48550/arxiv.2201.12086,
doi = {10.48550/ARXIV.2201.12086},
url = {https://arxiv.org/abs/2201.12086},
author = {Li, Junnan and Li, Dongxu and Xiong, Caiming and Hoi, Steven},
keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}
屬性 | 詳情 |
---|---|
模型類型 | 圖像字幕生成模型 |
訓練數據 | COCO數據集 |
Clip Vit Large Patch14
CLIP是由OpenAI開發的視覺-語言模型,通過對比學習將圖像和文本映射到共享的嵌入空間,支持零樣本圖像分類
圖像生成文本
C
openai
44.7M
1,710
Clip Vit Base Patch32
CLIP是由OpenAI開發的多模態模型,能夠理解圖像和文本之間的關係,支持零樣本圖像分類任務。
圖像生成文本
C
openai
14.0M
666
Siglip So400m Patch14 384
Apache-2.0
SigLIP是基於WebLi數據集預訓練的視覺語言模型,採用改進的sigmoid損失函數,優化了圖像-文本匹配任務。
圖像生成文本
Transformers

S
google
6.1M
526
Clip Vit Base Patch16
CLIP是由OpenAI開發的多模態模型,通過對比學習將圖像和文本映射到共享的嵌入空間,實現零樣本圖像分類能力。
圖像生成文本
C
openai
4.6M
119
Blip Image Captioning Base
Bsd-3-clause
BLIP是一個先進的視覺-語言預訓練模型,擅長圖像描述生成任務,支持條件式和非條件式文本生成。
圖像生成文本
Transformers

B
Salesforce
2.8M
688
Blip Image Captioning Large
Bsd-3-clause
BLIP是一個統一的視覺-語言預訓練框架,擅長圖像描述生成任務,支持條件式和無條件式圖像描述生成。
圖像生成文本
Transformers

B
Salesforce
2.5M
1,312
Openvla 7b
MIT
OpenVLA 7B是一個基於Open X-Embodiment數據集訓練的開源視覺-語言-動作模型,能夠根據語言指令和攝像頭圖像生成機器人動作。
圖像生成文本
Transformers 英語

O
openvla
1.7M
108
Llava V1.5 7b
LLaVA 是一款開源多模態聊天機器人,基於 LLaMA/Vicuna 微調,支持圖文交互。
圖像生成文本
Transformers

L
liuhaotian
1.4M
448
Vit Gpt2 Image Captioning
Apache-2.0
這是一個基於ViT和GPT2架構的圖像描述生成模型,能夠為輸入圖像生成自然語言描述。
圖像生成文本
Transformers

V
nlpconnect
939.88k
887
Blip2 Opt 2.7b
MIT
BLIP-2是一個視覺語言模型,結合了圖像編碼器和大型語言模型,用於圖像到文本的生成任務。
圖像生成文本
Transformers 英語

B
Salesforce
867.78k
359
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98