冬
gcw_IDzXRVNw/mask2former-swin-large-ade-semantic-ascend
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Mask2Former Swin-Large ADE20k Semantic Segmentation (Ascend NPU)

Model Description

  • Model: facebook/mask2former-swin-large-ade-semantic
  • Task: Universal image segmentation (semantic segmentation on ADE20k)
  • Backbone: Swin Transformer Large (hidden_size=1536)
  • Size: ~826MB

Performance

  • Average inference time: ~350-450 ms on Ascend 910B2
  • NPU Memory: ~1.5-2 GB

Input

  • RGB images of any size
  • Preprocessed via AutoImageProcessor

Output

  • Mask2FormerForUniversalSegmentation outputs with masks_queries_logits
  • 150 segmentation masks per image (ADE20k has 150 classes)

Usage

from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
from PIL import Image
import torch

processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-large-ade-semantic")
model = Mask2FormerForUniversalSegmentation.from_pretrained("facebook/mask2former-swin-large-ade-semantic")

image = Image.open("input.jpg")
inputs = processor(image, return_tensors="pt")
outputs = model(**inputs)

Requirements

  • torch >= 2.0.0
  • torch_npu
  • transformers >= 4.30.0
  • pillow
  • npu-smi