SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.01725 · CVPR · 2024

Disentangled Pre-training for Human-Object Interaction Detection

Xiangmin Xu, Changxing Ding, Zhuolong Li, Xingao Li

arXiv · PDF · Open in the Atlas

Code that ran

5 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; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 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/2404.01725.json · badge: /api/ran/2404.01725.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
xingaoli/DP-HOI canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
dice_loss Ran
ran, violated the contract we drafted
xingaoli/DP-HOI/models/segmentation.py
code served (permissive licence) · get_code("ac8fe530cdad4d8c")
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 0, dtype family float, shape () 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 sample inputs and targets tensors
# The function expects tensors that can be flattened and have sigmoid applied
# Shape: batch_size=2, spatial_dims flattened to create predictions
batch_size = 2
num_spatial = 4

# inputs: predictions before sigmoid, shape (batch_size, num_spatial)
inputs = torch.randn(batch_size, num_spatial)

# targets: binary labels matching inputs shape, values 0 or 1
targets = torch.randint(0, 2, (batch_size, num_spatial), dtype=torch.float32)

# num_boxes: number of boxes for normalization
num_boxes = 2

ARGS = {
    "inputs": inputs,
    "targets": targets,
    "num_boxes": num_boxes,
}
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 0, dtype family float, shape () — shape () 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
dn_post_process Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xingaoli/DP-HOI/models/dn_components.py
code served (permissive licence) · get_code("9db6a2fdc3039d38")
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
import numpy as np

torch.manual_seed(0)

# Construct tensor arguments
# outputs_class: shape (batch, num_queries, total_seq_len, num_classes)
batch_size = 2
num_queries = 3
total_seq_len = 10
num_classes = 4

outputs_class = torch.randn(batch_size, num_queries, total_seq_len, num_classes)
outputs_coord = torch.randn(batch_size, num_queries, total_seq_len, 5)

# mask_dict with pad_size > 0 to trigger the if branch
mask_dict = {
    'pad_size': 4
}

ARGS = {
    'outputs_class': outputs_class,
    'outputs_coord': outputs_coord,
    'mask_dict': mask_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
prepare_for_loss Ran
ran; our contract draft was wrong, not the code
xingaoli/DP-HOI/models/dn_components.py
code served (permissive licence) · get_code("47f1cef8edcb4695")
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
import numpy as np

torch.manual_seed(0)

# Construct the mask_dict with all required keys
# Based on the function body, we need:
# - output_known_lbs_bboxes: tuple of (output_known_class, output_known_coord)
# - known_lbs_bboxes: tuple of (known_labels, known_bboxs)
# - map_known_indice: indices for gathering
# - known_indice: indices for known objects
# - batch_idx: batch indices

# Create small tensors with distinct dimensions for clarity
batch_size = 2
num_queries = 3
num_classes = 5
coord_dim = 4
num_known = 4

# output_known_class shape: (1, batch_size, num_queries, num_classes) before permute
# After permute(1,2,0,3): (batch_size, num_queries, 1, num_classes)
output_known_class = torch.randn(1, batch_size, num_queries, num_classes)
output_known_coord = torch.randn(1, batch_size, num_queries, coord_dim)

# known_labels and known_bboxs
known_labels = torch.randint(0, num_classes, (num_known,))
known_bboxs = torch.randn(num_known, coord_dim)

# map_known_indice: maps to positions in the batch/query grid
map_known_indice = torch.tensor([0, 1, 2, 1])  # shape (num_known,)

# known_indice: indices of known objects
known_indice = torch.tensor([0, 1, 2, 3])  # shape (num_known,)

# batch_idx: which batch each object belongs to
batch_idx = torch.tensor([0, 0, 1, 1])  # shape (num_known,)

mask_dict = {
    'output_known_lbs_bboxes': (output_known_class, output_known_coord),
    'known_lbs_bboxes': (known_labels, known_bboxs),
    'map_known_indice': map_known_indice,
    'known_indice': known_indice,
    'batch_idx': batch_idx,
}

ARGS = {
    'mask_dict': mask_dict,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
process_video_to_frames Ran
ran, honoured the contract we drafted
xingaoli/DP-HOI/pre_datasets/pre_kinetics700.py
code served (permissive licence) · get_code("ef152cffea106bb8")
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 int, ndim 0, dtype family int, shape () 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 os
import cv2
import numpy as np
import tempfile
from unittest.mock import Mock, patch, MagicMock

# Create a temporary directory for output
temp_output_dir = tempfile.mkdtemp()

# Create a mock video file path (won't actually be read in this setup)
temp_video_dir = tempfile.mkdtemp()
mock_video_path = os.path.join(temp_video_dir, "test_video.mp4")

# Create a minimal action dictionary
action_dict = {
    "running": 0,
    "walking": 1,
    "jumping": 2
}

# Create annotations list
annotations = []

# Action name
actionname = "running"

# Mock cv2.VideoCapture to return valid frame data
class MockVideoCapture:
    def __init__(self, path):
        self.path = path
        self.frame_index = 0
        self.total_frames = 100
        self.frame_rate = 30
        
    def read(self):
        if self.frame_index < self.total_frames:
            # Return a valid dummy image (480x640x3 BGR format)
            image = np.random.randint(0, 256, (480, 640, 3), dtype=np.uint8)
            self.frame_index += 1
            return True, image
        return False, None
    
    def get(self, prop_id):
        if prop_id == 5:  # cv2.CAP_PROP_FPS
            return self.frame_rate
        elif prop_id == 7:  # cv2.CAP_PROP_FRAME_COUNT
            return float(self.total_frames)
        elif prop_id == 0:  # cv2.CAP_PROP_POS_FRAMES
            return float(self.frame_index)
        return 0.0
    
    def set(self, prop_id, value):
        if prop_id == cv2.CAP_PROP_POS_FRAMES:
            self.frame_index = int(value)
        return True

# Patch cv2 functions
with patch('cv2.VideoCapture', MockVideoCapture):
    with patch('cv2.imwrite', return_value=True):
        # Define ARGS with all required parameters
        ARGS = {
            "videopath": mock_video_path,
            "output_videopath": temp_output_dir,
            "annotations": annotations,
            "action_dict": action_dict,
            "actionname": actionname
        }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
sigmoid_focal_loss Ran
ran; our contract draft was wrong, not the code
xingaoli/DP-HOI/models/segmentation.py
code served (permissive licence) · get_code("5c0711aada67957e")
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 0, dtype family float, shape () 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.functional as F

torch.manual_seed(0)

# Create small tensors for inputs and targets
# inputs: predictions (logits) - shape (2, 4) for batch_size=2, num_predictions=4
inputs = torch.randn(2, 4, requires_grad=True)

# targets: binary labels - shape (2, 4) matching inputs
targets = torch.randint(0, 2, (2, 4), dtype=torch.float32)

# num_boxes: number of boxes for normalization
num_boxes = 2

# alpha and gamma are already float parameters with defaults
alpha = 0.25
gamma = 2.0

ARGS = {
    "inputs": inputs,
    "targets": targets,
    "num_boxes": num_boxes,
    "alpha": alpha,
    "gamma": gamma,
}
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 0, dtype family float, shape () — shape () 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
build_transformer Not yet run
unverified (harvested, no recorded run)
xingaoli/DP-HOI/models/transformer.py
code served (permissive licence) · get_code("fdc5e45115a1f362")
How it ran

no invocation recorded.

prepare_for_dn Not yet run
unverified (harvested, no recorded run)
xingaoli/DP-HOI/models/dn_components.py
code served (permissive licence) · get_code("06f8c01bf94e4524")
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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 2 the same month, 4 later) and 3 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
sigmoid_focal_loss 56 other papers
44 dated earlier, 1 the same month, 11 later · 1 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.11731 (2021-03)
Meta-DETR: Image-Level Few-Shot Object Detection with Inter-Class Correlation Exploitation
and 53 more not named here
dice_loss 40 other papers
31 dated earlier, 1 the same month, 8 later · 1 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.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
and 37 more not named here
build_transformer 32 other papers
23 dated earlier, 8 later, 1 same year, order not determinable
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2103.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
2104.04369 (2021-04)
Video-aided Unsupervised Grammar Induction
and 29 more not named here
dn_post_process 5 other papers
3 dated earlier, 2 later · 1 only as an assembly brick
2201.12329 (2022-01)
DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR
2203.01305 (2022-03)
DN-DETR: Accelerate DETR Training by Introducing Query DeNoising
2206.02777 (2022-06)
Mask DINO: Towards A Unified Transformer-based Framework for Object Detection and Segmentation
and 2 more not named here

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

Detecting human-object interaction (HOI) has long been limited by the amount of supervised data available. Recent approaches address this issue by pre-training according to pseudo-labels, which align object regions with HOI triplets parsed from image captions. However, pseudo-labeling is tricky and noisy, making HOI pre-training a complex process. Therefore, we propose an efficient disentangled pretraining method for HOI detection (DP-HOI) to address this problem. First, DP-HOI utilizes object detection and action recognition datasets to pre-train the detection and interaction decoder layers, respectively. Then, we arrange these decoder layers so that the pre-training architecture is consistent with the downstream HOI detection task. This facilitates efficient knowledge transfer. Specifically, the detection decoder identifies reliable human instances in each action recognition dataset image, generates one corresponding query, and feeds it into the interaction decoder for verb classification. Next, we combine the human instance verb predictions in the same image and impose image-level supervision. The DP-HOI structure can be easily adapted to the HOI detection task, enabling effective model parameter initialization. Therefore, it significantly enhances the performance of existing HOI detection models on a broad range of rare categories. The code and pre-trained weight are available at https://github.com/xingaoli/DP-HOI.

For agents

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

get_harvested_code_for_paper("2404.01725")
get_code_for_paper("2404.01725")
have("2404.01725")

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

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

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

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

Connect an agent — have() is free.