SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.09576 · 2020

UnMask: Adversarial Detection and Defense Through Robust Feature Alignment

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 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, 1 violated it and 5 have no contract verdict; 5 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/2002.09576.json · badge: /api/ran/2002.09576.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
safreita1/unmask canonical (classifier label)
classifier basis: census
11 ran · 1 no recorded run
FunctionStatusWhere it lives
binary_mask_to_rle Ran
ran; our contract draft was wrong, not the code
safreita1/unmask/pycococreatortools/pycococreatortools.py
pointer only (licence: MIT); the stored copy get_code serves, from yuhuan-wu/RDPNet, is pointer only (licence: NONE) · get_code("d805cf01161ac845")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yuhuan-wu/RDPNet, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

close_contour Ran
ran, violated the contract we drafted
safreita1/unmask/pycococreatortools/pycococreatortools.py
code served (permissive licence) · get_code("24680b34da633bbd")
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 ndarray, ndim 2, dtype family float, shape (5, 2) 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 numpy as np

# Create a valid contour as a numpy array
# A contour should be a 2D array where each row is a point (e.g., x, y coordinates)
# Using shape (4, 2) - 4 points with 2 coordinates each
contour = np.array([
    [0.0, 0.0],
    [1.0, 0.0],
    [1.0, 1.0],
    [0.5, 0.5]
])

ARGS = {
    "contour": contour
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (5, 2) — shape (5, 2) 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
color_map Ran
ran on a synthesized input
safreita1/unmask/parts_extraction/VOClabelcolormap.py
code served (permissive licence) · get_code("1288df8c4540b10d")
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 LinearSegmentedColormap. 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 numpy as np
from matplotlib.colors import LinearSegmentedColormap

ARGS = {
    'N': 256,
    'normalized': True,
    'matplotlib': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LinearSegmentedColormap — a LinearSegmentedColormap output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LinearSegmentedColormap 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
compute_backbone_shapes Ran
ran; our contract draft was wrong, not the code
safreita1/unmask/Mask_RCNN/mrcnn/model.py
pointer only (licence: MIT); the stored copy get_code serves, from yubaoliu/rds-slam, is pointer only (licence: GPL-3.0) · get_code("ae91aee49740c295")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yubaoliu/rds-slam, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

conv_block Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
safreita1/unmask/Mask_RCNN/mrcnn/model.py
code served (permissive licence) · get_code("719785e60bebf517")
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 KerasTensor. 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 keras.layers as KL
import numpy as np

# Create a small input tensor (batch_size=2, height=4, width=3, channels=5)
input_tensor = KL.Input(shape=(4, 3, 5))

ARGS = {
    'input_tensor': input_tensor,
    'kernel_size': 3,
    'filters': [16, 32, 64],
    'stage': 2,
    'block': 'a',
    'strides': (2, 2),
    'use_bias': True,
    'train_bn': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KerasTensor — a KerasTensor 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
get_ax Ran
ran; our contract draft was wrong, not the code
safreita1/unmask/extract_features.py
code served (permissive licence) · get_code("217810b770db68cd")
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 ndarray, ndim 2, dtype family float, shape (2, 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 matplotlib.pyplot as plt

ARGS = {
    "rows": 2,
    "cols": 3,
    "size": 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
get_layer_from_idx Ran
ran on a synthesized input
safreita1/unmask/utils.py
code served (permissive licence) · get_code("36e7b417b97a66fb")
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 Linear. 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)

# Build a nested model structure that the function can traverse
class InnerModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)

class MiddleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.inner = InnerModule()

class OuterModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.middle = MiddleModule()
        self.conv = nn.Conv1d(4, 3, 1)

model = OuterModule()

# idx_ds is a dict where keys are indices and values are lists of module names
# The function pops from these lists recursively to traverse the model
# For a path like model._modules['middle']._modules['inner']._modules['linear']
# we need idx_ds to specify the traversal path

idx_ds = {
    0: ['middle', 'inner', 'linear']
}

idx = 0

ARGS = {
    'model': model,
    'idx_ds': idx_ds,
    'idx': idx
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
get_layers Ran
ran on a synthesized input
safreita1/unmask/utils.py
code served (permissive licence) · get_code("068d3d6699b81f75")
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 torch.nn as nn

torch.manual_seed(0)

# Build a simple network with nested structure
# The function iterates through network.children() and checks for nn.Sequential
# It also checks if list(layer.children()) == [] to identify leaf layers

class SimpleLeafLayer(nn.Module):
    """A leaf layer with no children"""
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class NestedNetwork(nn.Module):
    """A network with nested structure including Sequential blocks"""
    def __init__(self):
        super().__init__()
        # Add some leaf layers
        self.leaf1 = SimpleLeafLayer()
        self.leaf2 = nn.Conv2d(1, 2, 3)
        
        # Add a Sequential block containing leaf layers
        self.seq_block = nn.Sequential(
            nn.Linear(4, 8),
            nn.ReLU(),
            nn.Linear(8, 2)
        )
        
        # Add another leaf layer
        self.leaf3 = nn.BatchNorm1d(4)
    
    def forward(self, x):
        return x

# Create the network instance
network = NestedNetwork()

# Create the all_layers list (default mutable argument)
all_layers = []

# Define ARGS dictionary
ARGS = {
    "network": network,
    "all_layers": all_layers
}
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 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
make_idx_dict Ran
ran on a synthesized input
safreita1/unmask/utils.py
code served (permissive licence) · get_code("e0fb1cfd384c630b")
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, 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 torch.nn as nn
import copy

# Create a simple nested model with both container and leaf modules
torch.manual_seed(0)

class LeafModule(nn.Module):
    """A leaf module with no sub-modules"""
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)

class ContainerModule(nn.Module):
    """A container module with sub-modules"""
    def __init__(self):
        super().__init__()
        self.leaf1 = LeafModule()
        self.leaf2 = LeafModule()

class NestedModel(nn.Module):
    """A nested model with both containers and leaves"""
    def __init__(self):
        super().__init__()
        self.container1 = ContainerModule()
        self.leaf3 = LeafModule()
        self.container2 = ContainerModule()

# Instantiate the model
model = NestedModel()

# Initial values for the recursion
ctr = 0
ary = []
d = {}

ARGS = {
    "model": model,
    "ctr": ctr,
    "ary": ary,
    "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 tuple, ndim 1, dtype family float — a tuple 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
resize_binary_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
safreita1/unmask/pycococreatortools/pycococreatortools.py
code served (permissive licence) · get_code("85747a26d672282d")
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 ndarray, ndim 2, dtype family float, shape (5, 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 numpy as np
from PIL import Image

# Create a small binary mask array (4x3)
array = np.array([
    [1, 0, 1],
    [0, 1, 0],
    [1, 1, 0],
    [0, 0, 1]
], dtype=np.uint8)

# Define new size as a tuple
new_size = (6, 5)

ARGS = {
    "array": array,
    "new_size": new_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (5, 6) — shape (5, 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
train_valid_split Ran
ran on a synthesized input
safreita1/unmask/models/model_builder.py
code served (permissive licence) · get_code("d05450b2f519a8c0")
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 torch.utils.data as data
import numpy as np

class SimpleDataset(data.Dataset):
    def __init__(self, size=10, feature_dim=4):
        self.size = size
        self.feature_dim = feature_dim
        self.data = torch.randn(size, feature_dim)
    
    def __getitem__(self, index):
        return self.data[index]
    
    def __len__(self):
        return self.size

torch.manual_seed(0)
np.random.seed(0)

ds = SimpleDataset(size=10, feature_dim=4)

ARGS = {
    'ds': ds,
    'train_split': 0.9,
    'random_seed': 42
}
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
identity_block Not yet run
unverified (harvested, no recorded run)
safreita1/unmask/Mask_RCNN/mrcnn/model.py
code served (permissive licence) · get_code("28c3981539e97ab6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 7 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 6 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.

FunctionAlso present inEarliest-datedOthers named
compute_backbone_shapes 10 other papers
6 dated earlier, 4 later
1612.03242 (2016-12)
StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks
1702.01983 (2017-02)
Face Aging With Conditional Generative Adversarial Networks
and 7 more not named here
conv_block 8 other papers
4 dated earlier, 4 later
1612.03242 (2016-12)
StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks
1702.01983 (2017-02)
Face Aging With Conditional Generative Adversarial Networks
and 5 more not named here
identity_block 8 other papers
4 dated earlier, 4 later
1612.03242 (2016-12)
StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks
1702.01983 (2017-02)
Face Aging With Conditional Generative Adversarial Networks
and 5 more not named here
binary_mask_to_rle 2 other papers
2 later
2008.12416 (2020-08)
Regularized Densely-connected Pyramid Network for Salient Instance Segmentation
2402.07633 (2024-02)
Complete Instances Mining for Weakly Supervised Instance Segmentation
close_contour 2 other papers
2 later
2402.03290 (2024-02)
InstanceDiffusion: Instance-level Control for Image Generation
2402.07633 (2024-02)
Complete Instances Mining for Weakly Supervised Instance Segmentation
resize_binary_mask 2 other papers
2 later
2402.03311 (2024-02)
HASSOD: Hierarchical Adaptive Self-Supervised Object Detection
2402.07633 (2024-02)
Complete Instances Mining for Weakly Supervised Instance Segmentation
get_ax 1 other paper
1 dated earlier
1703.06870 (2017-03)
Mask R-CNN

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

Deep learning models are being integrated into a wide range of high-impact, security-critical systems, from self-driving cars to medical diagnosis. However, recent research has demonstrated that many of these deep learning architectures are vulnerable to adversarial attacks--highlighting the vital need for defensive techniques to detect and mitigate these attacks before they occur. To combat these adversarial attacks, we developed UnMask, an adversarial detection and defense framework based on robust feature alignment. The core idea behind UnMask is to protect these models by verifying that an image's predicted class ("bird") contains the expected robust features (e.g., beak, wings, eyes). For example, if an image is classified as "bird", but the extracted features are wheel, saddle and frame, the model may be under attack. UnMask detects such attacks and defends the model by rectifying the misclassification, re-classifying the image based on its robust features. Our extensive evaluation shows that UnMask (1) detects up to 96.75% of attacks, and (2) defends the model by correctly classifying up to 93% of adversarial images produced by the current strongest attack, Projected Gradient Descent, in the gray-box setting. UnMask provides significantly better protection than adversarial training across 8 attack vectors, averaging 31.18% higher accuracy. We open source the code repository and data with this paper: https://github.com/safreita1/unmask.

For agents

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

get_harvested_code_for_paper("2002.09576")
get_code_for_paper("2002.09576")
have("2002.09576")

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

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

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

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

Connect an agent — have() is free.