SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.14146 · ICCV · 2021

Describing and Localizing Multiple Changes with Transformers

Yue Qiu, Hirokatsu Kataoka, Kodai Nakashima, Kenji Iwata, Yutaka Satoh, Shintaro Yamamoto, Ryota Suzuki

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure of our instrument; 3 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/2103.14146.json · badge: /api/ran/2103.14146.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
doiken23/mccformers.pytorch community
Papers with Code archive
5 ran · 3 no recorded run
cvpaperchallenge/Describing-and-Localizing-Multiple-Change-with-Transformers community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
CoAttentionTransformerEncoderLayer Ran
ran on a synthesized input
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("fa672e2c394eb841")
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 3, dtype family float, shape (3, 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
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from typing import Optional

def _get_activation_fn(activation):
    if activation == 'relu':
        return F.relu
    elif activation == 'gelu':
        return F.gelu
    raise ValueError('activation should be relu/gelu, not {}'.format(activation))

class CoAttentionTransformerEncoderLayer(nn.Module):

    def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu'):
        super(CoAttentionTransformerEncoderLayer, self).__init__()
        self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)
        self.linear1 = nn.Linear(d_model, dim_feedforward)
        self.dropout = nn.Dropout(dropout)
        self.linear2 = nn.Linear(dim_feedforward, d_model)
        self.norm1 = nn.LayerNorm(d_model)
        self.norm2 = nn.LayerNorm(d_model)
        self.dropout1 = nn.Dropout(dropout)
        self.dropout2 = nn.Dropout(dropout)
        self.activation = _get_activation_fn(activation)

    def __setstate__(self, state):
        if 'activation' not in state:
            state['activation'] = F.relu
        super(CoAttentionTransformerEncoderLayer, self).__setstate__(state)

    def forward(self, src: Tensor, src_: Tensor, src_mask: Optional[Tensor]=None, src_key_padding_mask: Optional[Tensor]=None) -> Tensor:
        """Pass the input through the encoder layer.

        Args:
            src: the sequence to the encoder layer (required).
            src_: the sequence to the encoder layer (required).
            src_mask: the mask for the src sequence (optional).
            src_key_padding_mask: the mask for the src keys per batch (optional).

        Shape:
            see the docs in Transformer class.
        """
        src2 = self.self_attn(src, src_, src_, attn_mask=src_mask, key_padding_mask=src_key_padding_mask)[0]
        src = src + self.dropout1(src2)
        src = self.norm1(src)
        src2 = self.linear2(self.dropout(self.activation(self.linear1(src))))
        src = src + self.dropout2(src2)
        src = self.norm2(src)
        return src


INIT_ARGS = {
    'd_model': 4,
    'nhead': 2,
    'dim_feedforward': 8,
    'dropout': 0.1,
    'activation': 'relu'
}

ARGS = {
    'src': torch.randn(3, 2, 4),
    'src_': torch.randn(3, 2, 4),
    'src_mask': None,
    'src_key_padding_mask': None
}

if __name__ == '__main__':
    model = CoAttentionTransformerEncoderLayer(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Test passed!")
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 3, dtype family float, shape (3, 2, 4) — shape (3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MCCFormerEncoderS Ran
ran on a synthesized input
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("182ed251c7d9568d")
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 3, 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 math
import torch
import torch.nn as nn
from torch import Tensor

class PositionalEncoding(nn.Module):
    """
    Learnable position embeddings

    Args:
        pe_type (str): type of position embeddings,
            which is chosen from ['fully_learnable', 'sinusoidal']
        d_model (int): embed dim (required).
        max_len (int): max. length of the incoming sequence (default=5000).

    Examples:
        >>> pos_encoder = PositionalEncoding(d_model, max_len=100)
    """

    def __init__(self, pe_type: str, d_model: int, max_len: int=5000):
        super(PositionalEncoding, self).__init__()
        if pe_type == 'fully_learnable':
            self.pe = nn.parameter.Parameter(torch.randn(max_len, 1, d_model))
        elif pe_type == 'sinusoidal':
            pe = torch.zeros(max_len, d_model)
            position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)
            div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))
            pe[:, 0::2] = torch.sin(position * div_term)
            pe[:, 1::2] = torch.cos(position * div_term)
            pe = pe.unsqueeze(0).transpose(0, 1)
            self.register_buffer('pe', pe)
        else:
            raise RuntimeError('PE type should be fully_learnable/sinusoidal, not {}'.format(pe_type))

    def forward(self, x: Tensor) -> Tensor:
        """

        Args:
            x (Tensor): the sequence fed to the positional encoder model [L, N, C]

        Returns:
            output (Tensor): position embeddings [L, N, C]

        """
        return x + self.pe[:x.size(0)]

class MCCFormerEncoderS(nn.Module):
    """

    Attributes:
        linear (nn.Module): linear layer to create input feature from CNN feature
        feature_extractor (Optional[nn.Module]): feature extractor
        positional_encoding (nn.Module): positional encoder (default: 'learnable')
        transformer (nn.Module): transformer encoder layer

    """

    def __init__(self, feature_dim: int, encoder_dim: int, feature_extractor = None, image_size: int=14, nhead: int=4, transformer_layer_num: int=2):
        super(MCCFormerEncoderS, self).__init__()
        self.image_size = image_size
        self.feature_extractor = feature_extractor
        self.linear = nn.Conv2d(feature_dim, encoder_dim, kernel_size=1)
        self.positional_encoding = PositionalEncoding('fully_learnable', encoder_dim, 2 * image_size ** 2)
        encoder_layer = nn.TransformerEncoderLayer(d_model=encoder_dim, nhead=nhead, dim_feedforward=4 * encoder_dim, batch_first=False)
        self.transformer = nn.TransformerEncoder(encoder_layer, num_layers=transformer_layer_num)

    def forward(self, x1: Tensor, x2: Tensor) -> Tensor:
        """

        Args:
            x1 (Tensor): visual feature at t1 shape of [N, 3, H, W]
            x2 (Tensor): visual feature at t2 shape of [N, 3, H, W]

        Returns:
            outputs (Tensor): output feature shape of [H'xW', N, 2C]

        """
        N = len(x1)
        features = torch.cat([x1, x2], dim=0)
        if self.feature_extractor is not None:
            features = self.feature_extractor(features)
        features = self.linear(features).flatten(start_dim=2).permute(2, 0, 1)
        features = torch.cat([features[:, :N], features[:, N:]], dim=0)
        features = self.positional_encoding(features)
        features = self.transformer(features)
        before_features, after_features = (features[:self.image_size ** 2], features[self.image_size ** 2:])
        return torch.cat([before_features, after_features], dim=2)


INIT_ARGS = {
    'feature_dim': 4,
    'encoder_dim': 8,
    'feature_extractor': None,
    'image_size': 3,
    'nhead': 2,
    'transformer_layer_num': 2,
}

ARGS = {
    'x1': torch.randn(2, 4, 3, 3),
    'x2': torch.randn(2, 4, 3, 3),
}

if __name__ == '__main__':
    model = MCCFormerEncoderS(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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 3, 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)
MCCFormers_S Ran
ran on a synthesized input · constructed an object; no result was computed
cvpaperchallenge/Describing-and-Localizing-Multiple-Change-with-Transformers/code/models_trans.py
pointer only (licence: NONE) · get_code("8e99499938b1efd9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, cvpaperchallenge/Describing-and-Localizing-Multiple-Change-with-Transformers 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.

PositionalEncoding Ran
ran on a synthesized input
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("58f682ef650d89c8")
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 3, dtype family float, shape (3, 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 math
import torch
import torch.nn as nn
from torch import Tensor

class PositionalEncoding(nn.Module):
    """
    Learnable position embeddings

    Args:
        pe_type (str): type of position embeddings,
            which is chosen from ['fully_learnable', 'sinusoidal']
        d_model (int): embed dim (required).
        max_len (int): max. length of the incoming sequence (default=5000).

    Examples:
        >>> pos_encoder = PositionalEncoding(d_model, max_len=100)
    """

    def __init__(self, pe_type: str, d_model: int, max_len: int=5000):
        super(PositionalEncoding, self).__init__()
        if pe_type == 'fully_learnable':
            self.pe = nn.parameter.Parameter(torch.randn(max_len, 1, d_model))
        elif pe_type == 'sinusoidal':
            pe = torch.zeros(max_len, d_model)
            position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)
            div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))
            pe[:, 0::2] = torch.sin(position * div_term)
            pe[:, 1::2] = torch.cos(position * div_term)
            pe = pe.unsqueeze(0).transpose(0, 1)
            self.register_buffer('pe', pe)
        else:
            raise RuntimeError('PE type should be fully_learnable/sinusoidal, not {}'.format(pe_type))

    def forward(self, x: Tensor) -> Tensor:
        """

        Args:
            x (Tensor): the sequence fed to the positional encoder model [L, N, C]

        Returns:
            output (Tensor): position embeddings [L, N, C]

        """
        return x + self.pe[:x.size(0)]


INIT_ARGS = {
    'pe_type': 'sinusoidal',
    'd_model': 4,
    'max_len': 10
}

ARGS = {
    'x': torch.randn(3, 2, 4)
}

if __name__ == '__main__':
    model = PositionalEncoding(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
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 3, dtype family float, shape (3, 2, 4) — shape (3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SimpleEncoder Ran
ran on a synthesized input
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("25103b8f0df4d9c2")
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 3, dtype family float, shape (25, 2, 6) 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 math
import torch
import torch.nn as nn
from torch import Tensor

class PositionalEncoding(nn.Module):
    """
    Learnable position embeddings

    Args:
        pe_type (str): type of position embeddings,
            which is chosen from ['fully_learnable', 'sinusoidal']
        d_model (int): embed dim (required).
        max_len (int): max. length of the incoming sequence (default=5000).

    Examples:
        >>> pos_encoder = PositionalEncoding(d_model, max_len=100)
    """

    def __init__(self, pe_type: str, d_model: int, max_len: int=5000):
        super(PositionalEncoding, self).__init__()
        if pe_type == 'fully_learnable':
            self.pe = nn.parameter.Parameter(torch.randn(max_len, 1, d_model))
        elif pe_type == 'sinusoidal':
            pe = torch.zeros(max_len, d_model)
            position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)
            div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))
            pe[:, 0::2] = torch.sin(position * div_term)
            pe[:, 1::2] = torch.cos(position * div_term)
            pe = pe.unsqueeze(0).transpose(0, 1)
            self.register_buffer('pe', pe)
        else:
            raise RuntimeError('PE type should be fully_learnable/sinusoidal, not {}'.format(pe_type))

    def forward(self, x: Tensor) -> Tensor:
        """

        Args:
            x (Tensor): the sequence fed to the positional encoder model [L, N, C]

        Returns:
            output (Tensor): position embeddings [L, N, C]

        """
        return x + self.pe[:x.size(0)]

class SimpleEncoder(nn.Module):

    def __init__(self, feature_dim, encoder_dim, image_size=14):
        super(SimpleEncoder, self).__init__()
        self.linear = nn.Conv2d(feature_dim, encoder_dim, kernel_size=1)
        self.positional_encoding = PositionalEncoding('fully_learnable', 2 * encoder_dim, image_size ** 2)

    def forward(self, x1: Tensor, x2: Tensor) -> Tensor:
        """

        Args:
            x1 (Tensor): visual feature at t1 shape of [N, 3, H, W]
            x2 (Tensor): visual feature at t2 shape of [N, 3, H, W]

        Returns:
            outputs (Tensor): output feature shape of [H'xW', N, 2C]

        """
        return self.positional_encoding(torch.cat([self.linear(x1).flatten(start_dim=2).permute(2, 0, 1), self.linear(x2).flatten(start_dim=2).permute(2, 0, 1)], dim=2))


INIT_ARGS = {
    'feature_dim': 4,
    'encoder_dim': 3,
    'image_size': 5,
}

ARGS = {
    'x1': torch.randn(2, 4, 5, 5),
    'x2': torch.randn(2, 4, 5, 5),
}

if __name__ == '__main__':
    model = SimpleEncoder(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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 3, dtype family float, shape (25, 2, 6) — shape (25, 2, 6) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_get_activation_fn Ran
ran; our contract draft was wrong, not the code
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("25f24e4d230ced80")
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 function. 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 torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

ARGS = {
    'activation': 'relu'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
CoAttentionTransformerEncoder Not yet run
unverified (harvested, no recorded run)
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("a8899349acbad648")
How it ran

no invocation recorded.

MCCFormer Not yet run
unverified (harvested, no recorded run)
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("986e31d80012b44f")
How it ran

no invocation recorded.

MCCFormerEncoderD Not yet run
unverified (harvested, no recorded run)
doiken23/mccformers.pytorch/models/model.py
code served (permissive licence) · get_code("c3103140b48208b9")
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, 0 are also present in other papers whose code we hold (0 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.

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

Change captioning tasks aim to detect changes in image pairs observed before and after a scene change and generate a natural language description of the changes. Existing change captioning studies have mainly focused on a single change. However, detecting and describing multiple changed parts in image pairs is essential for enhancing adaptability to complex scenarios. We solve the above issues from three aspects: (i) We propose a simulation-based multi-change captioning dataset; (ii) We benchmark existing state-of-the-art methods of single change captioning on multi-change captioning; (iii) We further propose Multi-Change Captioning transformers (MCCFormers) that identify change regions by densely correlating different regions in image pairs and dynamically determines the related change regions with words in sentences. The proposed method obtained the highest scores on four conventional change captioning evaluation metrics for multichange captioning. Additionally, our proposed method can separate attention maps for each change and performs well with respect to change localization. Moreover, the proposed framework outperformed the previous state-of-the-art methods on an existing change captioning benchmark, CLEVR-Change, by a large margin (+6.1 on BLEU-4 and +9.7 on CIDEr scores), indicating its general ability in change captioning tasks. The code and dataset are available at the project page 1 .

For agents

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

get_harvested_code_for_paper("2103.14146")
get_code_for_paper("2103.14146")
have("2103.14146")

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

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

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

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

Connect an agent — have() is free.