Instructions to use feyninc/multimatte with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- nobg
How to use feyninc/multimatte with nobg:
pip install nobg
# Option 1: use via the predict method from nobg import AutoModel, AutoProcessor model = AutoModel.from_pretrained("feyninc/multimatte").eval() processor = AutoProcessor.from_pretrained("feyninc/multimatte") cutout = model.predict(processor, "image.jpg", "prompt")# Option 2: use the model and processor directly import torch from loadimg import load_img from nobg import AutoModel, AutoProcessor model = AutoModel.from_pretrained("feyninc/multimatte").eval() processor = AutoProcessor.from_pretrained("feyninc/multimatte") image = load_img("image.jpg").convert("RGB") inputs = processor(image, return_tensors="pt") with torch.no_grad(): outputs = model(pixel_values=inputs["pixel_values"]) alpha = processor.post_process_alpha_matting(outputs, target_sizes=[(image.height, image.width)])[0] processor.cutout(image, alpha).save("output.png") - Notebooks
- Google Colab
- Kaggle
File size: 467 Bytes
ccfd30a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | {
"add_prefix_space": false,
"backend": "tokenizers",
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": false,
"do_lower_case": true,
"eos_token": "<|endoftext|>",
"errors": "replace",
"is_local": false,
"local_files_only": false,
"max_length": 32,
"model_max_length": 32,
"pad_token": "<|endoftext|>",
"processor_class": "Sam3Processor",
"tokenizer_class": "CLIPTokenizer",
"unk_token": "<|endoftext|>"
}
|