🚀 Deformable DETRモデル(DocLayNetで学習済み)
DocLayNet(11クラスの80,000枚の注釈付きページを含む)で学習されたDeformable DEtection TRansformer(DETR)モデルです。
このモデルは、サーバーレスのAryn Partitioning Serviceで使用できます。こちらから始めることができます。
🚀 クイックスタート
このモデルは、物体検出に使用できます。利用可能なすべてのDeformable DETRモデルをモデルハブで確認できます。
✨ 主な機能
- エンコーダー - デコーダー型のトランスフォーマーモデルで、畳み込みバックボーンを備えています。
- デコーダーの出力に2つのヘッドを追加して物体検出を行います。クラスラベルには線形層、バウンディングボックスには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 = "https://huggingface.co/Aryn/deformable-detr-DocLayNet/resolve/main/examples/doclaynet_example_1.png"
image = Image.open(requests.get(url, stream=True).raw)
processor = AutoImageProcessor.from_pretrained("Aryn/deformable-detr-DocLayNet")
model = DeformableDetrForObjectDetection.from_pretrained("Aryn/deformable-detr-DocLayNet")
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}"
)
🔧 技術詳細
評価結果
このモデルは、DocLayNetで57.1のボックスmAPを達成しています。
学習データ
Deformable DETRモデルは、DocLayNetで学習されました。DocLayNetは、Pfitzmannらによる論文DocLayNet: A Large Human-Annotated Dataset for Document-Layout Analysisで紹介され、このリポジトリで最初に公開されました。
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ライセンスの下で提供されています。