🚀 OWL - ViTモデルカード
OWL - ViT(Vision Transformer for Open - World Localizationの略)は、ゼロショットのテキスト条件付き物体検出モデルです。このモデルを使用すると、1つまたは複数のテキストクエリを使って画像を検索することができます。
🚀 クイックスタート
OWL - ViTを使って画像内の物体を検出するには、以下の手順に従います。まず、必要なライブラリをインポートし、モデルとプロセッサをロードします。次に、画像を取得し、テキストクエリを設定して入力を処理します。最後に、出力を後処理して検出結果を得ます。
import requests
from PIL import Image
import torch
from transformers import OwlViTProcessor, OwlViTForObjectDetection
processor = OwlViTProcessor.from_pretrained("google/owlvit-base-patch16")
model = OwlViTForObjectDetection.from_pretrained("google/owlvit-base-patch16")
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
texts = [["a photo of a cat", "a photo of a dog"]]
inputs = processor(text=texts, images=image, return_tensors="pt")
outputs = model(**inputs)
# Target image sizes (height, width) to rescale box predictions [batch_size, 2]
target_sizes = torch.Tensor([image.size[::-1]])
# Convert outputs (bounding boxes and class logits) to COCO API
results = processor.post_process_object_detection(outputs=outputs, threshold=0.1, target_sizes=target_sizes)
i = 0 # Retrieve predictions for the first image for the corresponding text queries
text = texts[i]
boxes, scores, labels = results[i]["boxes"], results[i]["scores"], results[i]["labels"]
# Print detected objects and rescaled box coordinates
for box, score, label in zip(boxes, scores, labels):
box = [round(i, 2) for i in box.tolist()]
print(f"Detected {text[label]} with confidence {round(score.item(), 3)} at location {box}")
✨ 主な機能
- ゼロショット物体検出:事前に特定の物体のラベルで訓練しなくても、テキストクエリを使って物体を検出できます。
- 多モーダルバックボーン:CLIPを多モーダルバックボーンとして使用し、視覚的特徴とテキスト特徴を取得します。
📚 ドキュメント
🔧 技術詳細
モデルの概要
OWL - ViTは、CLIPを多モーダルバックボーンとして使用しています。画像エンコーダとしてViT - B/16 Transformerアーキテクチャを、テキストエンコーダとしてマスク自己注意Transformerを使用しています。これらのエンコーダは、対照的損失を通じて(画像、テキスト)ペアの類似度を最大化するように訓練されています。CLIPバックボーンは最初から訓練され、ボックスとクラス予測ヘッドと一緒に物体検出の目的で微調整されます。
モデルの日付
2022年5月
モデルタイプ
プロパティ |
詳細 |
モデルタイプ |
画像エンコーダとしてViT - B/16 Transformerアーキテクチャを持つCLIPバックボーンを使用し、テキストエンコーダとしてマスク自己注意Transformerを使用します。 |
訓練データ |
モデルのCLIPバックボーンは、公開されている画像キャプションデータで訓練されました。これは、いくつかのウェブサイトをクロールし、YFCC100Mなどの一般的に使用される既存の画像データセットを組み合わせて行われました。OWL - ViTの予測ヘッドは、COCOやOpenImagesなどの公開されている物体検出データセットで微調整されます。 |
モデルの使用
意図された使用法
このモデルは、研究コミュニティ向けの研究成果として意図されています。研究者がゼロショット、テキスト条件付き物体検出をよりよく理解し、探索するのを可能にすることを期待しています。また、このようなモデルの潜在的な影響に関する学際的研究にも役立つことを期待しています。
主な意図された使用法
これらのモデルの主な意図されたユーザーはAI研究者です。研究者がコンピュータビジョンモデルのロバスト性、汎化性、その他の機能、バイアス、制約をよりよく理解するためにこのモデルを使用することを想定しています。
BibTeXエントリと引用情報
@article{minderer2022simple,
title={Simple Open-Vocabulary Object Detection with Vision Transformers},
author={Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, Neil Houlsby},
journal={arXiv preprint arXiv:2205.06230},
year={2022},
}
📄 ライセンス
このモデルはApache - 2.0ライセンスの下で提供されています。