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
Download config.json from feyninc/multimatte: direct link, hf CLI and curl.
- Browser
- Download file 925 Bytes
-
https://huggingface.co/feyninc/multimatte/resolve/main/config.json
- Command line
-
hf download hf://feyninc/multimatte/config.json
-
curl -L -o config.json https://huggingface.co/feyninc/multimatte/resolve/main/config.json
925 Bytes
| { | |
| "aggregate": "semantic", | |
| "default_prompt": "the main foreground subject", | |
| "detr_decoder_num_layers": 6, | |
| "detr_encoder_num_layers": 6, | |
| "fpn_hidden_size": 256, | |
| "geometry_num_layers": 3, | |
| "hidden_size": 256, | |
| "image_size": 1008, | |
| "intermediate_size": 2048, | |
| "nobg_version": "0.3.1", | |
| "num_attention_heads": 8, | |
| "num_queries": 200, | |
| "num_upsampling_stages": 3, | |
| "score_threshold": 0.3, | |
| "text_hidden_size": 1024, | |
| "text_intermediate_size": 4096, | |
| "text_max_position_embeddings": 32, | |
| "text_num_attention_heads": 16, | |
| "text_num_hidden_layers": 24, | |
| "text_projection_dim": 512, | |
| "text_vocab_size": 49408, | |
| "vision_global_attn_indexes": [ | |
| 7, | |
| 15, | |
| 23, | |
| 31 | |
| ], | |
| "vision_hidden_size": 1024, | |
| "vision_intermediate_size": 4736, | |
| "vision_num_attention_heads": 16, | |
| "vision_num_hidden_layers": 32, | |
| "vision_patch_size": 14, | |
| "vision_pretrain_image_size": 336, | |
| "vision_window_size": 24 | |
| } |