ViTMatte
ViTMatte predicts a foreground alpha matte from an image and a trimap.
- 작업
- background removal
- 크기
- s at 512 px
- 설치
pip install libreyolo- 지원 티어
- 추론 전용, v1.6.0부터 지원. 예측, 검증, 내보내기만 지원합니다. 학습 기능은 적용되지 않습니다.
- 라이선스
- 코드 MIT, 가중치 MIT code; Apache-2.0 weights. 상업적 사용
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
| 파일 | 가중치 라이선스 |
|---|---|
| Background removal | |
| LibreViTMattes-matte.pt | other |
위의 모든 파일은 현재 LibreYOLO 조직에 있으며 처음 사용할 때 내려받습니다.
Licensing
내려받는 특정 가중치의 Hugging Face 저장소에서 라이선스를 확인하십시오. LibreYOLO 조직의 모든 체크포인트에는 라이선스가 있으며 한 계열 안에서도 항상 같지는 않습니다. 해당 저장소가 신뢰할 수 있는 기준입니다. 아래 요약은 이 페이지를 마지막으로 검증했을 때 적용된 내용을 설명합니다.
관련 라이선스에 관한 설명이며 법률 자문이 아닙니다. 상업적으로 중요한 사안이라면 라이선스를 직접 읽고 별도의 법률 자문을 받으십시오.
- 원작
- ViTMatte, HUST Vision Lab
- 업스트림 라이선스
- MIT code; Apache-2.0 weights
- 업스트림 소스
- github.com/hustvl/ViTMatte
- LibreYOLO 코드
- MIT
- 가중치
- MIT code; Apache-2.0 weights, huggingface.co/LibreYOLO에 다시 게시됨
- 해석
- 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}
}raw.githubusercontent.com/hustvl/ViTMatte/main/README.md에 있는 저자의 인용 블록에서 복사했습니다.