T-MLA: Targeted Multiscale Log-Exponential Attack for Neural Image Compression
Project description
T-MLA: A Targeted Multiscale Log-Exponential Attack Framework for Neural Image Compression
Wavelet-aware adversarial perturbations. (a) PGD-based attack with small-magnitude noise, visually clean yet disruptive after compression. (b) Proposed wavelet-aware attack is also imperceptible but more stealthy. (c) Wavelet coefficients of (a) reveal widespread noise in flat regions. (d) Coefficients of (b) closely resemble the clean input, indicating reduced detectability.
Official implementation of "T-MLA: A targeted multiscale log–exponential attack framework for neural image compression" (Information Sciences, Q1).
📄 Abstract
Neural image compression (NIC) has become the state-of-the-art for rate-distortion performance, yet its security vulnerabilities remain significantly less understood than those of classifiers. Existing adversarial attacks on NICs are often naive adaptations of pixel-space methods, overlooking the unique, structured nature of the compression pipeline. In this work, we propose a more advanced class of vulnerabilities by introducing T-MLA, the first targeted multiscale log–exponential attack framework. We introduce adversarial perturbations in the wavelet domain that concentrate on less perceptually salient coefficients, improving the stealth of the attack. Extensive evaluation across multiple state-of-the-art NIC architectures on standard image compression benchmarks reveals a large drop in reconstruction quality while the perturbations remain visually imperceptible. On standard NIC benchmarks, T-MLA achieves targeted degradation of reconstruction quality while improving perturbation imperceptibility (higher PSNR/VIF of the perturbed inputs) compared to PGD-style baselines at comparable attack success, as summarized in our main results. Our findings reveal a critical security flaw at the core of generative and content delivery pipelines.
Installation
Option 1: From GitHub (recommended)
pip install git+https://github.com/nkalmykovsk/tmla.git
Then clone the repo to get scripts/, init.py, and demo.ipynb, and run setup:
git clone https://github.com/nkalmykovsk/tmla.git
cd tmla
python3 init.py # LIC_TCM + data + weights
Option 2: Clone and install locally
-
Clone the repository
git clone git@github.com:nkalmykovsk/tmla.git cd tmla
-
Environment
- venv:
python3 -m venv venv && source ./venv/bin/activate pip install -r requirements.txt pip install -e .
- Docker:
docker build -t tmla-lic-tcm:latest . docker run -d --gpus all --name tmla-dev \ -v "$(pwd)":/app -w /app tmla-lic-tcm:latest tail -f /dev/null
- venv:
-
Model and data
Fetch the LIC-TCM model and datasets (Kodak, DIV2K, CLIC):python3 init.pyWith Docker:
docker exec -it tmla-dev python3 init.py -
Notebook
Opendemo.ipynbfrom project root (sotmlais importable).
Project structure
Repository = the whole project (this repo, folder tmla/ on disk).
Package = the Python code you import (import tmla); that is the tmla/ directory and its .py files. Having the repo and the package share the same name (tmla) is normal (e.g. numpy, requests).
tmla/— Python package:config,attacks(multiscale attack, decomposition, reconstruction, metrics),tcm(loader for LIC_TCM model),utils.scripts/— CLI entry points:run_attack.py,run_batch_parallel.py,compute_entropy.py,collect_metrics.py,build_chart.py.init.py— setup script (clones LIC_TCM, downloads data and weights).LIC_TCM/— cloned repo and weights (created byinit.py); TCM model code is loaded from here at runtime.
Usage
Attacks
- Single image
python3 scripts/run_attack.py --image path/to/image.png --model model_name
- Batch (dataset × model list)
python3 scripts/run_batch_parallel.py
Image complexity (entropy)
Local entropy reflects spatial complexity and is used in the paper for analysis. The script below computes the normalized local Shannon entropy map Ẽ(x,y) ∈ [0, 1] and the global complexity score μ_E.
python3 scripts/compute_entropy.py path/to/image.png --save entropy_map.png --show
Publishing the package (for maintainers)
The package is ready to publish. Users can already install it from GitHub (see above). To publish on PyPI so that pip install tmla works:
- Create an account on pypi.org (and test.pypi.org for testing).
- Install build tools:
pip install build twine. - From the project root:
python -m build twine upload dist/*
For Test PyPI first:twine upload --repository testpypi dist/*. - After publishing, anyone can run:
pip install tmla. They will still need to clone the repo and runinit.pyto get LIC_TCM and datasets (or use the repo as the main way to get scripts and data).
Citation
If you use this code or the (paper), please cite:
@article{kalmykov2026tmla,
title = {T-MLA: A Targeted Multiscale Log--Exponential Attack Framework for Neural Image Compression},
author = {Kalmykov, N. I. and Dibo, R. and Shen, K. and Zhonghan, X. and Phan, A. H. and Liu, Y. and Oseledets, I.},
journal = {Information Sciences},
volume = {702},
pages = {123143},
year = {2026},
publisher = {Elsevier},
doi = {10.1016/j.ins.2025.123143}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmla-0.1.0.tar.gz.
File metadata
- Download URL: tmla-0.1.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
711a330117065b370b0130709739142a2fbd82e68d3ee5ad60f9414724525f67
|
|
| MD5 |
f41f92f49de920cf5ec1c5472ae1794d
|
|
| BLAKE2b-256 |
7c67afcd83b554ad2593e536cfc41183316d07e1491f1625a158a04765679d89
|
File details
Details for the file tmla-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tmla-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9773d6cf1f01c624e400f627ffa078f5a54883b4ab453b9d278f2990fa070458
|
|
| MD5 |
af36218b4fa7a77460aa302e5f874ba6
|
|
| BLAKE2b-256 |
3d3989c971706665175ccd2a1d765d9cc09b61d9ecb41e1968df2295bac43a6b
|