SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.05077 · NeurIPS · 2021

Mining the Benefits of Two-stage and One-stage HOI Detection

Chen Gao, Aixi Zhang, Yue Liao, Si Liu, Miao Lu, Yongliang Wang, Xiaobo Li

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-22; 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/2108.05077.json · badge: /api/ran/2108.05077.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
yueliao/cdn canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
YueLiao/CDN marked official in Papers with Code
Papers with Code archive
3 ran · 0 no recorded run
FunctionStatusWhere it lives
CDNHOI Ran
ran on a synthesized input · constructed an object; no result was computed
YueLiao/CDN/models/hoi.py
code served (permissive licence) · get_code("627d60da6276fc13")
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 an instance of its own class, CDNHOI: the run constructed the object and did not call it, so no result was computed. 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
from torch import nn
import torch.nn.functional as F
from typing import Optional, List

torch.manual_seed(0)

# Create a minimal backbone
class MinimalBackbone(nn.Module):
    def __init__(self, num_channels=3):
        super().__init__()
        self.num_channels = num_channels
        self.conv = nn.Conv2d(3, num_channels, kernel_size=1)
    
    def forward(self, samples):
        # samples is a NestedTensor
        tensors, mask = samples.decompose()
        # tensors shape: (batch, channels, height, width)
        features = self.conv(tensors)
        # Return features and positional encodings
        # features should be a list of NestedTensor objects
        pos = torch.zeros_like(features)
        return [type('obj', (), {'decompose': lambda: (features, mask)})()], [pos]

# Create a minimal transformer
class MinimalTransformer(nn.Module):
    def __init__(self, d_model=8, num_queries=10):
        super().__init__()
        self.d_model = d_model
        self.num_queries = num_queries
        self.linear = nn.Linear(d_model, d_model)
    
    def forward(self, src, mask, query_embed, pos):
        # src shape: (batch, channels, height, width)
        # Flatten spatial dims
        batch, channels, h, w = src.shape
        src_flat = src.view(batch, channels, -1).transpose(1, 2)  # (batch, h*w, channels)
        
        # Simulate decoder outputs
        # hopd_out: list of decoder layer outputs, last dim should be num_queries x d_model
        hopd_out = [torch.randn(batch, self.num_queries, self.d_model) for _ in range(2)]
        interaction_decoder_out = [torch.randn(batch, self.num_queries, self.d_model) for _ in range(2)]
        
        return hopd_out, interaction_decoder_out, None

# Create minimal args object
class Args:
    def __init__(self):
        self.use_matching = True
        self.dec_layers_hopd = 2
        self.dec_layers_interaction = 2

# Create test data
batch_size = 2
hidden_dim = 8
num_queries = 10
num_obj_classes = 5
num_verb_classes = 7
height = 4
width = 3
num_channels = 3

backbone = MinimalBackbone(num_channels=hidden_dim)
transformer = MinimalTransformer(d_model=hidden_dim, num_queries=num_queries)
args = Args()

# Create sample input - list of tensors
sample_tensors = [torch.randn(num_channels, height, width) for _ in range(batch_size)]

ARGS = {
    'backbone': backbone,
    'transformer': transformer,
    'num_obj_classes': num_obj_classes,
    'num_verb_classes': num_verb_classes,
    'num_queries': num_queries,
    'aux_loss': True,
    'args': args,
}
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 CDNHOI — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CDNHOI 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
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
YueLiao/CDN/models/hoi.py
code served (permissive licence) · get_code("75c85d6b2403b897")
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 an instance of its own class, MLP: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

ARGS = {
    'input_dim': 4,
    'hidden_dim': 8,
    'output_dim': 3,
    'num_layers': 2,
}
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 MLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP 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
nested_tensor_from_tensor_list Ran
ran; our contract draft was wrong, not the code
YueLiao/CDN/models/hoi.py
code served (permissive licence) · get_code("384f0509d5ccd8b9")
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 NestedTensor. 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
from typing import List

torch.manual_seed(0)

# Create a list of 3D tensors with different sizes
# Each tensor has shape (C, H, W) where C=channels, H=height, W=width
tensor1 = torch.randn(3, 4, 5)  # 3 channels, 4 height, 5 width
tensor2 = torch.randn(3, 6, 7)  # 3 channels, 6 height, 7 width

tensor_list = [tensor1, tensor2]

ARGS = {
    "tensor_list": tensor_list
}
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 NestedTensor — a NestedTensor output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NestedTensor 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_cdn Not yet run
unverified (harvested, no recorded run)
yueliao/cdn/models/cdn.py
code served (permissive licence) · get_code("c792190de3b9bd2b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 3 later) and 1 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
MLP
brick of this paper's assembly: model
68 other papers
13 dated earlier, 3 the same month, 52 later · 58 only as an assembly brick
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2101.01909 (2021-01)
Line Segment Detection Using Transformers without Edges
and 65 more not named here
nested_tensor_from_tensor_list
brick of this paper's assembly: helper
19 other papers
5 dated earlier, 14 later · 11 only as an assembly brick
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2010.04159 (2020-10)
Deformable DETR: Deformable Transformers for End-to-End Object Detection
2103.05399 (2021-03)
QPIC: Query-Based Pairwise Human-Object Interaction Detection with Image-Wide Contextual Information
and 16 more not named here
build_cdn 1 other paper
1 later
2204.03541 (2022-04)
End-to-End Zero-Shot HOI Detection via Vision and Language Knowledge Distillation

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

Two-stage methods have dominated Human-Object Interaction (HOI) detection for several years. Recently, one-stage HOI detection methods have become popular. In this paper, we aim to explore the essential pros and cons of two-stage and one-stage methods. With this as the goal, we find that conventional two-stage methods mainly suffer from positioning positive interactive human-object pairs, while one-stage methods are challenging to make an appropriate trade-off on multi-task learning, i.e., object detection, and interaction classification. Therefore, a core problem is how to take the essence and discard the dregs from the conventional two types of methods. To this end, we propose a novel one-stage framework with disentangling human-object detection and interaction classification in a cascade manner. In detail, we first design a human-object pair generator based on a state-of-the-art one-stage HOI detector by removing the interaction classification module or head and then design a relatively isolated interaction classifier to classify each human-object pair. Two cascade decoders in our proposed framework can focus on one specific task, detection or interaction classification. In terms of the specific implementation, we adopt a transformer-based HOI detector as our base model. The newly introduced disentangling paradigm outperforms existing methods by a large margin, with a significant relative mAP gain of 9.32% on HICO-Det. The source codes are available at https://github.com/YueLiao/CDN.

For agents

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

get_harvested_code_for_paper("2108.05077")
get_code_for_paper("2108.05077")
have("2108.05077")

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

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

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

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

Connect an agent — have() is free.