SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.11895 · NeurIPS · 2022

Learning Viewpoint-Agnostic Visual Representations by Recovering Tokens in 3D Space

Michael Ryoo, Jinghuan Shang, Srijan Das

arXiv · PDF · Open in the Atlas

Code that ran

5 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, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 4 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/2206.11895.json · badge: /api/ran/2206.11895.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
elicassion/3DTRL canonical (classifier label)
classifier basis: classifier_2025
0 ran · 2 no recorded run
elicassion/3dtrl community
Papers with Code archive
5 ran · 2 no recorded run
FunctionStatusWhere it lives
CameraCoordEstimator Ran
ran on a synthesized input
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("d5fc820997785b43")
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 (2, 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
import torch.nn as nn

class Config:
    def __init__(self):
        self.embed_dim = 4

INIT_ARGS = {
    'config': Config(),
    'dim': 3
}

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

if __name__ == '__main__':
    model = nn.Module()
    
    class CameraCoordEstimator(nn.Module):
        """
        Input:
            Feature tokens B N D
        Ouput:
            Estimated coordinates of each token B N 1(3) in camera view
            1 is depth, 3 is x y z
        """

        def __init__(self, config, dim=3):
            super(CameraCoordEstimator, self).__init__()
            self.net = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU(), nn.Linear(config.embed_dim, dim))

        def forward(self, x):
            return self.net(x)
    
    model = CameraCoordEstimator(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: torch.Size([2, 5, 3])")
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 (2, 5, 3) — shape (2, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
CameraProjection Ran
ran on a synthesized input
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("0e5019a8a0cd9023")
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 torch
import torch.nn as nn
import numpy as np

class CameraProjection(nn.Module):
    def __init__(self, config=None):
        super(CameraProjection, self).__init__()

    def forward(self, p_camera, rot, trans):
        return p_camera @ rot + trans

INIT_ARGS = {}

ARGS = {
    'p_camera': torch.randn(2, 4, 3),
    'rot': torch.randn(3, 3),
    'trans': torch.randn(1, 3)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 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)
CameraProps Ran
ran on a synthesized input
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("1a0559547edb5a5c")
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 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 torch.nn as nn

def rotation_tensor(theta, phi, psi, b=1):
    """
    Takes theta, phi, and psi and generates the
    3x3 rotation matrix. Works for batched ops
    As well, returning a Bx3x3 matrix.
    """
    device = theta.device
    one = torch.ones(b, 1, 1).to(device)
    zero = torch.zeros(b, 1, 1).to(device)
    theta = theta.view(b, 1, 1)
    phi = phi.view(b, 1, 1)
    psi = psi.view(b, 1, 1)
    rot_x = torch.cat((torch.cat((one, zero, zero), 1), torch.cat((zero, theta.cos(), theta.sin()), 1), torch.cat((zero, -theta.sin(), theta.cos()), 1)), 2)
    rot_y = torch.cat((torch.cat((phi.cos(), zero, -phi.sin()), 1), torch.cat((zero, one, zero), 1), torch.cat((phi.sin(), zero, phi.cos()), 1)), 2)
    rot_z = torch.cat((torch.cat((psi.cos(), -psi.sin(), zero), 1), torch.cat((psi.sin(), psi.cos(), zero), 1), torch.cat((zero, zero, one), 1)), 2)
    return torch.bmm(rot_z, torch.bmm(rot_y, rot_x))

class CameraProps(nn.Module):
    """
    Generates the extrinsic rotation and translation matrix
    For the current camera. Takes CLS and pos_emb as input, then
    Returns the rotation matrix (3x3) and translation (3x1)
    """

    def __init__(self, config, pred_campos_from='both-sep'):
        super(CameraProps, self).__init__()
        self.pred_campos_from = pred_campos_from
        if pred_campos_from == 'both-sep':
            self.token_proj_1 = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
            self.token_proj_2 = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
            self.cls_proj = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU(), nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
        elif pred_campos_from == 'both-avg' or pred_campos_from == 'tok':
            self.token_proj_1 = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
            self.token_proj_2 = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
        elif pred_campos_from == 'cls':
            self.cls_proj = nn.Sequential(nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU(), nn.Linear(config.embed_dim, config.embed_dim), nn.ReLU())
        self.mix_proj = nn.Sequential(nn.Linear(config.embed_dim, 32), nn.ReLU(), nn.Linear(32, 32))
        self.rot = nn.Linear(32, 3)
        self.trans = nn.Linear(32, 3)
        self.trans.weight.data.copy_(torch.ones(32, dtype=torch.float))
        self.trans.bias.data.zero_()

    def forward(self, cls_x, x):
        B = x.size(0)
        if self.pred_campos_from == 'both-sep':
            cls_x = self.cls_proj(cls_x)
            x = self.token_proj_1(x)
            x = torch.mean(x, dim=1)
            x = self.token_proj_2(x)
            x = cls_x + x
        elif self.pred_campos_from == 'both-avg':
            x = torch.cat((cls_x.unsqueeze(1), x), dim=1)
            x = self.token_proj_1(x)
            x = torch.mean(x, dim=1)
            x = self.token_proj_2(x)
        elif self.pred_campos_from == 'cls':
            x = self.cls_proj(cls_x)
        elif self.pred_campos_from == 'tok':
            x = self.token_proj_1(x)
            x = torch.mean(x, dim=1)
            x = self.token_proj_2(x)
        x = self.mix_proj(x)
        r = self.rot(x)
        return (rotation_tensor(r[:, 0], r[:, 1], r[:, 2], B), self.trans(x).view(B, 1, 3))


class Config:
    def __init__(self, embed_dim):
        self.embed_dim = embed_dim


INIT_ARGS = {
    'config': Config(embed_dim=4),
    'pred_campos_from': 'both-sep'
}

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

if __name__ == '__main__':
    model = CameraProps(**INIT_ARGS)
    rot, trans = model(**ARGS)
    print(f"Rotation shape: {rot.shape}")
    print(f"Translation shape: {trans.shape}")
    print(f"Rotation:\n{rot}")
    print(f"Translation:\n{trans}")
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
rotation_tensor Ran
ran; our contract draft was wrong, not the code
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("8e1a9d1d14fd2b7d")
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, 3, 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 function takes theta, phi, psi (angle tensors) and b (batch size)
# It uses .device, .view(), .cos(), .sin() on the angle tensors
# It performs batched matrix multiplication with torch.bmm()

# Create small angle tensors for batch size 2
b = 2
theta = torch.randn(b)
phi = torch.randn(b)
psi = torch.randn(b)

ARGS = {
    "theta": theta,
    "phi": phi,
    "psi": psi,
    "b": b
}
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, 3, 3) — shape (2, 3, 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
uvd_to_xyz Ran
ran; our contract draft was wrong, not the code
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("33eac78c6a552056")
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, 12) 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 sample tensors for u, v, d
# u and v represent normalized image coordinates
# d represents depth
# We'll use shape (2, 4) for batch_size=2, feature_dim=4

u = torch.randn(2, 4)
v = torch.randn(2, 4)
d = torch.randn(2, 4)

ARGS = {
    "u": u,
    "v": v,
    "d": d,
}
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, 12) — shape (2, 12) 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
Estimator Not yet run
unverified (harvested, no recorded run)
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("ac46b3e1e6b72a84")
How it ran

no invocation recorded.

ThreeDTRL Not yet run
unverified (harvested, no recorded run)
elicassion/3dtrl/model/three_d_trl.py
code served (permissive licence) · get_code("edca97b8e626c910")
How it ran

no invocation recorded.

tc_loss Not yet run
unverified (harvested, no recorded run)
elicassion/3DTRL/multiview_video_alignment.py
code served (permissive licence) · get_code("7f19c4332eea27a4")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
elicassion/3DTRL/imagenet_train.py
code served (permissive licence) · get_code("e2a98c6a53ded11f")
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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 8 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
validate 9 other papers
4 dated earlier, 5 later
2103.15632 (2021-03)
Regular Polytope Networks
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2204.05173 (2022-04)
Machine Learning State-of-the-Art with Uncertainties
and 6 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-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

Humans are remarkably flexible in understanding viewpoint changes due to visual cortex supporting the perception of 3D structure. In contrast, most of the computer vision models that learn visual representation from a pool of 2D images often fail to generalize over novel camera viewpoints. Recently, the vision architectures have shifted towards convolution-free architectures, visual Transformers, which operate on tokens derived from image patches. However, these Transformers do not perform explicit operations to learn viewpoint-agnostic representation for visual understanding. To this end, we propose a 3D Token Representation Layer (3DTRL) that estimates the 3D positional information of the visual tokens and leverages it for learning viewpoint-agnostic representations. The key elements of 3DTRL include a pseudo-depth estimator and a learned camera matrix to impose geometric transformations on the tokens, trained in an unsupervised fashion. These enable 3DTRL to recover the 3D positional information of the tokens from 2D patches. In practice, 3DTRL is easily plugged-in into a Transformer. Our experiments demonstrate the effectiveness of 3DTRL in many vision tasks including image classification, multiview video alignment, and action recognition. The models with 3DTRL outperform their backbone Transformers in all the tasks with minimal added computation. Our code is available at https://github.com/elicassion/3DTRL. Over the past few years, computer vision models have developed rapidly from CNNs [6,26,58] to now Transformers [16,24,59]. With these models, we can now accurately classify objects in an image, align image frames among video pairs, classify actions in videos, and more. Despite their successes, many of the models neglect that the world is in 3D and do not extend beyond the XY image plane [20]. While humans can readily estimate the 3D structure of a scene from 2D pixels of an image, most of the existing vision models with 2D images do not take the 3D structure of the world into consideration. This is one of the reasons why humans are able to recognize objects in images and actions in videos regardless of their viewpoint, but the vision models often fail to generalize over novel viewpoints [11,20,42]. Consequently, in this paper, we develop an approach to learn viewpoint-agnostic representations for a robust understanding of the visual data. Naive solutions to obtain viewpoint-agnostic representation would be either supervising the model with densely annotated 3D data, or learning representation from a large scale 2D datasets with samples encompassing different viewpoints. Given the fact that such high quality data are expensive to acquire and hard to scale, an approach with a higher sample efficiency without 3D supervision is desired. To this end, we propose a 3D Token Representation Layer (3DTRL), incorporating 3D camera transformations into the recent successful visual Transformers [7,16,36,59]. 3DTRL first recovers 36th Conference on Neural Information Processing Systems (NeurIPS 2022).

For agents

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

get_harvested_code_for_paper("2206.11895")
get_code_for_paper("2206.11895")
have("2206.11895")

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

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

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

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

Connect an agent — have() is free.