/ Модель

Характеристики

Лицензия
Apache 2.0
Библиотека
onnx
Опубликована
20 ноя 2026

efficientvit-ONNX

Генерация масокИзображение → mask3 профессии

Экспорт EfficientViT-SAM L2 в ONNX для сегментации объектов на изображениях по точкам или рамке с запуском через ONNX Runtime.

0скачиваний за 30 дней0лайковвеса обновлены20 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Это экспорт EfficientViT-SAM L2 в формат ONNX от Moonbox для запуска на устройствах через ONNX Runtime. Модель объединяет EfficientViT-L2 как визуальный энкодер с prompt encoder и декодером масок SAM; размер исходной модели — 61 млн параметров, входное изображение обрабатывается с разрешением 512 пикселей. Репозиторий содержит графы ONNX и Python-конвейер для предобработки изображений, преобразования координат подсказок и увеличения масок.

Модель предназначена для сегментации объектов по пользовательским точкам или рамке: конвейер принимает изображение и координаты подсказки, затем возвращает маски и оценки. Доступны варианты точности fp32, int8 и int4; README сообщает о проверке совпадения масок с исходной PyTorch-моделью, но приведённые численные результаты относятся к таблице файлов, часть строк которой пропущена. Поддерживаются CPU, CUDA и DirectML через ONNX Runtime. Лицензия репозитория — Apache-2.0.

Сценарии применения

  • выделение объекта на фото по указанной точке
  • сегментация объекта внутри заданной рамки
  • получение нескольких вариантов маски объекта
  • встраивание сегментации изображений в приложение на устройстве

Ограничения

Модель предназначена для сегментации по визуальным подсказкам, а README не описывает режим сегментации без подсказок или языковой ввод. Поддерживаемые варианты точности и их отдельные показатели в README приведены не полностью.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

EfficientViT-SAM ONNX

ONNX builds of EfficientViT-SAM, made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each precision is one folder holding the graphs and a small Python pipeline.py that does the rest (image preprocessing, prompt coordinates, mask upsampling); what the graphs take and return is under How to run.

Files

The last column is the benchmark against the original PyTorch model (details under How to run): IoU of every predicted mask with the original's on the same pictures and prompts.

PrecisionFileSizesha256Benchmark
fp32fp32/decoder.onnx0.3 MB72ff3fdc36d9mask IoU 0.9999 mean / 0.9991 worst
fp32fp32/decoder.onnx.data16.2 MBdf2017f2c3fcmask IoU 0.9999 mean / 0.9991 worst
fp32fp32/encoder.onnx0.4 MB35d5b72c6f74mask IoU 0.9999 mean / 0.9991 worst
fp32fp32/encoder.onnx.data229.0 MBf5552293e854mask IoU 0.9999 mean / 0.9991 worst
fp32fp32/pipeline.py4.2 kB3cee6dcd2a80mask IoU 0.9999 mean / 0.9991 worst

How to run

EfficientViT-SAM L2 (MIT Han Lab: SAM's prompt encoder and mask decoder on an EfficientViT-L2 image encoder at 512 px, 61 M parameters) as two ONNX graphs plus pipeline.py, a numpy runtime that reproduces the repository's EfficientViTSamPredictor around them.

  • encoder.onnx: EfficientViT-L2 + the SAM neck: image [1, 3, 512, 512] (normalised, padded) -> image_embeddings [1, 256, 64, 64]. Run it once per image.
  • decoder.onnx: SAM's ONNX decoder wrapper (SamOnnxModel, all 4 masks; prompts and masks in the 1024 frame): image_embeddings, point_coords [1, N, 2] and point_labels [1, N] (1 / 0 points, 2 / 3 box corners, -1 padding), mask_input [1, 1, 256, 256], has_mask_input [1], orig_im_size [2] -> masks [1, 4, H, W] (logits at the image size), iou_predictions [1, 4], low_res_masks [1, 4, 256, 256].

pipeline.py resizes the longest side to 512 (Pillow bilinear, as the repository's SamResize), applies SAM's pixel mean / std and pads bottom-right to 512 x 512. It scales the prompt coordinates to the 1024 frame, and returns masks 1-3 for multimask point prompts and mask 0 for a box. It needs numpy, onnxruntime (or onnxruntime-gpu) and Pillow:

import sys, numpy as np
from PIL import Image
sys.path.insert(0, "fp32")
import pipeline
sam = pipeline.EfficientViTSAM("fp32", "cuda")
emb, size = sam.embed(np.array(Image.open("photo.jpg").convert("RGB")))
masks, scores = sam.point(emb, size, [[410, 300]])          # 3 masks [3, H, W] (bool)
box_mask, score = sam.box(emb, size, [120, 80, 700, 560])

Precisions. Only fp32/: the model doesn't survive 16 bits. 30 conv + BatchNorm pairs (every MBConv point conv of stages 3-4, eight in the neck, the stem) have BatchNorm scales above 20, up to 602 (running variance 5.5e-7). Their outputs are differences of terms about 1000x larger than the result. Measured here: fp16 (decoder fp32) worst mask IoU 0.12 (mean 0.89); weight-only int8 mean 0.33. Neither is published.

Benchmark. Eight photos (the first eight of the lab's DIS5K-250 set). Each gets a positive point (the ground-truth foreground pixel nearest its centroid; 3 masks) and the ground truth's bounding box (1 mask), so 32 masks per build. The original is the repository's EfficientViTSamPredictor in float32. The build gets the image it preprocesses and the same prompt coordinates (the conversion measured alone). Pass: IoU with the original's mask at least 0.95 on every mask.

worst mask IoUmean mask IoU
fp32/0.99910.9999

Graphs checked against the original modules (largest absolute difference, float32): encoder 7.0e-5 of 0.58, decoder 2.3e-5 of 14.8 (masks).

How these were made

From EfficientViT-SAM at revision de7d7733cc. The graphs were exported from the original PyTorch modules with torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8 weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was benchmarked against the original before upload (pass: IoU at least 0.95 on every mask, otherwise marked below threshold), and the sha256 column above is what the files must hash to.

License

apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this repository, and it governs your use of these files. The original model card follows unchanged.


Original model card

Efficient Vision Foundation Models for High-Resolution Generation and Perception

PWC

News

  • (🔥 New) [2025/09/05] We will no longer maintain this codebase. All future updates and announcements will be made on DC-Gen.
  • (🔥 New) [2025/01/24] We released DC-AE-SANA-1.1: doc.
  • (🔥 New) [2025/01/23] DC-AE and SANA are accepted by ICLR 2025.
  • (🔥 New) [2025/01/14] We released DC-AE+USiT models: model, training. Using the default training settings and sampling strategy, DC-AE+USiT-2B achieves 1.72 FID on ImageNet 512x512, surpassing the SOTA diffusion model EDM2-XXL and SOTA auto-regressive image generative models (MAGVIT-v2 and MAR-L).

Content

[ICLR 2025] Deep Compression Autoencoder for Efficient High-Resolution Diffusion Models [paper] [readme] [poster]

Deep Compression Autoencoder (DC-AE) is a new family of high-spatial compression autoencoders with a spatial compression ratio of up to 128 while maintaining reconstruction quality. It accelerates all latent diffusion models regardless of the diffusion model architecture.

Demo

demo

demo

[CVPR 2024 eLVM Workshop] EfficientViT-SAM: Accelerated Segment Anything Model Without Accuracy Loss [paper] [online demo] [readme]

EfficientViT-SAM is a new family of accelerated segment anything models by replacing SAM's heavy image encoder with EfficientViT. It delivers a 48.9x measured TensorRT speedup on A100 GPU over SAM-ViT-H without sacrificing accuracy.

[ICCV 2023] EfficientViT-Classification [paper] [readme]

Efficient image classification models with EfficientViT backbones.

[ICCV 2023] EfficientViT-Segmentation [paper] [readme]

Efficient semantic segmantation models with EfficientViT backbones.

demo

EfficientViT-GazeSAM [readme]

Gaze-prompted image segmentation models capable of running in real time with TensorRT on an NVIDIA RTX 4070.

GazeSAM demo

Getting Started

conda create -n efficientvit python=3.10
conda activate efficientvit
pip install -U -r requirements.txt

Third-Party Implementation/Integration

Contact

Han Cai

Reference

If EfficientViT or EfficientViT-SAM or DC-AE is useful or relevant to your research, please kindly recognize our contributions by citing our paper:

@inproceedings{cai2023efficientvit,
  title={Efficientvit: Lightweight multi-scale attention for high-resolution dense prediction},
  author={Cai, Han and Li, Junyan and Hu, Muyan and Gan, Chuang and Han, Song},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={17302--17313},
  year={2023}
}
@article{zhang2024efficientvit,
  title={EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss},
  author={Zhang, Zhuoyang and Cai, Han and Han, Song},
  journal={arXiv preprint arXiv:2402.05008},
  year={2024}
}
@article{chen2024deep,
  title={Deep Compression Autoencoder for Efficient High-Resolution Diffusion Models},
  author={Chen, Junyu and Cai, Han and Chen, Junsong and Xie, Enze and Yang, Shang and Tang, Haotian and Li, Muyang and Lu, Yao and Han, Song},
  journal={arXiv preprint arXiv:2410.10733},
  year={2024}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · onnx

Нельзя запустить

Модель выложена только в формате ONNX, рантайм загружает PyTorch-веса.

Ревизия весов
baea333

0 моделей