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: 925 Bytes
86e35a4 61f5a46 86e35a4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | {
"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
} |