Skip to main content

Implementation of modern image steganalysis algorithms

Project description

PyPI version Commit CI/CD Release CI/CD Documentation Status PyPI downloads Stars Contributors Wheel Status

Last commit

sealwatch

Python package, containing implementations of modern image steganalysis algorithms.

:warning: This project is under intensive development as we speak.

Installation

Simply install the package with pip3

pip3 install sealwatch

or using the cloned repository

git clone https://github.com/uibk-uncover/sealwatch/
cd sealwatch
pip3 install .

Import to Python by typing

import sealwatch as sw

Contents

Abbreviation Dimensionality Domain Reference Output format
SPAM: subtractive pixel adjacency matrix 686 spatial Reference ordered dict
JRM: JPEG rich model 11255 JPEG Reference ordered dict
CC-JRM: cartesian-calibrated JRM 22510 JPEG Reference ordered dict
DCTR: discrete cosine transform residual features 8000 spatial Reference ordered dict
PHARM: phase-aware projection rich model 12600 JPEG Reference ordered dict
GFR: Gabor filter residual features 17000 JPEG Reference 5D array
SRM: spatial rich models 34671 spatial Reference ordered dict
SRMQ1: SRM with quantization 1 12753 spatial Reference ordered dict
CRM: color rich models 5404 spatial Reference ordered dict

These implementations are based on the Matlab reference implementations provided by the DDE lab at Binghamton University.

Usage

Extract GFR features from a single JPEG image

features = sw.gfr.extract("seal1.jpg")

After having extracted features from cover and stego images, you can train an FLD ensemble as binary classifier.

import numpy as np

Xc_tr, Xs_tr, Xc_te, Xs_te = sw.ensemble_classifier.helpers.load_and_split_features(
    cover_features_filename="cover_features.h5",
    stego_features_filename="stego_features.h5",
    train_csv="train.csv",
    test_csv="test.csv",
)

# Training is faster when arrays are C-contiguous
Xc_tr = np.ascontiguousarray(Xc_tr)
Xs_tr = np.ascontiguousarray(Xs_tr)

# The hyper-parameter search is wrapped inside a trainer class
trainer = sw.ensemble_classifier.FldEnsembleTrainer(
    Xc=Xc_tr,
    Xs=Xs_tr,
    seed=12345,
    verbose=1,
)

# Train with hyper-parameter search
trained_ensemble, training_records = trainer.train()

# Concatenate the test features and labels
X_test = np.concatenate((cover_features_test, stego_features_test), axis=0)
y_test = np.concatenate((
    -np.ones(len(cover_features_test)),
    +np.ones(len(stego_features_test))
), axis=0)

# Calculate test accuracy
test_accuracy = trained_ensemble.score(X_test, y_test)

Feature formats

Note that the feature extractors return different formats: 1D arrays, multi-dimensional arrays, or ordered dicts. The reason is that feature descriptors are composed of multiple submodels. Retaining the structure allows the user to select a specific submodel. The following snippets show how to flatten the features to a 1D array.

Ordered dict

# The PHARM feature extraction returns an ordered dict
features_grouped = sw.pharm.extract_from_file("seal1.jpg", implementation=sw.PHARM_REVISITED)

# Flatten dict to a 1D array
features = sw.tools.flatten(features_grouped)

Multi-dimensional array

# The GFR feature extraction returns a 5-dimensional array:
# - Dimension 0: Phase shifts
# - Dimension 1: Scales
# - Dimension 2: Rotations/Orientations
# - Dimension 3: Number of histograms
# - Dimension 4: Co-occurrences
features = sw.gfr.extract("seal1.jpg")

# Simply flatten to a 1D array
features = features.flatten()

Acknowledgements and Disclaimer

Developed by Martin Benes and Benedikt Lorch, University of Innsbruck, 2024.

The implementations of feature extractors and the detector in this package are based on the original Matlab code provided by the Digital Data Embedding Lab at Binghamton University.

We have made our best effort to ensure that our implementations produce identical results as the original Matlab implementations. However, it is the user's responsibility to verify this. For notes on compatibility with previous implementation, see compatibility.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sealwatch-2025.4.2.tar.gz (40.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sealwatch-2025.4.2-cp38-abi3-win_amd64.whl (248.0 kB view details)

Uploaded CPython 3.8+Windows x86-64

sealwatch-2025.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (384.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

sealwatch-2025.4.2-cp38-abi3-macosx_11_0_arm64.whl (348.2 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file sealwatch-2025.4.2.tar.gz.

File metadata

  • Download URL: sealwatch-2025.4.2.tar.gz
  • Upload date:
  • Size: 40.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for sealwatch-2025.4.2.tar.gz
Algorithm Hash digest
SHA256 9fbd960b9ac03213f89a9e4032d3a48be784026499e06e8703b7362fcb7664af
MD5 9a8a73535f5f1fc3b0772d46b291d3b9
BLAKE2b-256 0dce4a293976e5dfabe62a43485678e3d55abc6d867f54558150b63891094c65

See more details on using hashes here.

File details

Details for the file sealwatch-2025.4.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: sealwatch-2025.4.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 248.0 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for sealwatch-2025.4.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1e3ca753811eea7c39df88551508eb5e362a23b3f3cd945a99ea61a82f6af803
MD5 6f988644d0dbdca845b7272e0d8edc27
BLAKE2b-256 4c1579700b7a98a7d4d4009335cd467e48ec3a2b04aa8f7b29ad0227d79a08a0

See more details on using hashes here.

File details

Details for the file sealwatch-2025.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sealwatch-2025.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a49c5cb6f3350bb672053e68a11dc5cf5527f81cbc9657fc2699254da327f253
MD5 6c254c1b560f4a2e5645772b75de2802
BLAKE2b-256 4b1d753ea85cc36d2cb1b18d8a7a069012606e7950bf7f27adc133a0edffd467

See more details on using hashes here.

File details

Details for the file sealwatch-2025.4.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sealwatch-2025.4.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07b07b4824d77f7ca36cf3b2c023b28bfbef39c67a466427cef33713bd5a55b8
MD5 2e99c20ae9b695434c5da7b18dbe53de
BLAKE2b-256 895c8f5abd19e78111348e2d12dfe1c59fd69f9569379d7127ab56362480f901

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page