ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Tâches
- background removal
- Tailles
- s at 512 px
- Installer
pip install libreyolo- Niveau de support
- Inférence uniquement, depuis v1.6.0. Prédiction, validation et export uniquement. Les fonctionnalités d'entraînement ne s'appliquent pas.
- Licences
- Code MIT, poids MIT code; Apache-2.0 weights. Usage commercial
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
| Fichier | Licence des poids |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Tous les fichiers ci-dessus sont actuellement disponibles dans l<link>organisation LibreYOLO</link> et sont téléchargés à la première utilisation.
Licensing
Vérifiez la licence dans le dépôt Hugging Face des poids précis que vous téléchargez. Chaque checkpoint de l<link>organisation LibreYOLO</link> en possède une, et elles ne sont pas toujours identiques au sein dune même famille. Ce dépôt fait autorité ; le résumé ci-dessous décrit les conditions applicables lors de la dernière vérification de cette page.
Ceci décrit les licences concernées et ne constitue pas un conseil juridique. Si la réponse a une importance commerciale, lisez vous-même les licences et consultez votre propre avocat.
- Travail d'origine
- ViTMatte, HUST Vision Lab
- Licence du projet d'origine
- MIT code; Apache-2.0 weights
- Source du projet d'origine
- github.com/hustvl/ViTMatte
- Code de LibreYOLO
- MIT
- Poids
- MIT code; Apache-2.0 weights, republiés sur huggingface.co/LibreYOLO
- Interprétation
- 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}
}Copié depuis le bloc de citation des auteurs sur raw.githubusercontent.com/hustvl/ViTMatte/main/README.md.