SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper · CVPR · 2024

Unifying Top-down and Bottom-up Scanpath Prediction Using Transformers

Dimitris Samaras, Minh Hoai, Seoyoung Ahn, Gregory Zelinsky, Zhibo Yang, Sounak Mondal, Ruoyu Xue

Open in the Atlas

Code that ran

7 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; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 5 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper.json · badge: /api/ran/Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper.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
cvlab-stonybrook/HAT canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
actions2scanpaths Ran
ran on a synthesized input
cvlab-stonybrook/HAT/hat/evaluation.py
code served (permissive licence) · get_code("131169d1a8d9d2e2")
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 list, 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
import numpy as np

torch.manual_seed(0)

# The function expects norm_fixs to be an iterable of trajectories
# Each trajectory is a tuple: (task_name, img_name, condition, fixs)
# where fixs is a tensor with shape (num_fixations, 2) containing normalized coordinates

# Create sample trajectories
traj1 = (
    "task_1",
    "image_1.jpg",
    "condition_A",
    torch.tensor([[0.5, 0.3], [0.6, 0.4], [0.7, 0.5]], dtype=torch.float32)
)

traj2 = (
    "task_2",
    "image_2.jpg",
    "condition_B",
    torch.tensor([[0.2, 0.1], [0.3, 0.2]], dtype=torch.float32)
)

norm_fixs = [traj1, traj2]

ARGS = {
    "norm_fixs": norm_fixs,
    "patch_num": 16,
    "im_h": 480,
    "im_w": 640,
}
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 list, ndim 1, dtype family float — a list 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
get_IOR_mask Ran
ran on a synthesized input
cvlab-stonybrook/HAT/hat/evaluation.py
code served (permissive licence) · get_code("e8c8b9b86634113e")
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, 40) 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 numpy as np

torch.manual_seed(0)

# Reading the function:
# - norm_x, norm_y: used with len() and * w, * h (arrays/lists of normalized coords)
# - h, w: integers used for ogrid and reshaping
# - r: radius, used in comparison with dist

# Create small normalized coordinates (batch size 2)
norm_x = np.array([0.3, 0.7])
norm_y = np.array([0.4, 0.6])

# Image dimensions
h = 5
w = 8

# Radius for mask
r = 2.5

ARGS = {
    'norm_x': norm_x,
    'norm_y': norm_y,
    'h': h,
    'w': w,
    'r': r
}
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 Tensor, ndim 2, dtype family float, shape (2, 40) — shape (2, 40) 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
sinkhorn Ran
ran; our contract draft was wrong, not the code
cvlab-stonybrook/HAT/common/losses.py
code served (permissive licence) · get_code("482fcf95e53c18d3")
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 (4, 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 small tensors for the Sinkhorn-Knopp algorithm
na = 4  # number of samples in target domain
nb = 3  # number of samples in source domain

# a: target measure (should sum to 1, non-negative)
a = torch.ones(na, dtype=torch.float32)
a = a / a.sum()

# b: source measure (should sum to 1, non-negative)
b = torch.ones(nb, dtype=torch.float32)
b = b / b.sum()

# C: cost matrix (na x nb)
C = torch.randn(na, nb, dtype=torch.float32).abs()

# warm_start: optional dictionary with u and v
warm_start_dict = {
    'u': torch.ones(na, dtype=torch.float32) / na,
    'v': torch.ones(nb, dtype=torch.float32) / nb
}

ARGS = {
    'a': a,
    'b': b,
    'C': C,
    'reg': 0.1,
    'maxIter': 1000,
    'stopThr': 1e-09,
    'verbose': False,
    'log': False,
    'warm_start': None,
    'eval_freq': 10,
    'print_freq': 200,
}
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 (4, 3) — shape (4, 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
sinkhorn_knopp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cvlab-stonybrook/HAT/common/losses.py
code served (permissive licence) · get_code("efb7b74d984b62d7")
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 small test tensors for the Sinkhorn-Knopp algorithm
na = 4  # number of samples in target domain
nb = 3  # number of samples in source domain

# a: target measure (na,), must sum to 1 and be non-negative
a = torch.ones(na) / na

# b: source measure (nb,), must sum to 1 and be non-negative
b = torch.ones(nb) / nb

# C: cost matrix (na, nb)
C = torch.randn(na, nb).abs()

# warm_start: optional dict with 'u' and 'v' keys
warm_start = {
    'u': torch.ones(na) / na,
    'v': torch.ones(nb) / nb
}

ARGS = {
    'a': a,
    'b': b,
    'C': C,
    'reg': 0.1,
    'maxIter': 100,
    'stopThr': 1e-9,
    'verbose': False,
    'log': True,
    'warm_start': warm_start,
    'eval_freq': 10,
    'print_freq': 50,
}
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
sinkhorn_stabilized Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cvlab-stonybrook/HAT/common/losses.py
code served (permissive licence) · get_code("7d7ce732072ce0e3")
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 small tensors for the OT problem
na = 3  # number of samples in target domain
nb = 2  # number of samples in source domain

# a: target measure (probability distribution over na samples)
a = torch.tensor([0.6, 0.3, 0.1], dtype=torch.float32)

# b: source measure (probability distribution over nb samples)
b = torch.tensor([0.4, 0.6], dtype=torch.float32)

# C: cost matrix (na x nb)
C = torch.tensor([
    [1.0, 2.0],
    [3.0, 1.5],
    [2.0, 2.5]
], dtype=torch.float32)

# warm_start dict with alpha and beta tensors
warm_start = {
    'alpha': torch.zeros(na, dtype=torch.float32),
    'beta': torch.zeros(nb, dtype=torch.float32)
}

ARGS = {
    'a': a,
    'b': b,
    'C': C,
    'reg': 0.1,
    'maxIter': 100,
    'tau': 1000.0,
    'stopThr': 1e-9,
    'verbose': False,
    'log': True,
    'warm_start': warm_start,
    'eval_freq': 10,
    'print_freq': 50
}
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
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cvlab-stonybrook/HAT/hat/backbone/swin.py
code served (permissive licence) · get_code("f9fd6241d935f07b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (12, 4, 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 tensor with shape (B, H, W, C)
# B = 2 (batch size)
# H = 8 (height, must be divisible by window_size)
# W = 12 (width, must be divisible by window_size)
# C = 4 (channels)
# window_size = 4

B = 2
H = 8
W = 12
C = 4
window_size = 4

x = torch.randn(B, H, W, C)

ARGS = {
    'x': x,
    'window_size': window_size
}
Setup block drafted by
a language model, Claude Sonnet 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 (12, 4, 4, 4) — shape (12, 4, 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
window_reverse Ran
ran; our contract draft was wrong, not the code
cvlab-stonybrook/HAT/hat/backbone/swin.py
code served (permissive licence) · get_code("fb32094c6dbece71")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 8, 12, 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 torch

torch.manual_seed(0)

# Define parameters
# We need windows of shape (num_windows*B, window_size, window_size, C)
# where num_windows = (H // window_size) * (W // window_size)

B = 2
H = 8
W = 12
window_size = 4
C = 6

# Calculate num_windows
num_windows_h = H // window_size  # 8 // 4 = 2
num_windows_w = W // window_size  # 12 // 4 = 3
num_windows = num_windows_h * num_windows_w  # 2 * 3 = 6

# Total number of windows across batch
total_windows = num_windows * B  # 6 * 2 = 12

# Create windows tensor
windows = torch.randn(total_windows, window_size, window_size, C)

ARGS = {
    'windows': windows,
    'window_size': window_size,
    'H': H,
    'W': W
}
Setup block drafted by
a language model, Claude Sonnet 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, 8, 12, 6) — shape (2, 8, 12, 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: none by the harness; any seed is in the setup block

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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 2 later) and 2 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
window_reverse 227 other papers
150 dated earlier, 19 later, 58 same year, order not determinable · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
window_partition 223 other papers
148 dated earlier, 19 later, 56 same year, order not determinable · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
sinkhorn 1 other paper
1 dated earlier
2009.13077 (2020-09)
Distribution Matching for Crowd Counting
sinkhorn_knopp 1 other paper
1 dated earlier
2009.13077 (2020-09)
Distribution Matching for Crowd Counting
sinkhorn_stabilized 1 other paper
1 dated earlier
2009.13077 (2020-09)
Distribution Matching for Crowd Counting

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

Most models of visual attention aim at predicting either top-down or bottom-up control, as studied using different visual search and free-viewing tasks. In this paper we propose the Human Attention Transformer (HAT), a single model that predicts both forms of attention control. HAT uses a novel transformer-based architecture and a simplified foveated retina that collectively create a spatio-temporal awareness akin to the dynamic visual working memory of humans. HAT not only establishes a new state-of-the-art in predicting the scanpath of fixations made during target-present and target-absent visual search and "taskless" free viewing, but also makes human gaze behavior interpretable. Unlike previous methods that rely on a coarse grid of fixation cells and experience information loss due to fixation discretization, HAT features a sequential dense prediction architecture and outputs a dense heatmap for each fixation, thus avoiding discretizing fixations. HAT sets a new standard in computational attention, which emphasizes effectiveness, generality, and interpretability. HAT's demonstrated scope and applicability will likely inspire the development of new attention models that can better predict human behavior in various attention-demanding scenarios. Code is available at https://github.com/cvlab-stonybrook/HAT.

For agents

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

get_harvested_code_for_paper("Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper")
get_code_for_paper("Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper")
have("Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper")

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

curl https://syntology.ai/api/ran/Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper.json

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

[![Syntology run record](https://syntology.ai/api/ran/Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper.svg)](https://syntology.ai/paper/Yang_Unifying_Top-down_and_Bottom-up_Scanpath_Prediction_Using_Transformers_CVPR_2024_paper)

Connect an agent — have() is free.