ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Zadania
- background removal
- Rozmiary
- s at 512 px
- Instalacja
pip install libreyolo- Poziom obsługi
- Tylko inferencja, od wersji v1.6.0. Tylko predykcja, walidacja i eksport. Funkcje trenowania nie mają zastosowania.
- Projekt źródłowy
- ViTMatte, autorzy: HUST Vision Lab, licencja: MIT code; Apache-2.0 weights. Publikacja, kod źródłowy
- Licencje
- Kod: MIT, wagi: MIT code; Apache-2.0 weights. Użycie komercyjne
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
| Plik | Licencja wag |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Każdy z powyższych plików jest obecnie dostępny w organizacji LibreYOLO i pobierany przy pierwszym użyciu.
Licensing
Sprawdź licencję w repozytorium konkretnych pobieranych wag na Hugging Face. Każdy checkpoint w organizacji LibreYOLO ma licencję, która nie zawsze jest taka sama w całej rodzinie. To repozytorium jest źródłem rozstrzygającym, a poniższe podsumowanie opisuje stan z chwili ostatniej weryfikacji tej strony.
To opis obowiązujących licencji, a nie porada prawna. Jeśli odpowiedź ma znaczenie komercyjne, przeczytaj licencje i zasięgnij własnej porady prawnej.
- Oryginalna praca
- ViTMatte, HUST Vision Lab
- Licencja projektu źródłowego
- MIT code; Apache-2.0 weights
- Kod źródłowy projektu
- github.com/hustvl/ViTMatte
- Kod LibreYOLO
- MIT
- Wagi
- MIT code; Apache-2.0 weights, ponownie opublikowane w huggingface.co/LibreYOLO
- Interpretacja
- 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}
}Skopiowano z bloku cytowania autorów w raw.githubusercontent.com/hustvl/ViTMatte/main/README.md.