ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- Tác vụ
- background removal
- Kích thước
- s at 512 px
- Cài đặt
pip install libreyolo- Bậc hỗ trợ
- Chỉ suy luận, từ v1.6.0. Chỉ dự đoán, kiểm định và xuất. Không áp dụng các tính năng huấn luyện.
- Giấy phép
- Mã nguồn MIT, trọng số MIT code; Apache-2.0 weights. Sử dụng thương mại
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
| Tệp | Giấy phép trọng số |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
Mọi tệp ở trên hiện đều có trong tổ chức LibreYOLO và được tải xuống trong lần sử dụng đầu tiên.
Licensing
Hãy kiểm tra giấy phép trong repo Hugging Face của trọng số cụ thể mà bạn tải xuống. Mỗi checkpoint trong tổ chức LibreYOLO đều có giấy phép riêng và giấy phép có thể khác nhau trong cùng một họ. Repo đó là nguồn có thẩm quyền; phần tóm tắt dưới đây mô tả các điều khoản áp dụng khi trang này được kiểm chứng lần gần nhất.
Đây là phần mô tả các giấy phép liên quan, không phải tư vấn pháp lý. Nếu câu trả lời có ý nghĩa về mặt thương mại, hãy tự đọc các giấy phép và tham khảo cố vấn của riêng bạn.
- Công trình gốc
- ViTMatte, HUST Vision Lab
- Giấy phép thượng nguồn
- MIT code; Apache-2.0 weights
- Nguồn thượng nguồn
- github.com/hustvl/ViTMatte
- Mã nguồn LibreYOLO
- MIT
- Trọng số
- MIT code; Apache-2.0 weights, được phát hành lại tại huggingface.co/LibreYOLO
- Diễn giải
- 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}
}Được sao chép từ khối trích dẫn của tác giả tại raw.githubusercontent.com/hustvl/ViTMatte/main/README.md.