SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.12037 · 2019

Region Mutual Information Loss for Semantic Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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, 2 violated it and 4 have no contract verdict; 2 failures of our instrument; 1 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/1910.12037.json · badge: /api/ran/1910.12037.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
ZJULearning/RMI canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
RElbers/region-mutual-information-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
5 ran · 0 no recorded run
FunctionStatusWhere it lives
RMILoss Ran
ran on a synthesized input
RElbers/region-mutual-information-pytorch/rmi/rmi.py
code served (permissive licence) · get_code("daf6b8b196e08963")
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
import numpy as np
from scipy import ndimage

INIT_ARGS = {
    'with_logits': True,
    'radius': 2,
    'bce_weight': 0.3,
    'downsampling_method': 'max',
    'stride': 2,
    'use_log_trace': True,
    'use_double_precision': False,
    'epsilon': 0.0005
}

# Construct small tensors: batch=2, channels=1, height=4, width=3
input_tensor = torch.randn(2, 1, 4, 3)
target_tensor = torch.rand(2, 1, 4, 3)
target_tensor = (target_tensor > 0.5).float()

ARGS = {
    'input': input_tensor,
    'target': target_tensor
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, scipy, 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)
inverse Ran
ran, violated the contract we drafted
RElbers/region-mutual-information-pytorch/rmi/rmi.py
code served (permissive licence) · get_code("c188738b3a4fca95")
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 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)

# torch.inverse requires a square matrix (or batch of square matrices)
# Create a small invertible square matrix
x = torch.randn(2, 4, 4)

ARGS = {
    "x": x
}
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 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
log_det Ran
ran; our contract draft was wrong, not the code
RElbers/region-mutual-information-pytorch/rmi/rmi.py
code served (permissive licence) · get_code("e3473a5576df4936")
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 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)

# log_det expects a square matrix (or batch of square matrices)
# torch.logdet computes the log determinant of square matrices
# We need a tensor that is invertible (non-singular)

# Create a small square matrix that is guaranteed to be invertible
x = torch.randn(2, 4, 4)  # batch of 2, 4x4 matrices

ARGS = {
    "x": x
}
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 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
log_det_by_cholesky Ran
ran on a synthesized input
ZJULearning/RMI/losses/rmi/rmi_utils.py
code served (permissive licence) · get_code("c48d876b9a3ae27a")
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, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a positive definite matrix
# Shape [N, C, D, D] where N=2, C=3, D=4
N, C, D = 2, 3, 4

# Generate random matrices and make them positive definite
# by computing A^T @ A for each matrix
random_matrices = torch.randn(N, C, D, D)
matrix = torch.bmm(
    random_matrices.reshape(N*C, D, D).transpose(-2, -1),
    random_matrices.reshape(N*C, D, D)
).reshape(N, C, D, D)

ARGS = {
    "matrix": matrix
}
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, 3) — shape (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
log_trace Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RElbers/region-mutual-information-pytorch/rmi/rmi.py
code served (permissive licence) · get_code("30b82ca9d0e092a7")
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 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 expects a tensor x that:
# 1. Can be passed to torch.linalg.cholesky (must be square, positive definite)
# 2. Has diagonal extractable via torch.diagonal with dim1=-2, dim2=-1
# 3. Supports torch.log and torch.sum operations

# Create a small positive definite matrix
# We'll create a batch of 2 positive definite 4x4 matrices
batch_size = 2
dim = 4

# Create random matrices and make them positive definite via A^T @ A
A = torch.randn(batch_size, dim, dim)
x = torch.bmm(A.transpose(-2, -1), A)

# Ensure positive definiteness by adding to diagonal
x = x + torch.eye(dim).unsqueeze(0) * 5

ARGS = {
    "x": x
}
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 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
map_get_pairs Ran
ran on a synthesized input
ZJULearning/RMI/losses/rmi/rmi_utils.py
code served (permissive licence) · get_code("97f5e3b69f2c69ea")
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 5, dtype family float, shape (2, 4, 18, 5, 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 small 4D tensors with shape [N, C, H, W]
# N=2 (batch), C=4 (channels), H=7 (height), W=5 (width)
labels_4D = torch.randint(0, 2, (2, 4, 7, 5), dtype=torch.long)
probs_4D = torch.rand(2, 4, 7, 5, dtype=torch.float32)

ARGS = {
    "labels_4D": labels_4D,
    "probs_4D": probs_4D,
    "radius": 3,
    "is_combine": True
}
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 5, dtype family float, shape (2, 4, 18, 5, 3) — shape (2, 4, 18, 5, 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
map_get_pairs_region Ran
ran on a synthesized input
ZJULearning/RMI/losses/rmi/rmi_utils.py
code served (permissive licence) · get_code("99b42d109e83351a")
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 6, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create small 4D tensors for labels and probabilities
# Shape: [N, C, H, W] = [2, 4, 8, 8]
# N=2 (batch), C=4 (channels/classes), H=8, W=8 (spatial dimensions)
labels_4D = torch.randint(0, 2, (2, 4, 8, 8), dtype=torch.float32)
probs_4D = torch.rand(2, 4, 8, 8, dtype=torch.float32)

ARGS = {
    "labels_4D": labels_4D,
    "probs_4D": probs_4D,
    "radius": 3,
    "is_combine": 0,
    "num_classeses": 4
}
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 6, 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
transpose Ran
ran, violated the contract we drafted
RElbers/region-mutual-information-pytorch/rmi/rmi.py
code served (permissive licence) · get_code("55f1419d4d8c483c")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 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)

# The transpose function takes a single parameter 'x' and calls .transpose(-2, -1) on it
# This requires x to be a tensor with at least 2 dimensions
# We'll create a small tensor with distinct dimensions to make shape probing unambiguous

x = torch.randn(2, 4, 3, 5)  # 4D tensor with distinct sizes

ARGS = {
    "x": x
}
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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 3) — shape (2, 4, 5, 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
add_parser_params Not yet run
unverified (harvested, no recorded run)
ZJULearning/RMI/parser_params.py
code served (permissive licence) · get_code("e3468efc8c8a04e0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 later) and 5 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
transpose
brick of this paper's assembly: helper
17 other papers
17 later · 2 only as an assembly brick
2207.05500 (2022-07)
Modality-Aware Contrastive Instance Learning with Self-Distillation for Weakly-Supervised Audio-Visual Violence Detection
2306.10008 (2023-06)
CLIP2Protect: Protecting Facial Privacy using Text-Guided Makeup via Adversarial Latent Search
2307.16377 (2023-07)
JOTR: 3D Joint Contrastive Learning with Transformers for Occluded Human Mesh Recovery
and 14 more not named here
log_det_by_cholesky 2 other papers
2 later
2005.10821 (2020-05)
Hierarchical Multi-Scale Attention for Semantic Segmentation
2106.01226 (2021-06)
Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
map_get_pairs 2 other papers
2 later
2005.10821 (2020-05)
Hierarchical Multi-Scale Attention for Semantic Segmentation
2106.01226 (2021-06)
Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
map_get_pairs_region 2 other papers
2 later
2005.10821 (2020-05)
Hierarchical Multi-Scale Attention for Semantic Segmentation
2106.01226 (2021-06)
Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision

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

Semantic segmentation is a fundamental problem in computer vision. It is considered as a pixel-wise classification problem in practice, and most segmentation models use a pixel-wise loss as their optimization riterion. However, the pixel-wise loss ignores the dependencies between pixels in an image. Several ways to exploit the relationship between pixels have been investigated, \eg, conditional random fields (CRF) and pixel affinity based methods. Nevertheless, these methods usually require additional model branches, large extra memories, or more inference time. In this paper, we develop a region mutual information (RMI) loss to model the dependencies among pixels more simply and efficiently. In contrast to the pixel-wise loss which treats the pixels as independent samples, RMI uses one pixel and its neighbour pixels to represent this pixel. Then for each pixel in an image, we get a multi-dimensional point that encodes the relationship between pixels, and the image is cast into a multi-dimensional distribution of these high-dimensional points. The prediction and ground truth thus can achieve high order consistency through maximizing the mutual information (MI) between their multi-dimensional distributions. Moreover, as the actual value of the MI is hard to calculate, we derive a lower bound of the MI and maximize the lower bound to maximize the real value of the MI. RMI only requires a few extra computational resources in the training stage, and there is no overhead during testing. Experimental results demonstrate that RMI can achieve substantial and consistent improvements in performance on PASCAL VOC 2012 and CamVid datasets. The code is available at https://github.com/ZJULearning/RMI.

For agents

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

get_harvested_code_for_paper("1910.12037")
get_code_for_paper("1910.12037")
have("1910.12037")

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

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

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

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

Connect an agent — have() is free.