SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1803.10464 · 2018

Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/1803.10464.json · badge: /api/ran/1803.10464.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
jiwoon-ahn/psa canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
convert_caffe_to_torch Ran
ran on a synthesized input
jiwoon-ahn/psa/network/vgg16d.py
code served (permissive licence) · get_code("fb4d78fd5d706f4e")
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 dict. 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 torch
import numpy as np
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create mock caffe module and objects
class MockCaffeNet:
    def __init__(self, prototxt_path, caffemodel_path, mode):
        self.params = {
            'conv1': [
                Mock(data=np.random.randn(4, 3, 3, 3).astype(np.float32)),
                Mock(data=np.random.randn(4).astype(np.float32))
            ],
            'conv2': [
                Mock(data=np.random.randn(8, 4, 3, 3).astype(np.float32)),
                Mock(data=np.random.randn(8).astype(np.float32))
            ]
        }

# Mock the caffe module before importing
import sys
mock_caffe = MagicMock()
mock_caffe.Net = MockCaffeNet
mock_caffe.TEST = 1
sys.modules['caffe'] = mock_caffe

# Create temporary prototxt file
import tempfile
import os

temp_dir = tempfile.mkdtemp()
prototxt_path = os.path.join(temp_dir, 'network_vgg16_20M.prototxt')
caffemodel_path = os.path.join(temp_dir, 'model.caffemodel')

# Write dummy files
with open(prototxt_path, 'w') as f:
    f.write('name: "VGG16"\n')

with open(caffemodel_path, 'w') as f:
    f.write('dummy')

ARGS = {
    'caffemodel_path': caffemodel_path,
    'prototxt_path': prototxt_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
caffe, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
crop_with_box Ran
ran on a synthesized input
jiwoon-ahn/psa/tool/imutils.py
code served (permissive licence) · get_code("1da77dcda491ece7")
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 (2, 2, 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 a small test image (grayscale, 2D)
img_2d = np.arange(20, dtype=np.uint8).reshape(4, 5)

# Create a small test image (color, 3D)
img_3d = np.arange(60, dtype=np.uint8).reshape(4, 5, 3)

# Box format: [y1_dest, y2_dest, x1_dest, x2_dest, y1_src, y2_src, x1_src, x2_src]
# This box crops from source region (rows 1:3, cols 1:3) to destination region (rows 0:2, cols 0:2)
box = [0, 2, 0, 2, 1, 3, 1, 3]

ARGS = {
    "img": img_3d,
    "box": box
}
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 (2, 2, 3) — shape (2, 2, 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_indices_in_radius Ran
ran on a synthesized input
jiwoon-ahn/psa/infer_aff.py
code served (permissive licence) · get_code("9da0a975b889ff9b")
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 2, dtype family int, shape (432, 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 numpy as np

ARGS = {
    "height": 8,
    "width": 10,
    "radius": 3
}
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 2, dtype family int, shape (432, 2) — shape (432, 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_indices_of_pairs Ran
ran on a synthesized input
jiwoon-ahn/psa/tool/pyutils.py
code served (permissive licence) · get_code("3f83348d3b3bc43a")
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

# Analyze the function:
# - radius: int, used in range() and arithmetic operations
# - size: tuple/list with 2 elements, indexed as size[0] and size[1]
#   represents (height, width) of a 2D grid

# The function creates a grid of indices and finds pairs within a radius
# Let's use a small grid size to keep output manageable

ARGS = {
    "radius": 3,
    "size": (5, 5)
}
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_random_crop_box Ran
ran on a synthesized input
jiwoon-ahn/psa/tool/imutils.py
code served (permissive licence) · get_code("14cb2e4c07b535f6")
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, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 random

# Set random seed for reproducibility
random.seed(0)

# Define arguments for get_random_crop_box
# The function takes two parameters: imgsize and cropsize
# imgsize: tuple of (height, width) representing image dimensions
# cropsize: integer representing the size of the crop

ARGS = {
    "imgsize": (128, 256),  # (height, width) - distinct dimensions for clarity
    "cropsize": 64
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
random_crop Ran
ran on a synthesized input
jiwoon-ahn/psa/tool/imutils.py
code served (permissive licence) · get_code("fab5abda02bc5312")
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 list. 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 PIL.Image
import numpy as np
import random

random.seed(0)
np.random.seed(0)

# Create a small PIL Image for testing
pil_img = PIL.Image.new('RGB', (8, 6), color='red')

# Create a numpy array image (height=6, width=8, channels=3)
np_img = np.ones((6, 8, 3), dtype=np.uint8) * 100

# Create a grayscale numpy array (height=6, width=8)
np_gray = np.ones((6, 8), dtype=np.uint8) * 50

# Test with PIL images and numpy arrays mixed
images = [pil_img, np_img, np_gray]

# Crop size
cropsize = 4

# Fill values for each image (used when creating containers)
fills = [255, 128, 64]

ARGS = {
    'images': images,
    'cropsize': cropsize,
    'fills': fills
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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
convert_mxnet_to_torch Not yet run
unverified (harvested, no recorded run)
jiwoon-ahn/psa/network/resnet38d.py
code served (permissive licence) · get_code("95dfca01d7656b7c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 2 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
convert_mxnet_to_torch 7 other papers
7 later
1903.00179 (2019-03)
Pyramid Feature Attention Network for Saliency detection
1911.01370 (2019-11)
Self-Supervised Difference Detection for Weakly-Supervised Semantic Segmentation
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration
and 4 more not named here
crop_with_box 1 other paper
1 later
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration
get_indices_in_radius 1 other paper
1 later
2108.12995 (2021-08)
Pseudo-mask Matters in Weakly-supervised Semantic Segmentation
get_random_crop_box 1 other paper
1 later
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration
random_crop 1 other paper
1 later
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration

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-22.

Repositories linked to this paper

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

Abstract

The deficiency of segmentation labels is one of the main obstacles to semantic segmentation in the wild. To alleviate this issue, we present a novel framework that generates segmentation labels of images given their image-level class labels. In this weakly supervised setting, trained models have been known to segment local discriminative parts rather than the entire object area. Our solution is to propagate such local responses to nearby areas which belong to the same semantic entity. To this end, we propose a Deep Neural Network (DNN) called AffinityNet that predicts semantic affinity between a pair of adjacent image coordinates. The semantic propagation is then realized by random walk with the affinities predicted by AffinityNet. More importantly, the supervision employed to train AffinityNet is given by the initial discriminative part segmentation, which is incomplete as a segmentation annotation but sufficient for learning semantic affinities within small image areas. Thus the entire framework relies only on image-level class labels and does not require any extra data or annotations. On the PASCAL VOC 2012 dataset, a DNN learned with segmentation labels generated by our method outperforms previous models trained with the same level of supervision, and is even as competitive as those relying on stronger supervision.

For agents

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

get_harvested_code_for_paper("1803.10464")
get_code_for_paper("1803.10464")
have("1803.10464")

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

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

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

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

Connect an agent — have() is free.