SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.04121 · 2023

Matte Anything: Interactive Natural Image Matting with Segment Anything Models

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.04121.json · badge: /api/ran/2306.04121.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
hustvl/matte-anything canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
gauss_kernel Ran
ran, honoured the contract we drafted
hustvl/matte-anything/modeling/criterion/matting_criterion.py
code served (permissive licence) · get_code("b4991ebb886e5289")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (1, 1, 5, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    'device': 'cpu',
    'dtype': torch.float32
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (1, 1, 5, 5) — shape (1, 1, 5, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_checkerboard_image Ran
ran on a synthesized input
hustvl/matte-anything/matte_anything.py
code served (permissive licence) · get_code("871435a4ee3127fa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 3, dtype family int, shape (256, 512, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import cv2
import numpy as np

ARGS = {
    "height": 256,
    "width": 512,
    "num_squares": 8
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (256, 512, 3) — shape (256, 512, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_rel_pos Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hustvl/matte-anything/modeling/backbone/utils.py
code served (permissive licence) · get_code("edb9869f131321d2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (4, 3, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Analyzing the function get_rel_pos:
# - q_size: int, used in range and arithmetic
# - k_size: int, used in range and arithmetic
# - rel_pos: Tensor with shape (L, C), reshaped and interpolated, then indexed

# Create small test values
q_size = 4
k_size = 3

# rel_pos should be a tensor with shape (L, C) where L is some length and C is channels
# The function will resize it to max_rel_dist = 2 * max(q_size, k_size) - 1 = 2 * 4 - 1 = 7
# So we create a rel_pos with arbitrary L (say 5) and C (say 2)
rel_pos = torch.randn(5, 2)

ARGS = {
    "q_size": q_size,
    "k_size": k_size,
    "rel_pos": rel_pos,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (4, 3, 2) — shape (4, 3, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_vit_lr_decay_rate Ran
ran, honoured the contract we drafted
hustvl/matte-anything/configs/common/optimizer.py
code served (permissive licence) · get_code("08bf7ecdb2fffe84")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function takes string parameter names and processes them
# It doesn't actually use the model, just analyzes parameter names
# So we need to provide valid parameter name strings

ARGS = {
    'name': 'backbone.patch_embed.weight',
    'lr_decay_rate': 0.9,
    'num_layers': 12
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hustvl/matte-anything/modeling/backbone/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from chenwei746/eevg, is pointer only (licence: NONE) · get_code("750facb8c52e8864")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from chenwei746/eevg, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

window_unpartition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hustvl/matte-anything/modeling/backbone/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from chenwei746/eevg, is pointer only (licence: NONE) · get_code("535942f820542fb9")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from chenwei746/eevg, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

laplacian_loss Not yet run
unverified (harvested, no recorded run)
hustvl/matte-anything/modeling/criterion/matting_criterion.py
code served (permissive licence) · get_code("a3fadbcac00e9133")
How it ran

no invocation recorded.

laplacian_pyramid Not yet run
unverified (harvested, no recorded run)
hustvl/matte-anything/modeling/criterion/matting_criterion.py
code served (permissive licence) · get_code("8a0b6d481e748e9d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 7 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
window_partition 7 other papers
1 dated earlier, 6 later
2212.00280 (2022-12)
GRiT: A Generative Region-to-text Transformer for Object Understanding
aaai_28465 (2024 (year only))
Referred by Multi-Modality: A Unified Temporal Transformer for Video Object Segmentation
2402.03634 (2024-02)
Ray Denoising: Depth-aware Hard Negative Sampling for Multi-view 3D Object Detection
and 4 more not named here
window_unpartition 7 other papers
1 dated earlier, 6 later
2212.00280 (2022-12)
GRiT: A Generative Region-to-text Transformer for Object Understanding
aaai_28465 (2024 (year only))
Referred by Multi-Modality: A Unified Temporal Transformer for Video Object Segmentation
2402.03634 (2024-02)
Ray Denoising: Depth-aware Hard Negative Sampling for Multi-view 3D Object Detection
and 4 more not named here
get_rel_pos 4 other papers
1 dated earlier, 3 later
2212.00280 (2022-12)
GRiT: A Generative Region-to-text Transformer for Object Understanding
aaai_28465 (2024 (year only))
Referred by Multi-Modality: A Unified Temporal Transformer for Video Object Segmentation
2406.09988 (2024-06)
Details Make a Difference: Object State-Sensitive Neurorobotic Task Planning
and 1 more not named here
get_vit_lr_decay_rate 4 other papers
3 dated earlier, 1 later
2207.13080 (2022-07)
DETRs with Hybrid Matching
2212.00280 (2022-12)
GRiT: A Generative Region-to-text Transformer for Object Understanding
2304.03284 (2023-04)
SegGPT: Segmenting Everything In Context
and 1 more not named here
gauss_kernel 1 other paper
1 later
2508.00443 (2025-08)
SDMatte: Grafting Diffusion Models for Interactive Matting
laplacian_loss 1 other paper
1 later
2508.00443 (2025-08)
SDMatte: Grafting Diffusion Models for Interactive Matting
laplacian_pyramid 1 other paper
1 later
2508.00443 (2025-08)
SDMatte: Grafting Diffusion Models for Interactive Matting

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Natural image matting algorithms aim to predict the transparency map (alpha-matte) with the trimap guidance. However, the production of trimap often requires significant labor, which limits the widespread application of matting algorithms on a large scale. To address the issue, we propose Matte Anything (MatAny), an interactive natural image matting model that could produce high-quality alpha-matte with various simple hints. The key insight of MatAny is to generate pseudo trimap automatically with contour and transparency prediction. In our work, we leverage vision foundation models to enhance the performance of natural image matting. Specifically, we use the segment anything model to predict high-quality contour with user interaction and an open-vocabulary detector to predict the transparency of any object. Subsequently, a pre-trained image matting model generates alpha mattes with pseudo trimaps. MatAny is the interactive matting algorithm with the most supported interaction methods and the best performance to date. It consists of orthogonal vision models without any additional training. We evaluate the performance of MatAny against several current image matting algorithms. MatAny has 58.3% improvement on MSE and 40.6% improvement on SAD compared to the previous image matting methods with simple guidance, achieving new state-of-the-art (SOTA) performance. The source codes and pre-trained models are available at https://github.com/hustvl/Matte-Anything.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.04121")
get_code_for_paper("2306.04121")
have("2306.04121")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.04121.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.04121.svg)](https://syntology.ai/paper/2306.04121)

Connect an agent — have() is free.