SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.05274 · ICCV · 2023

Deep Optics for Video Snapshot Compressive Imaging

Xin Yuan, Ping Wang, Lishun Wang

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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 4 have no contract verdict; 0 failures of our instrument; 1 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.05274.json · badge: /api/ran/2404.05274.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
pwangcs/DeepOpticsSCI community
Papers with Code archive
4 ran · 1 no recorded run
FunctionStatusWhere it lives
BasicBlock Ran
ran on a synthesized input
pwangcs/DeepOpticsSCI/model/digital_layer.py
code served (permissive licence) · get_code("671a3dc95519631b")
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 5, 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 einops

class TimesAttention3D(nn.Module):
    def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None):
        super().__init__()
        self.dim = dim
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.scale = qk_scale or head_dim ** (-0.5)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.proj = nn.Linear(dim, dim)
        self.softmax = nn.Softmax(dim=-1)

    def forward(self, x):
        B_, N, C = x.shape
        qkv = self.qkv(x).reshape(B_, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = (qkv[0], qkv[1], qkv[2])
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        attn = self.softmax(attn)
        x = (attn @ v).transpose(1, 2).reshape(B_, N, C)
        x = self.proj(x)
        return x

class CFormerBlock(nn.Module):
    def __init__(self, dim, num_heads=4):
        super().__init__()
        self.conv = nn.Conv3d(dim, dim, (1, 3, 3), padding=(0, 1, 1))
        self.tsab = TimesAttention3D(dim, num_heads=num_heads)
        self.ffn = nn.Sequential(nn.Conv3d(dim, dim, 3, 1, 1), nn.LeakyReLU(inplace=True), nn.Conv3d(dim, dim, 1))

    def forward(self, x):
        _, _, _, h, w = x.shape
        conv_out = self.conv(x)
        tsab_in = einops.rearrange(conv_out, 'b c d h w->(b h w) d c')
        tsab_out = self.tsab(tsab_in)
        tsab_out = einops.rearrange(tsab_out, '(b h w) d c->b c d h w', h=h, w=w)
        ffn_in = tsab_out + x
        ffn_out = self.ffn(ffn_in) + ffn_in
        return ffn_out

class ResTSA(nn.Module):
    def __init__(self, dim, group_num):
        super().__init__()
        self.cformer_list = nn.ModuleList()
        self.group_num = group_num
        group_dim = dim // group_num
        for i in range(group_num):
            self.cformer_list.append(CFormerBlock(group_dim))
        self.last_conv = nn.Conv3d(dim, dim, 1)

    def forward(self, x):
        input_list = torch.chunk(x, chunks=self.group_num, dim=1)
        cf_in = input_list[0]
        out_list = []
        cf_out = self.cformer_list[0](cf_in)
        out_list.append(cf_out)
        for i in range(1, self.group_num):
            cf_in = input_list[i] + cf_out
            cf_out = self.cformer_list[i](cf_in)
            out_list.append(cf_out)
        out = torch.cat(out_list, dim=1)
        out = self.last_conv(out)
        out = x + out
        return out

class BasicBlock(nn.Module):
    def __init__(self, dim, depth=2):
        super().__init__()
        self.blocks = nn.ModuleList()
        if dim % 96 == 0:
            group_num = dim // 96
        elif dim % 128 == 0:
            group_num = dim // 64
        for i in range(depth):
            self.blocks.append(ResTSA(dim, group_num=group_num))

    def forward(self, x):
        for block in self.blocks:
            x = block(x)
        out = x
        return out

INIT_ARGS = {
    'dim': 128,
    'depth': 2
}

ARGS = {
    'x': torch.randn(2, 128, 3, 5, 7)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, 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)
CFormerBlock Ran
ran on a synthesized input
pwangcs/DeepOpticsSCI/model/digital_layer.py
code served (permissive licence) · get_code("7e43ae419883abce")
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 5, dtype family float, shape (2, 4, 2, 3, 5) 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 einops

class TimesAttention3D(nn.Module):

    def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None):
        super().__init__()
        self.dim = dim
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.scale = qk_scale or head_dim ** (-0.5)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.proj = nn.Linear(dim, dim)
        self.softmax = nn.Softmax(dim=-1)

    def forward(self, x):
        B_, N, C = x.shape
        qkv = self.qkv(x).reshape(B_, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = (qkv[0], qkv[1], qkv[2])
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        attn = self.softmax(attn)
        x = (attn @ v).transpose(1, 2).reshape(B_, N, C)
        x = self.proj(x)
        return x

class CFormerBlock(nn.Module):

    def __init__(self, dim, num_heads=4):
        super().__init__()
        self.conv = nn.Conv3d(dim, dim, (1, 3, 3), padding=(0, 1, 1))
        self.tsab = TimesAttention3D(dim, num_heads=num_heads)
        self.ffn = nn.Sequential(nn.Conv3d(dim, dim, 3, 1, 1), nn.LeakyReLU(inplace=True), nn.Conv3d(dim, dim, 1))

    def forward(self, x):
        _, _, _, h, w = x.shape
        conv_out = self.conv(x)
        tsab_in = einops.rearrange(conv_out, 'b c d h w->(b h w) d c')
        tsab_out = self.tsab(tsab_in)
        tsab_out = einops.rearrange(tsab_out, '(b h w) d c->b c d h w', h=h, w=w)
        ffn_in = tsab_out + x
        ffn_out = self.ffn(ffn_in) + ffn_in
        return ffn_out

INIT_ARGS = {
    'dim': 4,
    'num_heads': 2,
}

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

if __name__ == '__main__':
    model = CFormerBlock(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, f"Shape mismatch: {output.shape} vs {ARGS['x'].shape}"
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, dtype family float, shape (2, 4, 2, 3, 5) — shape (2, 4, 2, 3, 5) 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)
ResTSA Ran
ran on a synthesized input
pwangcs/DeepOpticsSCI/model/digital_layer.py
code served (permissive licence) · get_code("ed2d331de6ccdd5c")
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 5, 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 einops
import numpy as np

# The class definitions (already provided)
class TimesAttention3D(nn.Module):
    def __init__(self, dim, num_heads, qkv_bias=False, qk_scale=None):
        super().__init__()
        self.dim = dim
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.scale = qk_scale or head_dim ** (-0.5)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.proj = nn.Linear(dim, dim)
        self.softmax = nn.Softmax(dim=-1)

    def forward(self, x):
        B_, N, C = x.shape
        qkv = self.qkv(x).reshape(B_, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = (qkv[0], qkv[1], qkv[2])
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        attn = self.softmax(attn)
        x = (attn @ v).transpose(1, 2).reshape(B_, N, C)
        x = self.proj(x)
        return x

class CFormerBlock(nn.Module):
    def __init__(self, dim, num_heads=4):
        super().__init__()
        self.conv = nn.Conv3d(dim, dim, (1, 3, 3), padding=(0, 1, 1))
        self.tsab = TimesAttention3D(dim, num_heads=num_heads)
        self.ffn = nn.Sequential(nn.Conv3d(dim, dim, 3, 1, 1), nn.LeakyReLU(inplace=True), nn.Conv3d(dim, dim, 1))

    def forward(self, x):
        _, _, _, h, w = x.shape
        conv_out = self.conv(x)
        tsab_in = einops.rearrange(conv_out, 'b c d h w->(b h w) d c')
        tsab_out = self.tsab(tsab_in)
        tsab_out = einops.rearrange(tsab_out, '(b h w) d c->b c d h w', h=h, w=w)
        ffn_in = tsab_out + x
        ffn_out = self.ffn(ffn_in) + ffn_in
        return ffn_out

class ResTSA(nn.Module):
    def __init__(self, dim, group_num):
        super().__init__()
        self.cformer_list = nn.ModuleList()
        self.group_num = group_num
        group_dim = dim // group_num
        for i in range(group_num):
            self.cformer_list.append(CFormerBlock(group_dim))
        self.last_conv = nn.Conv3d(dim, dim, 1)

    def forward(self, x):
        input_list = torch.chunk(x, chunks=self.group_num, dim=1)
        cf_in = input_list[0]
        out_list = []
        cf_out = self.cformer_list[0](cf_in)
        out_list.append(cf_out)
        for i in range(1, self.group_num):
            cf_in = input_list[i] + cf_out
            cf_out = self.cformer_list[i](cf_in)
            out_list.append(cf_out)
        out = torch.cat(out_list, dim=1)
        out = self.last_conv(out)
        out = x + out
        return out

# Setup code
INIT_ARGS = {
    'dim': 8,
    'group_num': 2
}

ARGS = {
    'x': torch.randn(2, 8, 3, 5, 7)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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 5, 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)
TimesAttention3D Ran
ran on a synthesized input
pwangcs/DeepOpticsSCI/model/digital_layer.py
code served (permissive licence) · get_code("1821c8b8b6d00028")
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

# INIT_ARGS for TimesAttention3D.__init__
INIT_ARGS = {
    'dim': 12,
    'num_heads': 3,
    'qkv_bias': False,
    'qk_scale': None
}

# ARGS for TimesAttention3D.forward
ARGS = {
    'x': torch.randn(2, 5, 12)  # (batch_size=2, sequence_length=5, dim=12)
}
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)
Res2former Not yet run
unverified (harvested, no recorded run)
pwangcs/DeepOpticsSCI/model/digital_layer.py
code served (permissive licence) · get_code("b57a2d73f0a49ab1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 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 5 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

Video snapshot compressive imaging (SCI) aims to capture a sequence of video frames with only a single shot of a 2D detector, whose backbones rest in optical modulation patterns (also known as masks) and a computational reconstruction algorithm. Advanced deep learning algorithms and mature hardware are putting video SCI into practical applications. Yet, there are two clouds in the sunshine of SCI: i) low dynamic range as a victim of high temporal multiplexing, and ii) existing deep learning algorithms' degradation on real system. To address these challenges, this paper presents a deep optics framework to jointly optimize masks and a reconstruction network. Specifically, we first propose a new type of structural mask to realize motionaware and full-dynamic-range measurement. Considering the motion awareness property in measurement domain, we develop an efficient network for video SCI reconstruction using Transformer to capture long-term temporal dependencies, dubbed Res2former. Moreover, sensor response is introduced into the forward model of video SCI to guarantee end-to-end model training close to real system. Finally, we implement the learned structural masks on a digital micro-mirror device. Experimental results on synthetic and real data validate the effectiveness of the proposed framework. We believe this is a milestone for real-world video SCI. The source code and data are available at https: //github.com/pwangcs/DeepOpticsSCI.

For agents

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

get_harvested_code_for_paper("2404.05274")
get_code_for_paper("2404.05274")
have("2404.05274")

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

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

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

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

Connect an agent — have() is free.