ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Aufgaben
- background removal
- Größen
- s at 512 px
- Installation
pip install libreyolo- Supportstufe
- Nur Inferenz, seit v1.6.0. Nur Vorhersage, Validierung und Export. Trainingsfunktionen sind nicht verfügbar.
- Upstream
- ViTMatte von HUST Vision Lab, MIT code; Apache-2.0 weights. Publikation, Quelle
- Lizenzen
- Code MIT, Gewichte MIT code; Apache-2.0 weights. Kommerzielle Nutzung
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
| Datei | Lizenz der Gewichte |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Jede oben aufgeführte Datei ist heute in der LibreYOLO-Organisation verfügbar und wird bei der ersten Verwendung heruntergeladen.
Licensing
Prüfe die Lizenz im Hugging-Face-Repository der konkreten Gewichte, die du herunterlädst. Jeder Checkpoint in der LibreYOLO-Organisation hat eine Lizenz, und sie ist innerhalb einer Familie nicht immer gleich. Dieses Repository ist die maßgebliche Quelle. Die Zusammenfassung unten beschreibt den Stand bei der letzten Verifizierung dieser Seite.
Dies ist eine Beschreibung der beteiligten Lizenzen und keine Rechtsberatung. Wenn die Antwort kommerziell relevant ist, lies die Lizenzen selbst und hole eigenen Rechtsrat ein.
- Originalarbeit
- ViTMatte, HUST Vision Lab
- Upstream-Lizenz
- MIT code; Apache-2.0 weights
- Upstream-Quelle
- github.com/hustvl/ViTMatte
- LibreYOLO-Code
- MIT
- Gewichte
- MIT code; Apache-2.0 weights, erneut unter huggingface.co/LibreYOLO veröffentlicht
- Einordnung
- 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}
}Aus dem Zitierblock der Autoren unter raw.githubusercontent.com/hustvl/ViTMatte/main/README.md kopiert.