🚀 Deformable DETRモデル(LVISで学習済み)
LVIS(1203クラスを含む)で学習されたDeformable DEtection TRansformer (DETR) モデルです。このモデルは、Zhouらによる論文 Detecting Twenty-thousand Classes using Image-level Supervision で紹介され、このリポジトリ で最初に公開されました。
🚀 クイックスタート
このモデルは、LVISデータセットで学習された物体検出用のDeformable DETRモデルです。以下のセクションでは、モデルの詳細、使用方法、評価結果などについて説明します。
✨ 主な機能
- LVISデータセット(1203クラスを含む)で学習された物体検出モデル。
- エンコーダ - デコーダ構造のトランスフォーマーと畳み込みバックボーンを使用。
- 物体検出のためにクラスラベル用の線形層とバウンディングボックス用のMLPを使用。
📚 ドキュメント
モデルの説明
DETRモデルは、畳み込みバックボーンを持つエンコーダ - デコーダ構造のトランスフォーマーです。物体検出を行うために、デコーダの出力の上に2つのヘッドが追加されています。クラスラベル用の線形層とバウンディングボックス用のMLP(多層パーセプトロン)です。このモデルは、いわゆる物体クエリを使用して画像内の物体を検出します。各物体クエリは、画像内の特定の物体を探します。COCOの場合、物体クエリの数は100に設定されています。
モデルは「二部マッチング損失」を使用して学習されます。つまり、N = 100の各物体クエリの予測クラスとバウンディングボックスを、同じ長さNにパディングされた正解アノテーションと比較します(画像に4つの物体しか含まれていない場合、96個のアノテーションは「物体なし」をクラスとし、「バウンディングボックスなし」をバウンディングボックスとします)。ハンガリアンマッチングアルゴリズムを使用して、N個のクエリとN個のアノテーションの間に最適な1対1のマッピングを作成します。次に、標準的な交差エントロピー(クラス用)とL1損失と一般化IoU損失の線形結合(バウンディングボックス用)を使用して、モデルのパラメータを最適化します。

想定される用途と制限
このモデルは、物体検出に使用できます。すべての利用可能なDeformable DETRモデルを探すには、モデルハブ を参照してください。
💻 使用例
基本的な使用法
from transformers import AutoImageProcessor, DeformableDetrForObjectDetection
import torch
from PIL import Image
import requests
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained("facebook/deformable-detr-box-supervised")
model = DeformableDetrForObjectDetection.from_pretrained("facebook/deformable-detr-box-supervised")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
target_sizes = torch.tensor([image.size[::-1]])
results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.7)[0]
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
box = [round(i, 2) for i in box.tolist()]
print(
f"Detected {model.config.id2label[label.item()]} with confidence "
f"{round(score.item(), 3)} at location {box}"
)
🔧 技術詳細
評価結果
このモデルは、LVISで31.7のボックスmAPと21.4のmAP(レアクラス)を達成しています。
BibTeXエントリと引用情報
@misc{https://doi.org/10.48550/arxiv.2010.04159,
doi = {10.48550/ARXIV.2010.04159},
url = {https://arxiv.org/abs/2010.04159},
author = {Zhu, Xizhou and Su, Weijie and Lu, Lewei and Li, Bin and Wang, Xiaogang and Dai, Jifeng},
keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Deformable DETR: Deformable Transformers for End-to-End Object Detection},
publisher = {arXiv},
year = {2020},
copyright = {arXiv.org perpetual, non-exclusive license}
}
📄 ライセンス
このモデルは、Apache-2.0ライセンスの下で提供されています。