# EoMT

## 概要

[The Encoder-only Mask Transformer](https://www.tue-mps.org/eomt) (EoMT) モデルは、Tommie Kerssies、Niccolò Cavagnero、Alexander Hermans、Narges Norouzi、Giuseppe Averta、Bastian Leibe、Gijs Dubbelman、Daan de Geus による CVPR 2025 のハイライト論文 *[Your ViT is Secretly an Image Segmentation Model](https://huggingface.co/papers/2503.19108)* で紹介されました。EoMT は、Vision Transformer がタスク固有のコンポーネントなしに効率的に画像セグメンテーションを実行できることを示しています。

論文の抄録は以下の通りです。

*Vision Transformers (ViTs) は、さまざまなコンピュータビジョンタスクにおいて、優れた性能とスケーラビリティを示してきました。単一スケールの ViT を画像セグメンテーションに適用するため、既存の方法では、マルチスケール特徴を生成するための畳み込みアダプタ、これらの特徴を融合するためのピクセルデコーダ、そして融合された特徴を用いて予測を行う Transformer デコーダを採用しています。本論文では、十分に大きなモデルと広範な事前学習が与えられた場合、これらのタスク固有のコンポーネントによって導入される帰納的バイアスは、ViT 自体によって学習され得ることを示します。これらの知見に基づき、プレーンな ViT アーキテクチャを再利用して画像セグメンテーションを行う Encoder-only Mask Transformer (EoMT) を提案します。大規模なモデルと事前学習により、EoMT は、タスク固有のコンポーネントを使用する最先端モデルと同等のセグメンテーション精度を達成します。同時に、EoMT はそのアーキテクチャの簡素さにより、これらの方法よりも大幅に高速であり、例えば ViT-L を使用する場合、最大で 4 倍高速です。EoMT は、幅広いモデルサイズにおいて、セグメンテーション精度と予測速度の間の最適なバランスを示しており、計算リソースはアーキテクチャの複雑さを増やすよりも、ViT 自体のスケーリングに費やされるべきであることを示唆しています。*

このモデルは[Yaswanth Gali](https://huggingface.co/yaswanthgali)氏によって提供されました。元のコードは[こちら](https://github.com/tue-mps/eomt)で確認できます。

## アーキテクチャ情報

`EoMT`モデルは、**register tokens**を備えたDINOv2事前学習済みのVision Transformerをバックボーンとして使用しています。EoMTはエンコーダーのみを頼りにセグメンテーションのパイプラインを簡素化し、従来のアプローチで一般的に使用されていたタスク固有のデコーダーの必要性を排除しています。

アーキテクチャの観点から、EoMT は **学習されたクエリ**の小さなセットと、軽量な **マスク予測モジュール**を導入します。これらのクエリはエンコーダの最終ブロックに注入され、画像パッチとオブジェクトクエリ間の **ジョイントアテンション**を可能にします。学習時には、**マスク付きアテンション**を適用して、各クエリが対応する領域に焦点を当てるよう制約します。これにより、クロスアテンションを効果的に模倣します。この制約は **マスクアニーリング戦略**によって段階的に解除され、セグメンテーション性能を損なうことなく、**デコーダ不要の効率的な推論**を実現します。

  <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/eomt_architecture.png"
       alt="drawing" width="500"/>

このモデルは、統一されたアーキテクチャとタスク固有の後処理を用いて、セマンティックセグメンテーション、インスタンスセグメンテーション、パノプティックセグメンテーションをサポートします。

## 使用例

事前学習済みモデルでの推論には、Hugging Face による EoMT の実装を使用します。

### セマンティックセグメンテーション

EoMTモデルは、スライディングウィンドウ推論を用いてセマンティックセグメンテーションを実行します。入力画像は、短い辺がターゲット入力サイズに一致するようにリサイズされ、その後、重複するクロップに分割されます。各クロップはモデルに渡されます。推論後、各クロップから得られた予測ロジットは再結合され、元の画像サイズにリスケールされることで、最終的なセグメンテーションマスクが得られます。

> **注:**   **セマンティックセグメンテーション**でカスタムのターゲットサイズを使用する場合は、次の形式で指定してください: `{"shortest_edge": 512}` ここでは`longest_edge`が指定されていませんが、これは意図的なものです。セマンティックセグメンテーションでは、通常、画像は**最短辺がターゲットサイズ以上になるようにスケーリングされる**ため、longest_edgeは不要です。

```python
import matplotlib.pyplot as plt
import requests
import torch
from PIL import Image

from transformers import AutoImageProcessor, EomtForUniversalSegmentation

model_id = "tue-mps/ade20k_semantic_eomt_large_512"
processor = AutoImageProcessor.from_pretrained(model_id)
model = EomtForUniversalSegmentation.from_pretrained(model_id, device_map="auto")

image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)

inputs = processor(
    images=image,
    return_tensors="pt",
)

with torch.inference_mode():
    outputs = model(**inputs)

# Prepare the original image size in the format (height, width)
target_sizes = [(image.height, image.width)]

# Post-process the model outputs to get final segmentation prediction
preds = processor.post_process_semantic_segmentation(
    outputs,
    target_sizes=target_sizes,
)

# Visualize the segmentation mask
plt.imshow(preds[0])
plt.axis("off")
plt.title("Semantic Segmentation")
plt.show()
```

### インスタンスセグメンテーション

EoMTモデルは、パディング付き推論を用いてインスタンスセグメンテーションを実行します。入力画像は、長い辺がターゲット入力サイズに一致するようにリサイズされ、短い辺はゼロパディングによって正方形に整形されます。生成されたマスクとクラスロジットは、後処理（Mask2Formerから適応）を通じて結合され、統合されたインスタンスセグメンテーションマップが生成されます。これには、セグメントID、クラスラベル、信頼度スコアなどのセグメントメタデータも含まれます。

> **注:**   カスタムなターゲットサイズを使用するには、以下の形式の辞書としてサイズを指定します: `{"shortest_edge": 512, "longest_edge": 512}` インスタンスセグメンテーションとパノプティックセグメンテーションの両方で、入力画像はこのターゲットサイズに**スケーリングおよびパディング**されます。

```python
import matplotlib.pyplot as plt
import requests
import torch
from PIL import Image

from transformers import AutoImageProcessor, EomtForUniversalSegmentation

model_id = "tue-mps/coco_instance_eomt_large_640"
processor = AutoImageProcessor.from_pretrained(model_id)
model = EomtForUniversalSegmentation.from_pretrained(model_id, device_map="auto")

image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)

inputs = processor(
    images=image,
    return_tensors="pt",
)

with torch.inference_mode():
    outputs = model(**inputs)

# Prepare the original image size in the format (height, width)
target_sizes = [(image.height, image.width)]

# Post-process the model outputs to get final segmentation prediction
preds = processor.post_process_instance_segmentation(
    outputs,
    target_sizes=target_sizes,
)

# Visualize the segmentation mask
plt.imshow(preds[0]["segmentation"])
plt.axis("off")
plt.title("Instance Segmentation")
plt.show()
```

### パンセグメンテーション

EoMTモデルは、インスタンスセグメンテーションと同じパディング付き推論戦略を用いてパンノミックセグメンテーションを実行します。パディングと正規化の後、モデルはthing（インスタンス）クラスとstuff（不定形領域）クラスの両方を予測します。得られたマスクとクラスロジットは、後処理（Mask2Formerから適応）を通じて統合され、統一されたパンノミックセグメンテーションマップが生成されます。これには、セグメントID、クラスラベル、信頼度スコアなどのセグメントメタデータも含まれます。

```python
import matplotlib.pyplot as plt
import requests
import torch
from PIL import Image

from transformers import AutoImageProcessor, EomtForUniversalSegmentation

model_id = "tue-mps/coco_panoptic_eomt_large_640"
processor = AutoImageProcessor.from_pretrained(model_id)
model = EomtForUniversalSegmentation.from_pretrained(model_id, device_map="auto")

image = Image.open(requests.get("http://images.cocodataset.org/val2017/000000039769.jpg", stream=True).raw)

inputs = processor(
    images=image,
    return_tensors="pt",
)

with torch.inference_mode():
    outputs = model(**inputs)

# Prepare the original image size in the format (height, width)
target_sizes = [(image.height, image.width)]

# Post-process the model outputs to get final segmentation prediction
preds = processor.post_process_panoptic_segmentation(
    outputs,
    target_sizes=target_sizes,
)

# Visualize the panoptic segmentation mask
plt.imshow(preds[0]["segmentation"])
plt.axis("off")
plt.title("Panoptic Segmentation")
plt.show()
```

## EomtImageProcessor[[transformers.EomtImageProcessor]]

#### transformers.EomtImageProcessor[[transformers.EomtImageProcessor]]

```python
transformers.EomtImageProcessor(**kwargs: *<class 'transformers.models.eomt.image_processing_eomt.EomtImageProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_eomt.py#L214)

**パラメータ:**

do_convert_rgb (`bool`, *kwargs*, *optional*) : 画像を RGB に変換するかどうか。

do_resize (`bool`, *kwargs*, *任意*, デフォルトは `True`) : 画像をリサイズするかどうか。

size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*、デフォルト値は `{'shortest_edge' : 640, 'longest_edge': 640}`): モデルへの最大入力次元を記述します。

default_to_square (`bool`, *kwargs*, *optional*, デフォルトは `False`) : size が int の場合、リサイズ時に正方形の画像をデフォルトとするかどうか。

crop_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : `center_crop` を適用した後の出力画像のサイズ。

resample (`Annotated[Union[int, PILImageResampling, NoneType], None]`, *kwargs*、デフォルト値は`2`) : 画像のリサイズ時に使用するリサンプリングフィルタです。これは列挙型`PILImageResampling`のいずれかになります。`do_resize`が`True`に設定されている場合のみ、効果が現れます。

do_rescale (`bool`, *kwargs*, *optional*, デフォルトは `True`) : 画像をリスケールするかどうか。

rescale_factor (`float`, *kwargs*, *optional*, デフォルトは `0.00392156862745098`) : `do_rescale` が `True` に設定されている場合、画像をリスケールするための係数。

do_normalize (`bool`, *kwargs*, *optional*, デフォルトは `True`) : 画像を正規化するかどうかを指定します。

image_mean (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*, デフォルトは `[0.485, 0.456, 0.406]`) : 正規化に使用する画像の平均値です。`do_normalize` が `True` に設定されている場合のみ有効です。

image_std (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*, デフォルトは `[0.229, 0.224, 0.225]`) : 正規化に使用する画像の標準偏差。`do_normalize` が `True` に設定されている場合のみ有効です。

do_pad (`bool`, *kwargs*, *任意*、デフォルトは `False`) : 画像にパディングを適用するかどうか。パディングは、バッチ内の最大サイズに合わせるか、画像ごとに固定の正方形サイズに合わせるかのいずれかで行われます。正確なパディング戦略はモデルによって異なります。

pad_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : 画像をパディングするサイズを`{"height": int, "width" int}`で指定します。前処理に提供されたすべての画像サイズより大きい必要があります。`pad_size`が指定されない場合、バッチ内の最大の幅と高さにパディングされます。`do_pad=True.`の場合にのみ適用されます。

do_center_crop (`bool`, *kwargs*, *optional*) : 画像を中央クロップするかどうか。

data_format (`Union[str, ~image_utils.ChannelDimension]`、*kwargs*、*optional*) : 対応するのは `ChannelDimension.FIRST` のみです。slow processors との互換性のために追加されました。

input_data_format (`Union[str, ~image_utils.ChannelDimension]`, *kwargs*, *任意*) : 入力画像のチャネル次元の形式です。設定されていない場合、入力画像からチャネル次元の形式が推論されます。以下のいずれかになります: - `"channels_first"` または `ChannelDimension.FIRST`: (num_channels, height, width) 形式の画像。 - `"channels_last"` または `ChannelDimension.LAST`: (height, width, num_channels) 形式の画像。 - `"none"` または `ChannelDimension.NONE`: (height, width) 形式の画像。

device (`Annotated[Union[str, torch.device, NoneType], None]`, *kwargs*) : 動画を処理するデバイスです。未設定の場合、入力動画からデバイスが推論されます。

return_tensors (`Annotated[str | ~utils.generic.TensorType | None, None]`, *kwargs*) : `'pt'`に設定されている場合はスタックされたテンソルを返し、それ以外の場合はテンソルのリストを返します。

disable_grouping (`bool`, *kwargs*, *optional*) : 画像をサイズごとにグループ化してバッチ処理するのではなく、個別に処理するためにグループ化を無効にするかどうかを指定します。None の場合、画像が CPU にある場合は True、それ以外の場合は False に設定されます。この選択は、https://github.com/huggingface/transformers/pull/38157 に詳しく記載されている実証的な観察に基づいています。

image_seq_length (`int`, *kwargs*, *任意*) : 入力内の各画像に使用される画像トークンの数です。後方互換性のために追加されましたが、将来のモデルではプロセッサの属性として設定されるべきです。

do_split_image (`bool`, *kwargs*, *optional*, デフォルトは `self.do_split_image`) : セマンティックセグメンテーションのために、入力画像を重複するパッチに分割するかどうか。`True` に設定すると、入力画像はパッチ間の重複を伴い、`size["shortest_edge"]` のサイズのパッチに分割されます。それ以外の場合、入力画像はターゲットサイズにパディングされます。

ignore_index (`int`, *kwargs*, *optional*, デフォルトは `self.ignore_index`) : セグメンテーションマップの背景ピクセルに割り当てられるラベルです。指定された場合、セグメンテーションマップ内で 0（背景）と示されているピクセルは `ignore_index` に置き換えられます。

EomtImageProcessor 画像プロセッサを構築します。

#### preprocess[[transformers.EomtImageProcessor.preprocess]]

```python
preprocess(images: typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']], segmentation_maps: list[torch.Tensor] | None = None, instance_id_to_semantic_id: dict[int, int] | None = None, **kwargs: *<class 'transformers.models.eomt.image_processing_eomt.EomtImageProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_eomt.py#L273)

**パラメータ:**

images (`Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]`) : 前処理対象の画像。ピクセル値が 0 から 255 の範囲にある単一の画像またはバッチの画像を想定しています。ピクセル値が 0 から 1 の範囲にある画像を渡す場合は、`do_rescale=False` を設定してください。

segmentation_maps (`ImageInput`, *任意*) : 対応する画像の前処理対象となるセグメンテーションマップ。

instance_id_to_semantic_id (`list[dict[int, int]]` または `dict[int, int]`、*任意*) : オブジェクトインスタンス ID とクラス ID の間のマッピング。

do_convert_rgb (`bool`, *kwargs*, *optional*) : 画像を RGB に変換するかどうか。

do_resize (`bool`, *kwargs*, *optional*) : 画像をリサイズするかどうか。

size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : モデルへの最大入力次元を記述します。

default_to_square (`bool`, *kwargs*, *optional*) : size が int の場合、リサイズ時に正方形の画像をデフォルトとするかどうか。

crop_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : `center_crop` を適用した後の出力画像のサイズ。

resample (`Annotated[Union[int, PILImageResampling, NoneType], None]`, *kwargs*) : 画像をリサイズする場合に使用するリサンプリングフィルタ。`PILImageResampling` の列挙型のいずれかです。`do_resize` が `True` に設定されている場合のみ有効です。

do_rescale (`bool`, *kwargs*, *任意*) : 画像をリスケールするかどうか。

rescale_factor (`float`, *kwargs*, *optional*) : `do_rescale` が `True` に設定されている場合、画像をリサイズするためのリスケール係数。

do_normalize (`bool`, *kwargs*, *optional*) : 画像を正規化するかどうかを指定します。

image_mean (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*) : 正規化に使用する画像の平均値。`do_normalize` が `True` に設定されている場合のみ有効です。

image_std (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*) : 正規化に使用する画像の標準偏差。`do_normalize` が `True` に設定されている場合のみ有効です。

do_pad (`bool`, *kwargs*, *任意*) : 画像にパディングを適用するかどうか。パディングは、バッチ内の最大サイズに合わせるか、画像ごとに固定の正方形サイズに合わせるかのいずれかで行われます。正確なパディング戦略はモデルによって異なります。

pad_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : 画像をパディングするサイズを`{"height": int, "width" int}`で指定します。前処理に提供されたすべての画像サイズより大きい必要があります。`pad_size`が指定されない場合、バッチ内の最大の幅と高さにパディングされます。`do_pad=True.`の場合にのみ適用されます。

do_center_crop (`bool`, *kwargs*, *optional*) : 画像を中央クロップするかどうか。

data_format (`Union[str, ~image_utils.ChannelDimension]`、*kwargs*、*optional*) : 対応するのは `ChannelDimension.FIRST` のみです。slow processors との互換性のために追加されました。

input_data_format (`Union[str, ~image_utils.ChannelDimension]`, *kwargs*, *任意*) : 入力画像のチャネル次元の形式です。設定されていない場合、入力画像からチャネル次元の形式が推論されます。以下のいずれかになります: - `"channels_first"` または `ChannelDimension.FIRST`: (num_channels, height, width) 形式の画像。 - `"channels_last"` または `ChannelDimension.LAST`: (height, width, num_channels) 形式の画像。 - `"none"` または `ChannelDimension.NONE`: (height, width) 形式の画像。

device (`Annotated[Union[str, torch.device, NoneType], None]`, *kwargs*) : 動画を処理するデバイスです。未設定の場合、入力動画からデバイスが推論されます。

return_tensors (`Annotated[str | ~utils.generic.TensorType | None, None]`, *kwargs*) : `'pt'`に設定されている場合はスタックされたテンソルを返し、それ以外の場合はテンソルのリストを返します。

disable_grouping (`bool`, *kwargs*, *optional*) : 画像をサイズごとにグループ化してバッチ処理するのではなく、個別に処理するためにグループ化を無効にするかどうかを指定します。None の場合、画像が CPU にある場合は True、それ以外の場合は False に設定されます。この選択は、https://github.com/huggingface/transformers/pull/38157 に詳しく記載されている実証的な観察に基づいています。

image_seq_length (`int`, *kwargs*, *任意*) : 入力内の各画像に使用される画像トークンの数です。後方互換性のために追加されましたが、将来のモデルではプロセッサの属性として設定されるべきです。

do_split_image (`bool`, *kwargs*, *optional*, デフォルトは `self.do_split_image`) : セマンティックセグメンテーションのために、入力画像を重複するパッチに分割するかどうかを指定します。`True` に設定すると、入力画像はパッチ間の重複を伴い、`size["shortest_edge"]` のサイズのパッチに分割されます。それ以外の場合、入力画像はターゲットサイズにパディングされます。

ignore_index (`int`, *kwargs*, *optional*, デフォルトは `self.ignore_index`) : セグメンテーションマップの背景ピクセルに割り当てられるラベルです。指定された場合、セグメンテーションマップ内で 0（背景）と示されているピクセルは `ignore_index` に置き換えられます。

**戻り値:** `~image_processing_base.BatchFeature`

- **data** (`dict`) -- __call__ メソッドによって返されるリスト/配列/テンソルの辞書（'pixel_values' など）。
- **tensor_type** (`Union[None, str, TensorType]`、*省略可*) -- 初期化時に PyTorch/Numpy の Tensor 内の整数リストを変換するために、ここで tensor_type を指定できます。

#### post_process_semantic_segmentation[[transformers.EomtImageProcessor.post_process_semantic_segmentation]]

```python
post_process_semantic_segmentation(outputs, target_sizes: list, size: dict[str, int] | None = None, return_segmentation_scores: bool = False)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_eomt.py#L502)

**パラメータ:**

outputs ([EomtForUniversalSegmentation](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtForUniversalSegmentation)) : モデルの生出力。

target_sizes (`list[tuple[int, int]]`) : バッチ内の各画像のターゲットサイズ（高さ、幅）を含むタプルのリスト (`tuple[int, int]`)。

size (`dict[str, int]`, *任意*) : 中間マスクを補間するサイズ。デフォルトは `self.size` です。

return_segmentation_scores (`bool`、*任意*、デフォルトは`False`) : セグメンテーションマップとともにセグメンテーションスコアを返すかどうか。`True`の場合、返されるリストの各要素は、`segmentation`（クラス ID、形状`(height, width)`）と`segmentation_scores`（形状`(num_classes, height, width)`）というフィールドを持つ`SemanticSegmentationPostProcessorOutput`です。

**戻り値:** `list[torch.Tensor]` または `list[SemanticSegmentationPostProcessorOutput]`

`return_segmentation_scores=False` (デフォルト)の場合、各要素がクラス ID を持つ `(height, width)` のセグメンテーションマップである、長さ `batch_size` のリストが返されます。`return_segmentation_scores=True` の場合、フィールド `segmentation` (クラス ID、形状 `(height, width)`) と `segmentation_scores` (形状 `(num_classes, height, width)`) を持つ `SemanticSegmentationPostProcessorOutput` のリストが返されます。どちらの場合も、`(height, width)` はターゲットサイズに対応します。

[EomtForUniversalSegmentation](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtForUniversalSegmentation) の出力をセマンティックセグメンテーションマップに変換します。

#### post_process_instance_segmentation[[transformers.EomtImageProcessor.post_process_instance_segmentation]]

```python
post_process_instance_segmentation(outputs, target_sizes: list, threshold: float = 0.8, size: dict[str, int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_eomt.py#L635)

モデルの出力を後処理して、Instance Segmentation Predictionsに変換します。

#### post_process_panoptic_segmentation[[transformers.EomtImageProcessor.post_process_panoptic_segmentation]]

```python
post_process_panoptic_segmentation(outputs, target_sizes: list, threshold: float = 0.8, mask_threshold: float = 0.5, overlap_mask_area_threshold: float = 0.8, stuff_classes: list[int] | None = None, size: dict[str, int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_eomt.py#L578)

モデルの出力を後処理し、最終的なパノプティックセグメンテーション予測を生成します。

## EomtImageProcessorPil[[transformers.EomtImageProcessorPil]]

#### transformers.EomtImageProcessorPil[[transformers.EomtImageProcessorPil]]

```python
transformers.EomtImageProcessorPil(**kwargs: *<class 'transformers.models.eomt.image_processing_pil_eomt.EomtImageProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_pil_eomt.py#L215)

**パラメータ:**

do_convert_rgb (`bool`, *kwargs*, *optional*) : 画像を RGB に変換するかどうか。

do_resize (`bool`, *kwargs*, *任意*, デフォルトは `True`) : 画像をリサイズするかどうか。

size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*、デフォルト値は `{'shortest_edge' : 640, 'longest_edge': 640}`): モデルへの最大入力次元を記述します。

default_to_square (`bool`, *kwargs*, *optional*, デフォルトは `False`) : size が int の場合、リサイズ時に正方形の画像をデフォルトとするかどうか。

crop_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : `center_crop` を適用した後の出力画像のサイズ。

resample (`Annotated[Union[int, PILImageResampling, NoneType], None]`, *kwargs*、デフォルト値は`2`) : 画像のリサイズ時に使用するリサンプリングフィルタです。これは列挙型`PILImageResampling`のいずれかになります。`do_resize`が`True`に設定されている場合のみ、効果が現れます。

do_rescale (`bool`, *kwargs*, *optional*, デフォルトは `True`) : 画像をリスケールするかどうか。

rescale_factor (`float`, *kwargs*, *optional*, デフォルトは `0.00392156862745098`) : `do_rescale` が `True` に設定されている場合、画像をリスケールするための係数。

do_normalize (`bool`, *kwargs*, *optional*, デフォルトは `True`) : 画像を正規化するかどうかを指定します。

image_mean (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*, デフォルトは `[0.485, 0.456, 0.406]`) : 正規化に使用する画像の平均値です。`do_normalize` が `True` に設定されている場合のみ有効です。

image_std (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*, デフォルトは `[0.229, 0.224, 0.225]`) : 正規化に使用する画像の標準偏差。`do_normalize` が `True` に設定されている場合のみ有効です。

do_pad (`bool`, *kwargs*, *任意*、デフォルトは `False`) : 画像にパディングを適用するかどうか。パディングは、バッチ内の最大サイズに合わせるか、画像ごとに固定の正方形サイズに合わせるかのいずれかで行われます。正確なパディング戦略はモデルによって異なります。

pad_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : 画像をパディングするサイズを`{"height": int, "width" int}`で指定します。前処理に提供されたすべての画像サイズより大きい必要があります。`pad_size`が指定されない場合、バッチ内の最大の幅と高さにパディングされます。`do_pad=True.`の場合にのみ適用されます。

do_center_crop (`bool`, *kwargs*, *optional*) : 画像を中央クロップするかどうか。

data_format (`Union[str, ~image_utils.ChannelDimension]`、*kwargs*、*optional*) : 対応するのは `ChannelDimension.FIRST` のみです。slow processors との互換性のために追加されました。

input_data_format (`Union[str, ~image_utils.ChannelDimension]`, *kwargs*, *任意*) : 入力画像のチャネル次元の形式です。設定されていない場合、入力画像からチャネル次元の形式が推論されます。以下のいずれかになります: - `"channels_first"` または `ChannelDimension.FIRST`: (num_channels, height, width) 形式の画像。 - `"channels_last"` または `ChannelDimension.LAST`: (height, width, num_channels) 形式の画像。 - `"none"` または `ChannelDimension.NONE`: (height, width) 形式の画像。

device (`Annotated[Union[str, torch.device, NoneType], None]`, *kwargs*) : 動画を処理するデバイスです。未設定の場合、入力動画からデバイスが推論されます。

return_tensors (`Annotated[str | ~utils.generic.TensorType | None, None]`, *kwargs*) : `'pt'`に設定されている場合はスタックされたテンソルを返し、それ以外の場合はテンソルのリストを返します。

disable_grouping (`bool`, *kwargs*, *optional*) : 画像をサイズごとにグループ化してバッチ処理するのではなく、個別に処理するためにグループ化を無効にするかどうかを指定します。None の場合、画像が CPU にある場合は True、それ以外の場合は False に設定されます。この選択は、https://github.com/huggingface/transformers/pull/38157 に詳しく記載されている実証的な観察に基づいています。

image_seq_length (`int`, *kwargs*, *任意*) : 入力内の各画像に使用される画像トークンの数です。後方互換性のために追加されましたが、将来のモデルではプロセッサの属性として設定されるべきです。

do_split_image (`bool`, *kwargs*, *optional*, デフォルトは `self.do_split_image`) : セマンティックセグメンテーションのために、入力画像を重複するパッチに分割するかどうか。`True` に設定すると、入力画像はパッチ間の重複を伴い、`size["shortest_edge"]` のサイズのパッチに分割されます。それ以外の場合、入力画像はターゲットサイズにパディングされます。

ignore_index (`int`, *kwargs*, *optional*, デフォルトは `self.ignore_index`) : セグメンテーションマップの背景ピクセルに割り当てられるラベルです。指定された場合、セグメンテーションマップ内で 0（背景）と示されているピクセルは `ignore_index` に置き換えられます。

EomtImageProcessor 画像プロセッサを構築します。

#### preprocess[[transformers.EomtImageProcessorPil.preprocess]]

```python
preprocess(images: typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']], segmentation_maps: list[torch.Tensor] | None = None, instance_id_to_semantic_id: dict[int, int] | None = None, **kwargs: *<class 'transformers.models.eomt.image_processing_pil_eomt.EomtImageProcessorKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_pil_eomt.py#L281)

**パラメータ:**

images (`Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]`) : 前処理対象の画像。ピクセル値が 0 から 255 の範囲にある単一の画像またはバッチの画像を想定しています。ピクセル値が 0 から 1 の範囲にある画像を渡す場合は、`do_rescale=False` を設定してください。

segmentation_maps (`ImageInput`, *任意*) : 対応する画像の前処理対象となるセグメンテーションマップ。

instance_id_to_semantic_id (`list[dict[int, int]]` または `dict[int, int]`、*任意*) : オブジェクトインスタンス ID とクラス ID の間のマッピング。

do_convert_rgb (`bool`, *kwargs*, *optional*) : 画像を RGB に変換するかどうか。

do_resize (`bool`, *kwargs*, *optional*) : 画像をリサイズするかどうか。

size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : モデルへの最大入力次元を記述します。

default_to_square (`bool`, *kwargs*, *optional*) : size が int の場合、リサイズ時に正方形の画像をデフォルトとするかどうか。

crop_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : `center_crop` を適用した後の出力画像のサイズ。

resample (`Annotated[Union[int, PILImageResampling, NoneType], None]`, *kwargs*) : 画像をリサイズする場合に使用するリサンプリングフィルタ。`PILImageResampling` の列挙型のいずれかです。`do_resize` が `True` に設定されている場合のみ有効です。

do_rescale (`bool`, *kwargs*, *任意*) : 画像をリスケールするかどうか。

rescale_factor (`float`, *kwargs*, *optional*) : `do_rescale` が `True` に設定されている場合、画像をリサイズするためのリスケール係数。

do_normalize (`bool`, *kwargs*, *optional*) : 画像を正規化するかどうかを指定します。

image_mean (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*) : 正規化に使用する画像の平均値。`do_normalize` が `True` に設定されている場合のみ有効です。

image_std (`Union[float, list[float], tuple[float, ...]]`, *kwargs*, *optional*) : 正規化に使用する画像の標準偏差。`do_normalize` が `True` に設定されている場合のみ有効です。

do_pad (`bool`, *kwargs*, *任意*) : 画像にパディングを適用するかどうか。パディングは、バッチ内の最大サイズに合わせるか、画像ごとに固定の正方形サイズに合わせるかのいずれかで行われます。正確なパディング戦略はモデルによって異なります。

pad_size (`Annotated[int | list[int] | tuple[int, ...] | dict[str, int] | None, None]`, *kwargs*) : 画像をパディングするサイズを`{"height": int, "width" int}`で指定します。前処理に提供されたすべての画像サイズより大きい必要があります。`pad_size`が指定されない場合、バッチ内の最大の幅と高さにパディングされます。`do_pad=True.`の場合にのみ適用されます。

do_center_crop (`bool`, *kwargs*, *optional*) : 画像を中央クロップするかどうか。

data_format (`Union[str, ~image_utils.ChannelDimension]`、*kwargs*、*optional*) : 対応するのは `ChannelDimension.FIRST` のみです。slow processors との互換性のために追加されました。

input_data_format (`Union[str, ~image_utils.ChannelDimension]`, *kwargs*, *任意*) : 入力画像のチャネル次元の形式です。設定されていない場合、入力画像からチャネル次元の形式が推論されます。以下のいずれかになります: - `"channels_first"` または `ChannelDimension.FIRST`: (num_channels, height, width) 形式の画像。 - `"channels_last"` または `ChannelDimension.LAST`: (height, width, num_channels) 形式の画像。 - `"none"` または `ChannelDimension.NONE`: (height, width) 形式の画像。

device (`Annotated[Union[str, torch.device, NoneType], None]`, *kwargs*) : 動画を処理するデバイスです。未設定の場合、入力動画からデバイスが推論されます。

return_tensors (`Annotated[str | ~utils.generic.TensorType | None, None]`, *kwargs*) : `'pt'`に設定されている場合はスタックされたテンソルを返し、それ以外の場合はテンソルのリストを返します。

disable_grouping (`bool`, *kwargs*, *optional*) : 画像をサイズごとにグループ化してバッチ処理するのではなく、個別に処理するためにグループ化を無効にするかどうかを指定します。None の場合、画像が CPU にある場合は True、それ以外の場合は False に設定されます。この選択は、https://github.com/huggingface/transformers/pull/38157 に詳しく記載されている実証的な観察に基づいています。

image_seq_length (`int`, *kwargs*, *任意*) : 入力内の各画像に使用される画像トークンの数です。後方互換性のために追加されましたが、将来のモデルではプロセッサの属性として設定されるべきです。

do_split_image (`bool`, *kwargs*, *optional*, デフォルトは `self.do_split_image`) : セマンティックセグメンテーションのために、入力画像を重複するパッチに分割するかどうか。`True` に設定すると、入力画像はパッチ間の重複を伴い、`size["shortest_edge"]` のサイズのパッチに分割されます。それ以外の場合、入力画像はターゲットサイズにパディングされます。

ignore_index (`int`, *kwargs*, *optional*, デフォルトは `self.ignore_index`) : セグメンテーションマップの背景ピクセルに割り当てられるラベルです。指定された場合、セグメンテーションマップ内で 0（背景）と示されているピクセルは `ignore_index` に置き換えられます。

**戻り値:** `~image_processing_base.BatchFeature`

- **data** (`dict`) -- __call__ メソッドによって返されるリスト/配列/テンソルの辞書（'pixel_values' など）。
- **tensor_type** (`Union[None, str, TensorType]`、*省略可*) -- 初期化時に PyTorch/Numpy の Tensor 内の整数リストを変換するために、ここで tensor_type を指定できます。

#### post_process_semantic_segmentation[[transformers.EomtImageProcessorPil.post_process_semantic_segmentation]]

```python
post_process_semantic_segmentation(outputs, target_sizes: list, size: dict[str, int] | None = None, return_segmentation_scores: bool = False)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_pil_eomt.py#L495)

**パラメータ:**

outputs ([EomtForUniversalSegmentation](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtForUniversalSegmentation)) : モデルの生出力。

target_sizes (`list[tuple[int, int]]`) : バッチ内の各画像のターゲットサイズ（高さ、幅）を含むタプルのリスト (`tuple[int, int]`)。

size (`dict[str, int]`, *optional*) : 中間マスクを補間するサイズ。デフォルトは `self.size` です。

return_segmentation_scores (`bool`、*任意*、デフォルトは`False`) : セグメンテーションマップとともにセグメンテーションスコアを返すかどうか。`True`の場合、返されるリストの各要素は、`segmentation`（クラス ID、形状`(height, width)`）と`segmentation_scores`（形状`(num_classes, height, width)`）というフィールドを持つ`SemanticSegmentationPostProcessorOutput`です。

**戻り値:** `list[torch.Tensor]` または `list[SemanticSegmentationPostProcessorOutput]`

`return_segmentation_scores=False` (デフォルト)の場合、長さが`batch_size`のリストが返され、各要素はクラス ID を持つ`(height, width)`のセグメンテーションマップです。`return_segmentation_scores=True`の場合、`SemanticSegmentationPostProcessorOutput`のリストが返され、フィールド`segmentation`(クラス ID、形状`(height, width)`)と`segmentation_scores`(形状`(num_classes, height, width)`)を持ちます。どちらの場合も、`(height, width)`はターゲットサイズに対応します。

[EomtForUniversalSegmentation](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtForUniversalSegmentation) の出力をセマンティックセグメンテーションマップに変換します。

#### post_process_instance_segmentation[[transformers.EomtImageProcessorPil.post_process_instance_segmentation]]

```python
post_process_instance_segmentation(outputs, target_sizes: list, threshold: float = 0.8, size: dict[str, int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_pil_eomt.py#L620)

モデルの出力を後処理して、Instance Segmentation Predictionsに変換します。

#### post_process_panoptic_segmentation[[transformers.EomtImageProcessorPil.post_process_panoptic_segmentation]]

```python
post_process_panoptic_segmentation(outputs, target_sizes: list, threshold: float = 0.8, mask_threshold: float = 0.5, overlap_mask_area_threshold: float = 0.8, stuff_classes: list[int] | None = None, size: dict[str, int] | None = None)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/image_processing_pil_eomt.py#L567)

モデルの出力を後処理し、最終的なパノプティックセグメンテーション予測を生成します。

## EomtConfig[[transformers.EomtConfig]]

#### transformers.EomtConfig[[transformers.EomtConfig]]

```python
transformers.EomtConfig(transformers_version: str | None = None, architectures: list[str] | None = None, output_hidden_states: bool | None = False, return_dict: bool | None = True, dtype: str | torch.dtype | None = None, chunk_size_feed_forward: int = 0, is_encoder_decoder: bool = False, id2label: dict[int, str] | dict[str, str] | None = None, label2id: dict[str, int] | dict[str, str] | None = None, problem_type: Literal['regression', 'single_label_classification', 'multi_label_classification'] | None = None, hidden_size: int = 1024, num_hidden_layers: int = 24, num_attention_heads: int = 16, hidden_act: str = 'gelu', hidden_dropout_prob: float | int = 0.0, initializer_range: float = 0.02, layer_norm_eps: float = 1e-06, image_size: int | list[int] | tuple[int, int] = 640, patch_size: int | list[int] | tuple[int, int] = 16, num_channels: int = 3, mlp_ratio: int = 4, layerscale_value: float = 1.0, drop_path_rate: float | int = 0.0, num_upscale_blocks: int = 2, attention_dropout: float | int = 0.0, use_swiglu_ffn: bool = False, num_blocks: int = 4, no_object_weight: float = 0.1, class_weight: float = 2.0, mask_weight: float = 5.0, dice_weight: float = 5.0, train_num_points: int = 12544, oversample_ratio: float = 3.0, importance_sample_ratio: float = 0.75, num_queries: int = 200, num_register_tokens: int = 4)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/configuration_eomt.py#L28)

**パラメータ:**

hidden_size (`int`、*任意*、デフォルトは`1024`) : 隠れ表現の次元数。

num_hidden_layers (`int`、*optional*、デフォルトは `24`) : Transformer デコーダーの隠れ層の数。

num_attention_heads (`int`、*任意*、デフォルトは`16`) : Transformerデコーダーの各アテンション層におけるアテンションヘッドの数。

hidden_act (`str`、*任意*、デフォルトは`gelu`) : デコーダーで使用する非線形活性化関数（関数または文字列）。例えば、`"gelu"`、`"relu"`、`"silu"`など。

hidden_dropout_prob (`Union[float, int]`、*任意*、デフォルトは`0.0`) : embeddings、encoder、pooler 内のすべての全結合層における dropout 確率。

initializer_range (`float`、*任意*、デフォルトは`0.02`) : すべての重み行列を初期化するためのtruncated_normal_initializerの標準偏差です。

layer_norm_eps (`float`、*任意*、デフォルトは`1e-06`) : Layer Normalization 層で使用する epsilon です。

image_size (`Union[int, list[int], tuple[int, int]]`、*任意*、デフォルトは`640`) : 各画像のサイズ（解像度）。

patch_size (`Union[int, list[int], tuple[int, int]]`、*任意*、デフォルトは`16`) : 各パッチのサイズ（解像度）。

num_channels (`int`、*任意*、デフォルトは`3`) : 入力チャネル数。

mlp_ratio (`int`、*任意*、デフォルトは`4`) : MLPの隠れ層次元と埋め込み次元の比率。

layerscale_value (`float`、*任意*、デフォルト値は 1.0) : LayerScale パラメータの初期値。

drop_path_rate (`Union[float, int]`、*任意*、デフォルトは`0.0`) : パッチ融合のドロップパス率。

num_upscale_blocks (`int`、*optional*、デフォルトは 2) : デコーダーまたはセグメンテーションヘッドで使用するアップサンプリングブロックの数。

attention_dropout (`Union[float, int]`、*任意*、デフォルトは`0.0`) : 注意確率のドロップアウト率。

use_swiglu_ffn (`bool`, *任意*, デフォルトは `False`) : SwiGLUフィードフォワードニューラルネットワークを使用するかどうか。

num_blocks (`int`、*任意*、デフォルトは 4) : アーキテクチャにおける特徴量ブロックまたはステージの数。

no_object_weight (`float`、*任意*、デフォルト値は 0.1) : パノプティック/インスタンスセグメンテーションにおける 'no object' クラスの損失重み。

class_weight (`float`、*任意*、デフォルト値は 2.0) : 分類ターゲットの損失重み。

mask_weight (`float`、*任意*、デフォルト値は 5.0) : マスク予測の損失重み。

dice_weight (`float`、*任意*、デフォルトは `5.0`) : パノプティックセグメンテーション損失における dice loss の相対的な重み。

train_num_points (`int`、*optional*、デフォルトは 12544) : 学習中のマスク損失の計算のためにサンプリングする点の数。

oversample_ratio (`float`、*任意*、デフォルト値は 3.0) : マスク学習におけるポイントサンプリングで使用するオーバーサンプリング比率。

importance_sample_ratio (`float`、*任意*、デフォルトは 0.75) : 学習中に重要度に基づいてサンプリングするポイントの比率。

num_queries (`int`、*任意*、デフォルトは 200) : Transformer におけるオブジェクトクエリの数。

num_register_tokens (`int`、*任意*、デフォルトは 4) : Transformer の入力に追加される学習可能なレジスタトークンの数。

これは EomtModel の設定を保存するための設定クラスです。指定された引数に基づいて Eomt モデルをインスタンス化し、モデルのアーキテクチャを定義するために使用されます。デフォルト値で設定をインスタンス化すると、[tue-mps/coco_panoptic_eomt_large_640](https://huggingface.co/tue-mps/coco_panoptic_eomt_large_640) と同様の設定が得られます。

設定オブジェクトは [PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) を継承し、モデルの出力を制御するために使用できます。詳細については、[PreTrainedConfig](/docs/transformers/main/ja/main_classes/configuration#transformers.PreTrainedConfig) のドキュメントを参照してください。

例:

```python
>>> from transformers import EomtConfig, EomtForUniversalSegmentation

>>> # Initialize configuration
>>> config = EomtConfig()

>>> # Initialize model
>>> model = EomtForUniversalSegmentation(config)

>>> # Access config
>>> config = model.config
```

## EomtForUniversalSegmentation[[transformers.EomtForUniversalSegmentation]]

#### transformers.EomtForUniversalSegmentation[[transformers.EomtForUniversalSegmentation]]

```python
transformers.EomtForUniversalSegmentation(config: EomtConfig)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/modeling_eomt.py#L1016)

**パラメータ:**

config ([EomtConfig](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtConfig)) : モデルのパラメータをすべて含むモデル設定クラスです。設定ファイルで初期化しても、モデルに関連付けられた重みは読み込まれず、設定のみが読み込まれます。モデルの重みをロードするには、[from_pretrained()](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel.from_pretrained) メソッドを参照してください。

インスタンス／セマンティック／パノプティックセグメンテーション用に、上部にヘッドを備えたEoMTモデル。

このモデルは [PreTrainedModel](/docs/transformers/main/ja/main_classes/model#transformers.PreTrainedModel) を継承しています。ライブラリがすべてのモデルに対して実装している汎用的なメソッド（ダウンロードや保存、入力埋め込みのリサイズ、ヘッドのプルーニングなど）については、スーパークラスのドキュメントを参照してください。

このモデルは、PyTorchの[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)のサブクラスでもあります。通常のPyTorch Moduleとして使用し、一般的な使用方法や動作に関する詳細については、PyTorchのドキュメントを参照してください。

#### forward[[transformers.EomtForUniversalSegmentation.forward]]

```python
forward(pixel_values: Tensor, mask_labels: list[torch.Tensor] | None = None, class_labels: list[torch.Tensor] | None = None, patch_offsets: list[torch.Tensor] | None = None, **kwargs: *<class 'transformers.utils.generic.TransformersKwargs'>)
```

[ソース](https://github.com/huggingface/transformers/blob/main/src/transformers/models/eomt/modeling_eomt.py#L1074)

**パラメータ:**

pixel_values (`torch.Tensor`、shape `(batch_size, num_channels, image_size, image_size)`) : 入力画像に対応するテンソルです。ピクセル値は [EomtImageProcessor](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtImageProcessor) を使用して取得できます。詳細については [EomtImageProcessor.__call__()](/docs/transformers/main/ja/model_doc/molmo2#transformers.Molmo2ImageProcessor.__call__) を参照してください（`processor_class` は画像の処理に [EomtImageProcessor](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtImageProcessor) を使用します）。

mask_labels (`list[torch.Tensor]`、*任意*) : モデルに渡す、`(num_labels, height, width)` の形状を持つマスクラベルのリスト

class_labels (`list[torch.LongTensor]`, *任意*) : モデルに渡す、`(num_labels, height, width)` の形状を持つターゲットクラスラベルのリスト。`mask_labels` のラベルを特定します。例えば、`class_labels[i][j]` の場合の `mask_labels[i][j]` のラベルなどです。

patch_offsets (`list[torch.Tensor]`, *任意*) : セマンティックセグメンテーションにおける、パッチの画像インデックスおよび開始位置と終了位置を示すタプルのリスト。

**戻り値:** `EomtForUniversalSegmentationOutput` または `tuple(torch.FloatTensor)`

`EomtForUniversalSegmentationOutput`、または`torch.FloatTensor`のタプル（`return_dict=False`が渡された場合、または`config.return_dict=False`の場合）。設定（[EomtConfig](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtConfig)）や入力に応じて、さまざまな要素で構成されます。

[EomtForUniversalSegmentation](/docs/transformers/main/ja/model_doc/eomt#transformers.EomtForUniversalSegmentation)のforwardメソッドは、`__call__`特殊メソッドをオーバーライドします。

この関数内でフォワードパスの手順を定義する必要がありますが、その後、この関数ではなく`Module`インスタンスを呼び出すべきです。前者は前処理と後処理の実行を適切に処理するのに対し、後者はそれらを無視してしまいます。

- **loss** (`torch.Tensor`, *optional*) -- ラベルが存在する場合に返される、計算された損失。
- **class_queries_logits** (`torch.FloatTensor`, *optional*) -- 各クエリに対して提案されるクラスを表す、形状が `(batch_size, num_queries, num_labels + 1)` のテンソルです。`+ 1` が必要なのは、null クラスを含めるためです。
- **masks_queries_logits** (`torch.FloatTensor`, *オプション*) -- 各クエリに対する提案マスクを表す、形状が `(batch_size, num_queries, height, width)` のテンソル。
- **last_hidden_state** (`torch.FloatTensor`、shape `(batch_size, num_channels, height, width)`) -- 最終層の最後の隠れ状態（最終的な特徴マップ）。
- **hidden_states** (`tuple(torch.FloatTensor)`、*optional*、`output_hidden_states=True` が渡された場合または `config.output_hidden_states=True` の場合に返されます) -- `torch.FloatTensor` のタプル（埋め込みの出力用 1 つ + 各ステージの出力用 1 つ）、形状は `(batch_size, sequence_length, hidden_size)`。モデルの全レイヤーの隠れ状態です。
- **attentions** (`tuple(tuple(torch.FloatTensor))`、*optional*、`output_attentions=True` が渡された場合または `config.output_attentions=True` の場合に返されます) -- `tuple(torch.FloatTensor)` のタプル（各レイヤーごとに1つ）、形状は `(batch_size, num_heads, sequence_length, sequence_length)`。transformer デコーダーからの Self Attention と Cross Attention の重み。
- **patch_offsets** (`list[torch.Tensor]`、*省略可*) -- セマンティックセグメンテーションにおけるパッチの画像インデックスおよび開始・終了位置を示すタプルのリスト。

