SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1703.03872 · 2017

Deep Image Matting

arXiv · PDF · Open in the Atlas

Code that ran

10 of 14 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; 0 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 2 failures of our instrument; 4 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/1703.03872.json · badge: /api/ran/1703.03872.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
foamliu/Deep-Image-Matting community (classifier label)
classifier basis not recorded on the link
3 ran · 2 no recorded run
foamliu/deep-image-matting-pytorch community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
brendanvonhofe/telescope-nn community (classifier label)
classifier basis not recorded on the link
2 ran · 1 no recorded run
Joker316701882/Deep-Image-Matting reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
UR_center Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Joker316701882/Deep-Image-Matting/matting.py
pointer only (licence: NONE) · get_code("7ad56a3fc16bedb2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Joker316701882/Deep-Image-Matting 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.

accuracy Ran
ran on a synthesized input
foamliu/deep-image-matting-pytorch/utils.py
code served (permissive licence) · get_code("5636e2d24b43d1a9")
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 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)

# Create small tensors for testing
batch_size = 2
num_classes = 4

# scores: prediction scores, shape (batch_size, num_classes)
# The function calls scores.topk(k, 1, True, True) and ind.eq(targets.view(-1, 1).expand_as(ind))
scores = torch.randn(batch_size, num_classes)

# targets: ground truth class indices, shape (batch_size,)
# The function calls targets.size(0) and targets.view(-1, 1)
targets = torch.tensor([1, 3])

# k: number of top predictions to consider
k = 1

ARGS = {
    "scores": scores,
    "targets": targets,
    "k": k
}
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 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
alpha_loss Ran
ran on a synthesized input
brendanvonhofe/telescope-nn/src/metrics.py
code served (permissive licence) · get_code("6af8ef51a94fa285")
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 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

torch.manual_seed(0)

# Create small tensors for p_mask and gt_mask
# The function performs operations: sub, pow, sum over dims 1, 2, 3
# So we need tensors with at least 4 dimensions (batch, dim1, dim2, dim3)
# Shape: (batch_size, height, width, channels) = (2, 4, 3, 5)

p_mask = torch.randn(2, 4, 3, 5)
gt_mask = torch.randn(2, 4, 3, 5)

eps = 1e-06

ARGS = {
    "p_mask": p_mask,
    "gt_mask": gt_mask,
    "eps": eps,
}
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 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
build_refinement Ran
ran on a synthesized input
foamliu/Deep-Image-Matting/model.py
code served (permissive licence) · get_code("181be2569ec73dd0")
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 Functional. The image it ran in was not recorded. If your copy returns the same type 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 tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Input, Conv2D, UpSampling2D, BatchNormalization, ZeroPadding2D, MaxPooling2D, Concatenate, Reshape, Lambda
from tensorflow.keras.models import Model

# Build a minimal encoder_decoder model that satisfies the function's requirements
# The function expects:
# - encoder_decoder.input: input tensor
# - encoder_decoder.output: output tensor
# These will be used in the build_refinement function

def create_minimal_encoder_decoder():
    # Input: batch_size=2, height=4, width=3, channels=4 (needs to support [:, :, :, 0:3] slicing)
    input_tensor = Input(shape=(4, 3, 4), batch_size=2)
    
    # Simple encoder_decoder that takes 4-channel input and outputs 1-channel
    x = Conv2D(32, (3, 3), activation='relu', padding='same')(input_tensor)
    output = Conv2D(1, (3, 3), activation='sigmoid', padding='same')(x)
    
    model = Model(inputs=input_tensor, outputs=output)
    return model

# Create the encoder_decoder model
encoder_decoder = create_minimal_encoder_decoder()

ARGS = {
    'encoder_decoder': encoder_decoder
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Functional — a Functional output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Functional output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
build_refinement Ran
ran on a synthesized input
foamliu/Deep-Image-Matting/segnet.py
code served (permissive licence) · get_code("848f52dde866da17")
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 Functional. The image it ran in was not recorded. If your copy returns the same type 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 keras
from keras.layers import Input, Conv2D, UpSampling2D, BatchNormalization, ZeroPadding2D, MaxPooling2D, Reshape, Concatenate, Lambda
from keras.models import Model

# Build a minimal encoder_decoder model that satisfies the function's requirements
# The function expects:
# - encoder_decoder.input: input tensor
# - encoder_decoder.output: output tensor to concatenate with the first 3 channels of input

# Create a simple encoder_decoder model
# Input should have shape (batch, height, width, channels) where channels >= 3
# Output can be any tensor with compatible spatial dimensions

input_shape = (2, 4, 5, 6)  # batch=2, height=4, width=5, channels=6
encoder_input = Input(shape=(4, 5, 6))  # height, width, channels

# Simple processing: reduce channels to 2 for output
x = Conv2D(32, (3, 3), padding='same', activation='relu')(encoder_input)
x = Conv2D(2, (3, 3), padding='same', activation='relu')(x)

encoder_decoder = Model(inputs=encoder_input, outputs=x)

ARGS = {
    'encoder_decoder': encoder_decoder
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Functional — a Functional output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Functional output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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
composite Ran
ran on a synthesized input
brendanvonhofe/telescope-nn/src/metrics.py
code served (permissive licence) · get_code("69019a8096edad2a")
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 2, dtype family float, shape (2, 4) 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)

# Create small tensors for foreground, background, and alpha
# All with batch size 2 and different feature dimensions for clarity
fg = torch.randn(2, 4)
bg = torch.randn(2, 4)
alpha = torch.randn(2, 4)

ARGS = {
    "fg": fg,
    "bg": bg,
    "alpha": alpha,
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
composite4 Ran
ran on a synthesized input
foamliu/deep-image-matting-pytorch/Combined_Dataset/Test_set/Composition_code_revised.py
code served (permissive licence) · get_code("e41c7308aeed9225")
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 (5, 4, 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 numpy as np

# Create small test images
# fg: foreground image (h, w, 3) or similar - needs to be indexable like an array
fg = np.random.randint(0, 256, size=(5, 4, 3), dtype=np.uint8)

# bg: background image (h, w, 3) - needs to support slicing [0:h, 0:w]
bg = np.random.randint(0, 256, size=(10, 8, 3), dtype=np.uint8)

# a: alpha values (h, w) - will be divided by 255.0
a = np.random.randint(0, 256, size=(5, 4), dtype=np.uint8)

# w, h: width and height dimensions
w = 4
h = 5

ARGS = {
    "fg": fg,
    "bg": bg,
    "a": a,
    "w": w,
    "h": h
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 (5, 4, 3) — shape (5, 4, 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
composite4 Ran
ran on a synthesized input
foamliu/Deep-Image-Matting/data_generator.py
code served (permissive licence) · get_code("d46c4d71d296a1dd")
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 tuple. The image it ran in was not recorded. If your copy returns the same type 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 numpy as np

# Read function signature and body to understand what's needed:
# fg: converted to np.array of float32 - needs to be array-like with shape (h, w, 3) or similar
# bg: has .shape[:2] accessed, indexed with [y:y+h, x:x+w] - needs to be array-like
# a: divided by 255.0 - needs to be numeric (alpha channel, 0-255)
# w: width integer
# h: height integer

# Create small stand-in arrays
fg_data = np.random.randint(0, 256, (5, 6, 3), dtype=np.uint8)  # 5x6 RGB image
bg_data = np.random.randint(0, 256, (8, 10, 3), dtype=np.uint8)  # 8x10 RGB image (larger)
alpha_value = 200  # opacity value (0-255)
width = 6
height = 5

ARGS = {
    "fg": fg_data,
    "bg": bg_data,
    "a": alpha_value,
    "w": width,
    "h": height,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
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_learning_rate Ran
ran on a synthesized input
foamliu/deep-image-matting-pytorch/utils.py
code served (permissive licence) · get_code("f12870d2ed1448f7")
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 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
from torch.optim import SGD

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 2)

# Create an optimizer with a known learning rate
optimizer = SGD(model.parameters(), lr=0.01)

ARGS = {
    'optimizer': optimizer
}
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 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
load_path Ran
ran; our contract draft was wrong, not the code
Joker316701882/Deep-Image-Matting/matting.py
pointer only (licence: NONE) · get_code("04a023c9e8251e12")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, Joker316701882/Deep-Image-Matting 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.

alpha_loss_u Not yet run
unverified (harvested, no recorded run)
brendanvonhofe/telescope-nn/src/metrics.py
code served (permissive licence) · get_code("23fa7d84d8f7ba89")
How it ran

no invocation recorded.

composite4 Not yet run
unverified (harvested, no recorded run)
foamliu/deep-image-matting-pytorch/Combined_Dataset/Test_set/Composition_code.py
code served (permissive licence) · get_code("d1bcce0ef6c57311")
How it ran

no invocation recorded.

get_alpha Not yet run
unverified (harvested, no recorded run)
foamliu/Deep-Image-Matting/data_generator.py
code served (permissive licence) · get_code("4cce5cdc05ccef18")
How it ran

no invocation recorded.

get_alpha_test Not yet run
unverified (harvested, no recorded run)
foamliu/Deep-Image-Matting/data_generator.py
code served (permissive licence) · get_code("07d794bdf5eca0f3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 10 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
accuracy 3 other papers
2 dated earlier, 1 later
1508.01211 (2015-08)
Listen, Attend and Spell
1512.01882 (2015-12)
THCHS-30 : A Free Chinese Speech Corpus
1804.07573 (2018-04)
MobileFaceNets: Efficient CNNs for Accurate Real-Time Face Verification on Mobile Devices
composite4 1 other paper
1 later
1902.04502 (2019-02)
Fast-SCNN: Fast Semantic Segmentation Network
get_learning_rate 1 other paper
1 dated earlier
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition

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

Image matting is a fundamental computer vision problem and has many applications. Previous algorithms have poor performance when an image has similar foreground and background colors or complicated textures. The main reasons are prior methods 1) only use low-level features and 2) lack high-level context. In this paper, we propose a novel deep learning based algorithm that can tackle both these problems. Our deep model has two parts. The first part is a deep convolutional encoder-decoder network that takes an image and the corresponding trimap as inputs and predict the alpha matte of the image. The second part is a small convolutional network that refines the alpha matte predictions of the first network to have more accurate alpha values and sharper edges. In addition, we also create a large-scale image matting dataset including 49300 training images and 1000 testing images. We evaluate our algorithm on the image matting benchmark, our testing set, and a wide variety of real images. Experimental results clearly demonstrate the superiority of our algorithm over previous methods.

For agents

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

get_harvested_code_for_paper("1703.03872")
get_code_for_paper("1703.03872")
have("1703.03872")

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

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

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

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

Connect an agent — have() is free.