SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1803.05787 · 2018

Feature Distillation: DNN-Oriented JPEG Compression Against Adversarial Examples

arXiv · PDF · Open in the Atlas

Code that ran

12 of 17 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; 3 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 0 failures of our instrument; 5 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/1803.05787.json · badge: /api/ran/1803.05787.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
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples community (classifier label)
classifier basis not recorded on the link
9 ran · 5 no recorded run
zihaoliu123/DeepN-Jpeg reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
carlini_cifar10_model Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/models/carlini_models.py
code served (permissive licence) · get_code("ef12250921907cf2")
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 Sequential. 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

ARGS = {
    'logits': True,
    'input_range_type': 2,
    'pre_filter': lambda x: x
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
carlini_mnist_model Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/models/carlini_models.py
code served (permissive licence) · get_code("f789e91ec8254a1c")
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 Sequential. 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

ARGS = {
    'logits': True,
    'input_range_type': 2,
    'pre_filter': lambda x: x
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
dct2 Ran
ran, honoured the contract we drafted
zihaoliu123/DeepN-Jpeg/DeepN.py
pointer only (licence: NONE) · get_code("f3d0ff33a5acd9db")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zihaoliu123/DeepN-Jpeg 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.

get_first_n_examples_id_each_class Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/datasets/datasets_utils.py
code served (permissive licence) · get_code("4686f69d35b1edf8")
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 1, dtype family int, shape (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 numpy as np

# Construct Y_test: one-hot encoded labels for 3 classes with 5 samples
# Shape should be (num_samples, num_classes)
Y_test = np.array([
    [1, 0, 0],  # class 0
    [1, 0, 0],  # class 0
    [0, 1, 0],  # class 1
    [0, 1, 0],  # class 1
    [0, 0, 1],  # class 2
])

ARGS = {
    "Y_test": Y_test,
    "n": 1,
}
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 1, dtype family int, shape (3,) — shape (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_least_likely_class Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/datasets/datasets_utils.py
code served (permissive licence) · get_code("cd5e76389e4061b6")
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, 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 numpy as np

# Create a small prediction array
# Shape: (batch_size=2, num_classes=4)
# This represents predictions for 2 samples across 4 classes
Y_pred = np.array([
    [0.1, 0.3, 0.2, 0.4],  # Sample 1
    [0.5, 0.1, 0.2, 0.1]   # Sample 2
], dtype=np.float32)

ARGS = {
    "Y_pred": Y_pred
}
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 (2, 4) — shape (2, 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
get_next_class Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/datasets/datasets_utils.py
code served (permissive licence) · get_code("f32016fdaf8ee137")
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, 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 numpy as np

# Create a small test case for Y_test
# The function expects Y_test to be a 2D array where:
# - Shape is (batch_size, num_classes)
# - Each row is a one-hot encoded label (or at least has argmax semantics)

batch_size = 2
num_classes = 4

# Create a one-hot encoded array: 2 samples, 4 classes
Y_test = np.eye(num_classes)[:batch_size]  # Takes first 2 rows of identity matrix
# This gives us:
# [[1, 0, 0, 0],
#  [0, 1, 0, 0]]

ARGS = {
    "Y_test": Y_test
}
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 (2, 4) — shape (2, 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
idct2 Ran
ran, honoured the contract we drafted
zihaoliu123/DeepN-Jpeg/DeepN.py
pointer only (licence: NONE) · get_code("7d7d7dbde209f018")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zihaoliu123/DeepN-Jpeg 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.

load_single_image Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/datasets/imagenet.py
code served (permissive licence) · get_code("e5d6aed08c580cd2")
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 4, dtype family float, shape (1, 224, 224, 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 numpy as np
from PIL import Image
import io
import tempfile
import os

# Create a temporary directory for test images
temp_dir = tempfile.mkdtemp()

# Create a simple test image and save it
def create_test_image(path, size=(224, 224)):
    """Create a simple RGB image and save it"""
    img_array = np.random.randint(0, 256, (size[0], size[1], 3), dtype=np.uint8)
    img = Image.fromarray(img_array)
    img.save(path)
    return path

# Create a test image file
test_image_path = os.path.join(temp_dir, "test_image.jpg")
create_test_image(test_image_path)

ARGS = {
    "img_path": test_image_path,
    "img_size": 224
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, keras, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 4, dtype family float, shape (1, 224, 224, 3) — shape (1, 224, 224, 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
override_params Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/attacks/cleverhans_wrapper.py
code served (permissive licence) · get_code("89dc5724554cf57b")
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 dict. 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
import warnings

ARGS = {
    'default': {
        'ord': 'l2',
        'learning_rate': 0.01,
        'epochs': 100,
    },
    'update': {
        'ord': 'li',
        'learning_rate': 0.001,
        'extra_param': 'ignored_value',
    }
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
override_params Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/attacks/deepfool_wrapper.py
code served (permissive licence) · get_code("05c5269091bda68b")
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 dict. 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 warnings

torch_seed_set = False
try:
    import torch
    torch.manual_seed(0)
    torch_seed_set = True
except ImportError:
    pass

# The function override_params takes two parameters: default and update
# Both should be dictionaries based on how the function uses them:
# - It iterates over keys in default
# - It checks if keys exist in update
# - It accesses and deletes from update
# - It calls len() on update and update.keys()

default_dict = {
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'model_type': 'transformer'
}

update_dict = {
    'learning_rate': 0.0005,
    'epochs': 20,
    'unused_param': 'some_value'
}

ARGS = {
    'default': default_dict,
    'update': update_dict
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
pgdtrained_mnist_model Ran
ran on a synthesized input
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/models/pgdtrained_models.py
code served (permissive licence) · get_code("9890ea8ff5e16c13")
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 Sequential. 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
import numpy as np

ARGS = {
    'logits': True,
    'input_range_type': 1,
    'pre_filter': lambda x: x
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
rfft2 Ran
ran, honoured the contract we drafted
zihaoliu123/DeepN-Jpeg/DeepN.py
pointer only (licence: NONE) · get_code("b7b553d7b6097fa1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, zihaoliu123/DeepN-Jpeg 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.

carlini_model Not yet run
unverified (harvested, no recorded run)
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/models/carlini_models.py
code served (permissive licence) · get_code("79976c3eaf7aaa7c")
How it ran

no invocation recorded.

convert_model Not yet run
unverified (harvested, no recorded run)
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/attacks/carlini_wrapper.py
code served (permissive licence) · get_code("dce02585e3349215")
How it ran

no invocation recorded.

data_imagenet Not yet run
unverified (harvested, no recorded run)
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/datasets/imagenet.py
code served (permissive licence) · get_code("590145ff5c062ed7")
How it ran

no invocation recorded.

prepare_attack Not yet run
unverified (harvested, no recorded run)
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/attacks/deepfool_wrapper.py
code served (permissive licence) · get_code("a88ae6b0472e0db9")
How it ran

no invocation recorded.

wrap_to_carlini_model Not yet run
unverified (harvested, no recorded run)
zihaoliu123/Feature-Distillation-DNN-Oriented-JPEG-Compression-Against-Adversarial-Examples/attacks/carlini_wrapper.py
code served (permissive licence) · get_code("a91f7c1babdfb8d5")
How it ran

no invocation recorded.

Also present in other papers' code

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

Image compression-based approaches for defending against the adversarial-example attacks, which threaten the safety use of deep neural networks (DNN), have been investigated recently. However, prior works mainly rely on directly tuning parameters like compression rate, to blindly reduce image features, thereby lacking guarantee on both defense efficiency (i.e. accuracy of polluted images) and classification accuracy of benign images, after applying defense methods. To overcome these limitations, we propose a JPEG-based defensive compression framework, namely "feature distillation", to effectively rectify adversarial examples without impacting classification accuracy on benign data. Our framework significantly escalates the defense efficiency with marginal accuracy reduction using a two-step method: First, we maximize malicious features filtering of adversarial input perturbations by developing defensive quantization in frequency domain of JPEG compression or decompression, guided by a semi-analytical method; Second, we suppress the distortions of benign features to restore classification accuracy through a DNN-oriented quantization refine process. Our experimental results show that proposed "feature distillation" can significantly surpass the latest input-transformation based mitigations such as Quilting and TV Minimization in three aspects, including defense efficiency (improve classification accuracy from $\sim20\%$ to $\sim90\%$ on adversarial examples), accuracy of benign images after defense ($\le1\%$ accuracy degradation), and processing time per image ($\sim259\times$ Speedup). Moreover, our solution can also provide the best defense efficiency ($\sim60\%$ accuracy) against the recent adaptive attack with least accuracy reduction ($\sim1\%$) on benign images when compared with other input-transformation based defense methods.

For agents

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

get_harvested_code_for_paper("1803.05787")
get_code_for_paper("1803.05787")
have("1803.05787")

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

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

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

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

Connect an agent — have() is free.