ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Task
- background removal
- Ukuran
- s at 512 px
- Instalasi
pip install libreyolo- Tier dukungan
- Hanya inferensi, sejak v1.6.0. Hanya prediksi, validasi, dan ekspor. Fitur pelatihan tidak berlaku.
- Lisensi
- Kode MIT, bobot MIT code; Apache-2.0 weights. Penggunaan komersial
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
| Berkas | Lisensi bobot |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Setiap berkas di atas saat ini tersedia di organisasi LibreYOLO dan diunduh saat pertama kali digunakan.
Licensing
Periksa lisensi di repositori Hugging Face untuk bobot tertentu yang diunduh. Setiap checkpoint di organisasi LibreYOLO memiliki lisensi, dan lisensinya tidak selalu sama dalam satu family. Repositori tersebut adalah sumber resmi. Ringkasan di bawah menjelaskan ketentuan yang berlaku saat halaman ini terakhir diverifikasi.
Ini adalah deskripsi lisensi yang terlibat, bukan nasihat hukum. Jika jawabannya penting secara komersial, baca sendiri lisensinya dan mintalah nasihat dari penasihat hukum Anda.
- Karya asli
- ViTMatte, HUST Vision Lab
- Lisensi upstream
- MIT code; Apache-2.0 weights
- Sumber upstream
- github.com/hustvl/ViTMatte
- Kode LibreYOLO
- MIT
- Bobot
- MIT code; Apache-2.0 weights, dipublikasikan ulang di huggingface.co/LibreYOLO
- Interpretasi
- 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}
}Disalin dari blok sitasi penulis di raw.githubusercontent.com/hustvl/ViTMatte/main/README.md.