ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Task
- background removal
- Dimensioni
- s at 512 px
- Installa
pip install libreyolo- Livello di supporto
- Solo inferenza, dalla v1.6.0. Solo predizione, validazione ed esportazione. Le funzionalità di addestramento non si applicano.
- Licenze
- Codice MIT, pesi MIT code; Apache-2.0 weights. Uso commerciale
Install
pip install "libreyolo"Predict
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreViTMattes-matte.pt", device="cpu")import numpy as npfrom PIL import Image image = Image.open(SAMPLE_IMAGE).convert("RGB")# An all-unknown guide demonstrates the input contract. Supply a real trimap for matting.trimap = np.full((image.height, image.width), 128, dtype=np.uint8)result = model(image, trimap=trimap)result.save("cutout.png")A trimap marks background as 0, unknown pixels as 128 and foreground as 255. Pass it through trimap= for a single image. Validation accepts trimap_dir or derives guides with trimap_radius. Training and export are not supported.
Validate
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreViTMattes-matte.pt", device="cpu")# A folder with images/ and mattes/ (grayscale alpha mattes, same file stems), or a matte YAML.metrics = model.val(data="path/to/your/matte_dataset", workers=0)print(metrics)Use the dataset format for this task. Validation explains the dataset requirements and returned metrics.
Checkpoints
| File | Licenza dei pesi |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Oggi tutti i file elencati sopra sono presenti nell<link>organizzazione LibreYOLO</link> e vengono scaricati al primo utilizzo.
Licensing
Controlla la licenza nel repository Hugging Face degli specifici pesi che scarichi. Ogni checkpoint nell<link>organizzazione LibreYOLO</link> ne include una e non è sempre la stessa per tutta la famiglia. Quel repository è la fonte autorevole; il riepilogo seguente descrive le condizioni applicabili al momento dellultima verifica di questa pagina.
Questa è una descrizione delle licenze coinvolte, non una consulenza legale. Se la risposta è importante a fini commerciali, leggi personalmente le licenze e chiedi una consulenza indipendente.
- Lavoro originale
- ViTMatte, HUST Vision Lab
- Licenza upstream
- MIT code; Apache-2.0 weights
- Sorgente upstream
- github.com/hustvl/ViTMatte
- Codice LibreYOLO
- MIT
- Pesi
- MIT code; Apache-2.0 weights, ripubblicati su huggingface.co/LibreYOLO
- Interpretazione
- The original code is MIT. The publisher card for hustvl/vitmatte-small-composition-1k declares Apache-2.0 for the weights.
Citation
@article{yao2024vitmatte,
title={ViTMatte: Boosting image matting with pre-trained plain vision transformers},
author={Yao, Jingfeng and Wang, Xinggang and Yang, Shusheng and Wang, Baoyuan},
journal={Information Fusion},
volume={103},
pages={102091},
year={2024},
publisher={Elsevier}
}Copiato dal blocco di citazione degli autori disponibile su raw.githubusercontent.com/hustvl/ViTMatte/main/README.md.