SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.11432 · CVPR · 2022

Unsupervised Hierarchical Semantic Segmentation with Multiview Cosegmentation and Clustering Transformers

Xudong Wang, Stella Yu, Tsung-Wei Ke, Jyh-Jing Hwang, Yunhui Guo

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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, 1 violated it and 1 has no contract verdict; 7 failures of our instrument; 2 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/2204.11432.json · badge: /api/ran/2204.11432.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
twke18/hsg marked official in Papers with Code
Papers with Code archive
9 ran · 2 no recorded run
FunctionStatusWhere it lives
SegSortLoss Ran
ran on a synthesized input
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("beccccc87a810e39")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 0, dtype family float; 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 torch

INIT_ARGS = {
    'concentration': 10.0,
    'group_mode': 'segsort+',
    'size_average': None,
    'reduce': None,
    'reduction': 'mean'
}

ARGS = {
    'embeddings': torch.randn(2, 4),
    'semantic_labels': torch.tensor([0, 1]),
    'instance_labels': torch.tensor([0, 1]),
    'prototypes': torch.randn(3, 4),
    'prototype_semantic_labels': torch.tensor([0, 1, 0]),
    'prototype_weights': None
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_calculate_log_likelihood Ran
ran; our contract draft was wrong, not the code
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("bb39236af820745f")
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, 1) 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)

# Define tensor dimensions with distinct sizes
num_pixels = 2
embedding_dim = 4
num_prototypes = 3

# Create embeddings: [num_pixels, embedding_dim]
embeddings = torch.randn(num_pixels, embedding_dim, dtype=torch.float32)

# Create semantic_labels: [num_pixels]
semantic_labels = torch.tensor([0, 1], dtype=torch.long)

# Create instance_labels: [num_pixels]
# These are used with torch.gather, so values must be valid indices [0, num_prototypes)
instance_labels = torch.tensor([0, 2], dtype=torch.long)

# Create prototypes: [num_prototypes, embedding_dim]
prototypes = torch.randn(num_prototypes, embedding_dim, dtype=torch.float32)

# Create prototype_semantic_labels: [num_prototypes]
prototype_semantic_labels = torch.tensor([0, 1, 0], dtype=torch.long)

# concentration parameter for similarity scaling
concentration = 1.0

# group_mode parameter
group_mode = 'segsort+'

ARGS = {
    'embeddings': embeddings,
    'semantic_labels': semantic_labels,
    'instance_labels': instance_labels,
    'prototypes': prototypes,
    'prototype_semantic_labels': prototype_semantic_labels,
    'concentration': concentration,
    'group_mode': group_mode,
}
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, 1) — shape (2, 1) 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
_rank3_trace Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("6d7ca8ad976f7f04")
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 1, dtype family float, shape (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

torch.manual_seed(0)

# The function _rank3_trace uses torch.einsum with pattern 'ijj->i'
# This expects a 3D tensor where:
# - i is the batch dimension
# - j and j are the two dimensions being traced over (must match for valid trace)
# The einsum computes the trace along the last two dimensions for each batch element

# Create a rank-3 tensor with shape (batch=2, dim1=4, dim2=4)
# The last two dimensions must be equal for the trace operation to work
x = torch.randn(2, 4, 4)

ARGS = {
    'x': x
}
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 1, dtype family float, shape (2,) — shape (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
affinity_matrix_as_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("515ff33c1ddcd01f")
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 (2, 3, 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 torch

torch.manual_seed(0)

# Create minimal valid arguments for affinity_matrix_as_attention
batch_size = 2
channels = 4
num_nodes = 3

# x: tensor of shape [batch_size, channels, num_nodes]
x = torch.randn(batch_size, channels, num_nodes)

# x_padding_mask: tensor of shape [batch_size, num_nodes]
x_padding_mask = torch.tensor([
    [False, False, True],
    [False, False, False]
], dtype=torch.bool)

# x_segment_labels: tensor of shape [batch_size, num_nodes]
x_segment_labels = torch.tensor([
    [0, 0, 1],
    [0, 0, 0]
], dtype=torch.long)

# kernel_fn: a callable that takes x and returns affinity matrix
def exp_inner_product_kernel(x, concentration=5):
    """Kernel function for computing inner product."""
    def inner_product_kernel(x):
        return torch.einsum('...ij,...jk->...ik', x.transpose(-2, -1), x)
    sim = inner_product_kernel(x)
    return sim.mul(concentration).exp()

ARGS = {
    'x': x,
    'x_padding_mask': x_padding_mask,
    'x_segment_labels': x_segment_labels,
    'knn': 2,
    'remove_self_loop': True,
    'binarize': True,
    'kernel_fn': exp_inner_product_kernel
}
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 (2, 3, 3) — shape (2, 3, 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
dmon_pool_loss Ran
ran; our contract draft was wrong, not the code
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("495cfccd6332182c")
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 float; 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 torch

torch.manual_seed(0)

# Small tensors with distinct dimensions for clarity
batch_size = 2
num_nodes = 4
num_clusters = 3
channels = 5

# x: [batch_size, num_nodes, channels]
x = torch.randn(batch_size, num_nodes, channels)

# adj: [batch_size, num_nodes, num_nodes] - adjacency matrix
adj = torch.randn(batch_size, num_nodes, num_nodes)

# s: [batch_size, num_nodes, num_clusters] - assignment matrix
s = torch.randn(batch_size, num_nodes, num_clusters)

# mask: [batch_size, num_nodes] - optional validity mask
mask = torch.ones(batch_size, num_nodes)

ARGS = {
    'x': x,
    'adj': adj,
    's': s,
    'mask': mask,
    'softmax': False,
}
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 tuple, ndim 1, dtype family float — 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
exp_inner_product_kernel Ran
ran; our contract draft was wrong, not the code
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("9b8f0f2b506b4e57")
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 (2, 4, 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 a small tensor with shape [batch, seq_len, feature_dim]
# Last 2 dimensions are used for inner product computation
# Shape: [2, 3, 4] means batch=2, seq_len=3, feature_dim=4
x = torch.randn(2, 3, 4)

# concentration parameter
concentration = 5

ARGS = {
    "x": x,
    "concentration": concentration,
}
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 (2, 4, 4) — shape (2, 4, 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
inner_product_kernel Ran
ran, violated the contract we drafted
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("5143c945ccddcde2")
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 (2, 3, 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)

# Create a tensor with shape [D(0), ..., D(N-2), D(N-1), D(N)]
# Using shape [2, 3, 4, 5] where:
# - 2 is batch dimension D(0)
# - 3 is intermediate dimension D(N-2)
# - 4 is D(N-1) (rows)
# - 5 is D(N) (columns)
x = torch.randn(2, 3, 4, 5)

ARGS = {
    "x": x
}
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 (2, 3, 5, 5) — shape (2, 3, 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
normalize_embedding Ran
ran; our contract draft was wrong, not the code
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("1ef225c91d4a5d0c")
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 a small embedding tensor with batch size 2 and embedding dimension 4
embeddings = torch.randn(2, 4)

ARGS = {
    "embeddings": embeddings,
    "eps": 1e-12,
}
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
top_k_ranking Ran
ran; our contract draft was wrong, not the code
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("e0593dd8d4a94998")
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 torch

torch.manual_seed(0)

# Create embeddings: N-D tensor with last dimension as num_channels
# Shape: (batch_size=2, num_channels=4)
embeddings = torch.randn(2, 4, dtype=torch.float32)

# Create labels: (N-1)-D long tensor
# Shape: (batch_size=2,)
labels = torch.tensor([0, 1], dtype=torch.long)

# Create prototypes: 2-D float tensor with last dimension as num_channels
# Shape: (num_prototypes=3, num_channels=4)
prototypes = torch.randn(3, 4, dtype=torch.float32)

# Create prototype_labels: 1-D long tensor
# Shape: (num_prototypes=3,)
prototype_labels = torch.tensor([0, 1, 0], dtype=torch.long)

# top_k parameter
top_k = 2

ARGS = {
    "embeddings": embeddings,
    "labels": labels,
    "prototypes": prototypes,
    "prototype_labels": prototype_labels,
    "top_k": top_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 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
DMonLoss Not yet run
unverified (harvested, no recorded run)
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("6d32b13714bb33b6")
How it ran

no invocation recorded.

Hsg Not yet run
unverified (harvested, no recorded run)
twke18/hsg/hsg/models/predictions/hsg.py
code served (permissive licence) · get_code("4ccd6054c84df32c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
SegSortLoss
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.00957 (2021-05)
Universal Weakly Supervised Segmentation by Pixel-to-Segment Contrastive Learning
_calculate_log_likelihood
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.00957 (2021-05)
Universal Weakly Supervised Segmentation by Pixel-to-Segment Contrastive Learning

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

Unsupervised semantic segmentation aims to discover groupings within and across images that capture objectand view-invariance of a category without external supervision. Grouping naturally has levels of granularity, creating ambiguity in unsupervised segmentation. Existing methods avoid this ambiguity and treat it as a factor outside modeling, whereas we embrace it and desire hierarchical grouping consistency for unsupervised segmentation. We approach unsupervised segmentation as a pixel-wise feature learning problem. Our idea is that a good representation shall reveal not just a particular level of grouping, but any level of grouping in a consistent and predictable manner. We enforce spatial consistency of grouping and bootstrap feature learning with co-segmentation among multiple views of the same image, and enforce semantic consistency across the grouping hierarchy with clustering transformers between coarse-and fine-grained features. We deliver the first data-driven unsupervised hierarchical semantic segmentation method called Hierarchical Segment Grouping (HSG). Capturing visual similarity and statistical co-occurrences, HSG also outperforms existing unsupervised segmentation methods by a large margin on five major object-and scene-centric benchmarks.

For agents

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

get_harvested_code_for_paper("2204.11432")
get_code_for_paper("2204.11432")
have("2204.11432")

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

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

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

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

Connect an agent — have() is free.