From the workbench

Truthlens

TruthLens classifies an uploaded image as βœ… Real or πŸ€– AI-Generated using a retrained CLIP detector, SwinV2-Tiny checkpoint suite, ResNet18 baseline, and 6 classical ML algorithms. The Streamlit web app provides confidence scores, Grad-CAM…

View source on GitHub
  • Python

From the repository

Read on GitHub

πŸ” TruthLens

AI-Generated Image Detection using Machine Learning & Deep Learning

Python PyTorch Streamlit scikit-learn License: MIT

TruthLens classifies an uploaded image as βœ… Real or πŸ€– AI-Generated using a retrained CLIP detector, SwinV2-Tiny checkpoint suite, ResNet18 baseline, and 6 classical ML algorithms. The Streamlit web app provides confidence scores, Grad-CAM heatmaps, and AI explanations.


πŸ“‹ Table of Contents


✨ Features

FeatureDescription
🧠 Retrained CLIP detectorFrozen CLIP ViT-L/14 + four calibrated linear view heads; 98.0% accuracy / 0.997 AUC on the modern same-source test and 90.8% balanced accuracy / 0.965 AUC on the quarantined holdout
πŸ§ͺ ResNet18 baselineRetained for comparison and Grad-CAM, but no longer the app default because it overfits source-specific rendition cues
πŸ”­ SwinV2-Tiny checkpoint suite22 local checkpoint files audited; 18 distinct weight states. The preferred improved-run checkpoint is Epoch 6β€”see the documented held-out results below.
πŸ“ 6 Classical ML ModelsLR, DT, RF, SVM, k-NN, Naive Bayes β€” for comparison only (51–57%, near the 50% chance line)
πŸ”₯ Grad-CAM HeatmapsVisual explainability β€” shows where the network looked
πŸ“Š Confidence ScoresReal-time probability breakdown (REAL % vs FAKE %)
🎨 Generator DetectionUnvalidated heuristic guess at Stable Diffusion / Midjourney / FLUX / DALL-E β€” the corpus carries no per-generator labels, so this is not measured
🧾 Metadata & ProvenanceReads EXIF/XMP/PNG text, camera/editor/generator fields, C2PA/JUMBF markers, ICC/alpha/container structure, appended payloads, and exact/perceptual hashes
πŸ’§ Watermark ChecksDetects explicit watermark identifiers, possible visible border text/logos, hidden RGB under alpha, and weak LSB/steganography indicators
πŸ’‘ AI ExplanationRule-based bullet-point explanation of the prediction
🌐 Streamlit Web AppDark UI, batch upload, held-out samples with true labels, resolution-calibrated accuracy
πŸ“ˆ Model ComparisonLeaderboard with accuracy, F1, AUC across all models, read live from the benchmark file

πŸ—οΈ Architecture

TruthLens/
β”‚
β”œβ”€β”€ dataset/
β”‚   └── download_cifake.py       ← Automated dataset downloader
β”‚
β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ raw/                     ← Original downloads and generator sources
β”‚   β”œβ”€β”€ prepared/                ← Training corpora, including CIFAKE
β”‚   β”œβ”€β”€ evaluation/              ← Independent evaluation sets
β”‚   └── fixtures/                ← Small test corpora
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ utils.py                 ← Config, logging, plotting helpers
β”‚   β”œβ”€β”€ preprocessing.py         ← Transforms, Dataset class, HOG+LBP
β”‚   β”œβ”€β”€ train.py                 ← ResNet18 CNN training loop
β”‚   β”œβ”€β”€ features_clip.py         ← Frozen CLIP multi-view feature extraction
β”‚   β”œβ”€β”€ train_head.py            ← Calibrated linear-head retraining
β”‚   β”œβ”€β”€ score_clip.py            ← Exact train/serve-consistent CLIP scorer
β”‚   β”œβ”€β”€ train_swin.py            ← SwinV2-Tiny training loop
β”‚   β”œβ”€β”€ eval_swin.py             ← Per-split Swin evaluation + score cache
β”‚   β”œβ”€β”€ train_classical.py       ← 6 classical ML models
β”‚   β”œβ”€β”€ evaluate.py              ← Full model evaluation + reports
β”‚   β”œβ”€β”€ image_forensics.py       ← Metadata, C2PA, watermark, container and LSB checks
β”‚   └── predict.py               ← Inference + Grad-CAM + Explanation
β”‚
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ app.py                   ← Streamlit layout (tabs, inputs, renderers)
β”‚   β”œβ”€β”€ inference.py             ← Model registry, cached predictors, measured metrics
β”‚   └── theme.py                 ← Design tokens + HTML component helpers
β”‚
β”œβ”€β”€ .streamlit/
β”‚   └── config.toml              ← Dark theme for native Streamlit widgets
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ 01_EDA.py
β”‚   β”œβ”€β”€ 02_Classical_ML.py
β”‚   β”œβ”€β”€ 03_CNN_Training.py
β”‚   └── 04_GradCAM_Demo.py
β”‚
β”œβ”€β”€ diag_benchmark.py            ← Benchmarks every model + per-resolution tiers
β”œβ”€β”€ diag_swin_checkpoint_audit.py ← Strict-load and inference audit of all Swin files
β”œβ”€β”€ diag_forensics.py            ← Measures FFT/ELA signal strength alone
β”œβ”€β”€ diag_app_paths.py            ← Smoke-tests all 8 models Γ— 2 images
β”œβ”€β”€ models/                      ← Saved model checkpoints (.pth / .pkl)
β”œβ”€β”€ results/                     ← Plots, metrics, Grad-CAM outputs
└── tests/                       ← pytest unit tests

CNN Architecture

ResNet18 (ImageNet pretrained)
  β”‚
  β”œβ”€β”€ layer1 β†’ layer2 β†’ layer3 β†’ layer4  [FROZEN in Phase 1]
  β”‚                                       [UNFROZEN in Phase 2]
  └── Custom Classifier Head:
        Dropout(0.4)
        Linear(512 β†’ 256)
        ReLU
        Dropout(0.2)
        Linear(256 β†’ 2)   ← [REAL, FAKE]

Grad-CAM Pipeline

Input Image
    ↓
ResNet18 Forward Pass
    ↓  (hooks capture feature maps at layer4)
Backward pass (class score gradient)
    ↓
GAP of gradients β†’ channel weights
    ↓
Weighted sum of feature maps β†’ ReLU
    ↓
Upsample to original size
    ↓
JET colormap overlay
    ↓
Heatmap Image

πŸš€ Quick Start

1. Clone & Install

git clone https://github.com/Mevinb/proj-v1.git
cd truthlens

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate          # Linux/Mac
# .venv\Scripts\activate           # Windows

# Install dependencies
pip install -r requirements.txt

2. Download Dataset

# Option A: Kaggle API (fastest)
pip install kaggle
# Place kaggle.json at ~/.kaggle/kaggle.json  (chmod 600)
python dataset/download_cifake.py --method kaggle

# Option B: Manual download
python dataset/download_cifake.py --method manual
# Follow the printed instructions

# Verify dataset
python dataset/download_cifake.py --method info

For a broader corpus spanning real photographs, GANs, latent diffusion, pixel diffusion, and newer generators, use the single resumable corpus builder:

python dataset/download_corpus.py \
  --per-architecture 10000 \
  --highres-per-class 10000 \
  --output-dir datasets/prepared/corpus

The modern So-Fake-OOD source is very slow over HTTP range reads. Collect it in small resumable targets rather than committing to the full 3,000-image target in one command:

python dataset/collect_modern_generators.py --sources sofake --target 250
# Later:
python dataset/collect_modern_generators.py --sources sofake --target 500

The builder streams high-resolution public Hugging Face sources, rejects source images smaller than 512px on either edge, and resizes only after that quality gate. CIFAKE is excluded by default because its 32x32 images are only useful as a legacy low-resolution stress set; add --cifake-per-class N if that stress test is specifically required. The builder then deduplicates by pixel hash, excludes NSFW-flagged rows when the source exposes that field, and resumes from manifest.csv. It writes sources.json with source URLs and licenses. Review each upstream dataset card before redistribution: licenses and generator labels are source-specific. The output can be used with --data-dir datasets/prepared/corpus.

3. Train Models

# Train CNN (ResNet18) β€” ~15 min GPU / ~2 hrs CPU
# --data-dir defaults to datasets/prepared/cifake (32px CIFAKE); pass the multi-resolution
# corpus to reproduce the shipped checkpoint.
python src/train.py --data-dir datasets/prepared/multires

# Train all 6 classical models
python src/train_classical.py

# Quick test run with 2000 samples per class
python src/train_classical.py --max-samples 2000

4. Run Web App

streamlit run app/app.py

Open http://localhost:8501 in your browser.


πŸ“¦ Dataset Setup

The shipped checkpoints were trained on datasets/prepared/multires β€” a balanced three-tier corpus built by dataset/build_multires_dataset.py, so the detector sees every resolution regime rather than only 32px thumbnails:

TierResolutionREAL sourceFAKE source
High-res512–2048pxDSLR / phone photographsDALLΒ·E 3, SDXL, Midjourney
Medium-res256pxmulti-domain photo archivemulti-domain synthetic archive
Low-res32–64pxCIFAR-10Stable Diffusion v1.4 (CIFAKE)
SplitREALFAKETotal
Train10,48010,48020,960
Val1,3101,3102,620
Test1,3101,3102,620
python dataset/build_multires_dataset.py

CIFAKE on its own is still supported as a quick-start / low-resolution stress set β€” 60,000 real (CIFAR-10) + 60,000 fake (Stable Diffusion v1.4) at 32Γ—32:

python dataset/download_cifake.py --method kaggle

Source: Kaggle β€” CIFAKE

A model trained on CIFAKE alone will not transfer to full-resolution images; that resolution gap is why the multi-resolution corpus exists.

☁️ Kaggle Datasets & Uploader

TruthLens datasets can be published directly to Kaggle using scripts/upload_datasets_to_kaggle.sh (built on kagglehub):

# List all registered datasets, file counts, and sizes
./scripts/upload_datasets_to_kaggle.sh --list

# Test an upload without modifying anything
./scripts/upload_datasets_to_kaggle.sh --group core --dry-run

# Upload individual datasets
./scripts/upload_datasets_to_kaggle.sh --dataset evaluation
./scripts/upload_datasets_to_kaggle.sh --dataset modern_v2

# Upload predefined bundles (core, prepared, raw, all)
./scripts/upload_datasets_to_kaggle.sh --group core

Uploaded TruthLens Kaggle Datasets:


πŸŽ“ Training

ResNet18 CNN

python src/train.py \
  --data-dir datasets/prepared/multires \
  --epochs 20 \
  --batch-size 64 \
  --lr-head 1e-3 \
  --lr-tune 1e-4 \
  --freeze-epochs 5 \
  --patience 5
ArgumentDefaultDescription
--data-dirdatasets/prepared/cifakeCorpus root; use datasets/prepared/multires for the multi-resolution set
--epochs20Total training epochs
--batch-size64Batch size
--lr-head1e-3LR for head-only phase
--lr-tune1e-4LR for fine-tuning phase
--freeze-epochs5Epochs to freeze backbone
--patience5Early stopping patience

A val/ split is mandatory β€” training aborts if it is missing rather than silently validating on shuffled, augmented training data (which would make early stopping and best-checkpoint selection meaningless).

The best checkpoint is selected by lowest validation loss. Note that the shipped models/resnet18_truthlens.pth comes from epoch 1 with --freeze-epochs 1: val_loss reached 0.2707 there and was never beaten, even though val_acc later peaked at 91.83% (epoch 6) versus 91.49% at epoch 1. Retraining with --freeze-epochs 5 as above gives the head a proper warm-up before the backbone unfreezes, and is likely to do better.

Monitor with TensorBoard:

tensorboard --logdir runs/

Classical ML

python src/train_classical.py
python src/train_classical.py --max-samples 5000   # quick test

Retrain the default CLIP detector

The default app model keeps CLIP frozen and retrains only linear heads. This is intentional: fine-tuning the old ResNet18 improved same-source scores while destroying the signal on the hardest unseen-source set.

# Run once after the corpus changes (GPU recommended).
python -m src.features_clip --corpus datasets/prepared/modern_v2

# Cheap retraining step; uses the cached features and completes in seconds.
python -m src.train_head \
  --cache features/clip_vitl14 \
  --out models/clip_linear \
  --eval-splits test holdout \
  --tag clip_linear

The app reads models/clip_linear/heads.joblib and uses the same re-encode and view-rendering functions as feature extraction, preventing train/serve skew.

For a controlled source-adaptation experiment, without consuming the entire hard holdout:

python -m src.adapt_head \
  --out models/clip_linear_adapted \
  --n-per-class 80

This reserves 20 paired real and 20 paired GPT-Image-2 examples as an untouched evaluation slice. The adapted candidate improves that slice substantially, but it is not automatically promoted to the app: the current candidate also increases false alarms on independent web photographs. A model must improve both panels before replacing the default.

Fine-tune the legacy ResNet18 for multiple AI generators

No image detector can guarantee catching every current or future AI image. Generators, editing tools, resizing, screenshots, and compression change over time. The reliable approach is to train on a diverse generator dataset and measure recall separately for generators that were not used during training.

Collect representative outputs from Gemini, Imagen, DALL-E, Midjourney, Stable Diffusion, FLUX, and other generators in one fake folder. Put real images from the same subject domains in another folder. Keep a separate holdout set for final testing.

Prepare a training dataset:

python dataset/prepare_custom_dataset.py \
  --fake-dir /path/to/all_ai_images \
  --real-dir /path/to/real_images \
  --output-dir datasets/prepared/gemini

GPT-Image and Nano-Banana images

The generator images added under datasets/raw/generator_sources/ can be prepared with the same train/val/test/{real,fake} layout without copying the GPT-Image files. Nano-Banana parquet rows are extracted into datasets/raw/generator_sources/_cache/nano-banana on first use, and the prepared dataset uses symlinks plus a provenance manifest:

.venv/bin/python dataset/prepare_generator_dataset.py \
  --fake-root datasets/raw/generator_sources \
  --real-root datasets/prepared/modern_v2 \
  --output-dir datasets/prepared/gpt_nano

This creates datasets/prepared/gpt_nano/{train,val,test}/{real,fake} and datasets/prepared/gpt_nano/manifest.csv. Train and evaluate the existing model on the new corpus with:

.venv/bin/python src/train.py --data-dir datasets/prepared/gpt_nano
.venv/bin/python src/evaluate.py --model all --data-dir datasets/prepared/gpt_nano

The default split seed is 42; pass --seed to reproduce a different split.

The fake folder may contain generator subfolders, for example all_ai_images/gemini, all_ai_images/dalle, and all_ai_images/flux. Fine-tune from the existing multi-resolution checkpoint. Use more total epochs than frozen epochs so the backbone is actually updated:

python src/train.py \
  --data-dir datasets/prepared/gemini \
  --model-name resnet18_gemini.pth \
  --initial-checkpoint models/resnet18_truthlens.pth \
  --epochs 15 \
  --freeze-epochs 3 \
  --batch-size 32

Evaluate on the held-out custom test split before using the checkpoint in the app. Do not train on the same Gemini images used to judge performance. To serve a new checkpoint, point Config.cnn_model_name at it β€” the app's model selector lists a single CNN entry and loads whichever checkpoint is configured, rather than offering per-variant options that all resolve to the same file.

To inspect per-generator fake recall:

python src/evaluate_generators.py \
  --fake-root /path/to/heldout_ai_images \
  --model-name resnet18_gemini.pth

πŸ“Š Evaluation

# Evaluate all models
python src/evaluate.py --model all

# Evaluate specific model
python src/evaluate.py --model resnet18
python src/evaluate.py --model svm
python src/evaluate.py --model rf

🌐 Web Application

streamlit run app/app.py

Three tabs β€” Detect, Benchmarks, About β€” split across three files so the layout code stays separate from the model code:

FileRole
app/app.pyLayout only. Tabs, inputs, and the render functions.
app/inference.pyModel layer. Registry, cached predictors, and every measured number the UI shows.
app/theme.pyDesign tokens and HTML component helpers (verdict card, split bar, notes, stats).
.streamlit/config.tomlDark theme, so native widgets theme themselves instead of being overridden with !important.

What it does:

  • Upload one or many JPG/PNG/WebP/BMP images, or click a held-out sample from datasets/prepared/multires/test/ β€” samples carry their true label, so the app can be checked rather than believed
  • Verdict card with the probability split, and the accuracy for that image's resolution tier rather than the flattering aggregate
  • Inconclusive routing when the calibrated score is not extreme or the four CLIP views disagree. The underlying lean remains visible, but the app no longer presents every upload as a trustworthy forced binary answer.
  • Grad-CAM overlay from layer3+layer4, backpropagated from the predicted class (CNN only β€” the toggle is disabled for classical models)
  • 2D FFT and ELA panels, each shown against measured per-class reference ranges. Both are labelled descriptive and neither moves the verdict: alone they reach AUC 0.562 and 0.514 against a 0.500 chance line.
  • Provenance & watermark panel that inspects the original encoded file for EXIF/XMP and PNG text, explicit AI-generator/editor tags, camera fields, C2PA/JUMBF container markers, ICC/alpha structure, trailing payloads, possible visible border text/logos, watermark identifiers (including SynthID strings), hidden colour under transparent pixels, and weak LSB/steganography statistics. SHA-256 and perceptual dHash fingerprints are included for matching against a separate known-image database. These findings are reported separately and never silently change the model verdict. Proprietary invisible watermarks still require the provider's official detector or verification key for confirmation.
  • Batch summary table with CSV export, and per-result JSON download
  • Checkpoint provenance in the sidebar (file, epoch, val accuracy, device), so a stale checkpoint is visible instead of implied

ResNet/classical figures in the UI are read from results/metrics/benchmark_test_split.json; CLIP figures are read from results/metrics/clip_linear.json. Re-running the corresponding evaluation or head-training command updates the displayed measurements.


πŸ“ˆ Model Performance

The default CLIP model was retrained on August 17, 2026, from 12,951 cached training rows and 1,660 validation rows. The two most relevant measured panels are deliberately kept separate:

PanelImagesAccuracy / balanced accuracyAUCREAL accFAKE acc
Modern same-source test1,69497.99% accuracy0.996698.39%97.50%
Quarantined source/generator holdout60090.8% balanced @ 0.50.9648β€”β€”

The same-source number is a regression check, not a promise for arbitrary web uploads. See RETRAIN_PLAN.md and src/eval_protocol.py for the independent source, unseen-generator, and wild-web tiers.

Measured on the held-out datasets/prepared/multires/test split by diag_benchmark.py. The CNN is scored on all 2,620 test images; the classical models on a 600-image stratified subsample (HOG+LBP extraction is the bottleneck). Reproduce with:

python diag_benchmark.py          # writes results/metrics/benchmark_test_split.json

# src/evaluate.py defaults to --data-dir datasets/prepared/cifake (the 32px CIFAKE split), so
# point it at the corpus the shipped checkpoint was actually trained on:
python src/evaluate.py --model all --data-dir datasets/prepared/multires
ModelAccuracyF1AUCREAL accFAKE accNotes
CLIP ViT-L/14 + linear heads97.99%0.9780.99798.4%97.5%App default; modern test
ResNet18 (CNN + TTA)92.79%0.9280.98392.4%93.1%Legacy baseline + Grad-CAM
ResNet18 (single crop)92.52%0.9260.98291.8%93.3%Bare checkpoint
Logistic Regression56.67%0.4670.58575.3%38.0%Best classical
Random Forest55.50%0.3690.56885.0%26.0%
SVM (RBF)55.33%0.4020.56980.7%30.0%
k-NN54.50%0.3120.54988.3%20.7%
Decision Tree54.00%0.5090.55760.3%47.7%
Naive Bayes51.33%0.3050.51881.3%21.3%

Chance is 50%. HOG+LBP texture statistics do not separate modern generators from real photographs on this corpus β€” every classical model defaults heavily toward REAL and catches only 21–48% of fakes. They are kept for comparison, not for use. Only the selected learned model produces a verdict; the FFT and ELA panels in the app are descriptive and never alter it (measured alone they reach AUC 0.562 and 0.514, and blending them into the CNN score lowers AUC monotonically β€” see diag_forensics.py).

Earlier revisions of this table quoted CIFAKE-era figures (ResNet18 ~95%, Random Forest ~78%, SVM ~76%). Those never held on datasets/prepared/multires.

SwinV2 checkpoint evaluation

All 22 local Swin checkpoint files were strictly loaded and exercised with a 512Γ—512 inference pass on September 2, 2026; 18 represent unique weight states. The focused Swin regression suite also passes 72/72 tests. The improved run’s Epoch 6 has the strongest quarantined-holdout result in its like-for-like benchmark (0.9415 AUC, 89.40% balanced accuracy, and 85.07% fake recall at 5% FPR). The random-initialized new-data run is not usable: all saved epochs are at 50% balanced accuracy.

See the complete SwinV2 checkpoint evaluation for every file, aliases, exact test protocols, and the important caveat that the historical baseline and improved leaderboards are not directly comparable.

Reproduce the compatibility audit with:

.venv/bin/python diag_swin_checkpoint_audit.py

Accuracy by resolution tier

The 92.79% headline blends three tiers of very different difficulty, and the blend flatters the one that matters most. datasets/prepared/multires is built in tiers, so the CNN can be scored inside each:

Resolution tierAccuracyF1AUCREAL accFAKE accImages
High-res (512px+)88.50%0.8760.96190.7%86.0%774
Medium (256px)94.51%0.9400.98994.8%94.1%1,111
Low-res (32px)93.96%0.9380.98990.0%98.5%563

A real upload β€” a photograph off a phone, an SDXL or Midjourney render β€” is almost always in the high-resolution tier, which scores 4.3 points below the headline and misses 14% of AI images. The app detects the uploaded image's tier from its pixel dimensions and quotes that tier's accuracy on the result page instead of the aggregate. Reproduced by score_by_tier() in diag_benchmark.py; the numbers land in the by_resolution block of results/metrics/benchmark_test_split.json, which is what the UI reads.


πŸ”¬ Notebooks

NotebookDescription
notebooks/01_EDA.pyDataset statistics, class balance, pixel histograms, FFT analysis
notebooks/02_Classical_ML.pyFeature extraction walkthrough, classical model training
notebooks/03_CNN_Training.pyResNet18 training, loss/accuracy curves
notebooks/04_GradCAM_Demo.pyGrad-CAM visualisation on real and fake images

Run notebooks:

python notebooks/01_EDA.py
python notebooks/02_Classical_ML.py
python notebooks/03_CNN_Training.py
python notebooks/04_GradCAM_Demo.py --image path/to/image.jpg

πŸ§ͺ Tests

# Run all tests
pytest tests/ -v

# With coverage report
pytest tests/ --cov=src --cov-report=html

Tests cover:

  • Image transforms (train/val/test)
  • HOG + LBP feature extraction
  • Single-image preprocessor
  • Grad-CAM overlay generation
  • Generator detection
  • Explanation generation
  • Config serialisation

πŸ”Œ API Reference

Single Image Prediction

from src.predict import predict_image
from src.utils import Config
from PIL import Image

cfg = Config()
img = Image.open("image.jpg")

result, heatmap = predict_image(
    image_source = img,
    cfg          = cfg,
    model_type   = "resnet18",   # or "ensemble", "svm", "random_forest", ...
    with_gradcam = True,
)

print(result["prediction"])        # "REAL" or "FAKE"
print(result["confidence"])        # e.g. 97.3
print(result["probabilities"])     # {"REAL": 2.7, "FAKE": 97.3}
print(result["likely_generator"])  # heuristic guess, or "N/A" when REAL
print(result["explanation"])       # list of explanation strings
print(result["spectral_analysis"]) # 2D FFT metrics β€” display only
print(result["ela_metrics"])       # Error Level Analysis metrics β€” display only
print(result["provenance_analysis"]) # Metadata, credentials, watermarks, container

predict_image is the single inference path: app/app.py, the python src/predict.py --image ... CLI, and the tests all go through it, so the result schema cannot drift between them. Predictors are cached per (model_type, checkpoint); call src.predict.clear_predictor_cache() after retraining or swapping a checkpoint in a long-lived process.

spectral_analysis and ela_metrics are attached for display and never affect the verdict β€” the CNN (or the selected classical model) decides alone. model_type="ensemble" adds an ensemble_votes dict showing what the classical, FFT and ELA signals would have said, labelled advisory; the verdict still comes from the CNN.

provenance_analysis is also advisory. Explicit generator metadata is strong evidence about the file's history, but metadata can be forged or stripped. C2PA/JUMBF detection currently reports the presence of a container marker; it does not perform certificate-chain or signature validation. Visible-watermark and LSB/invisible-watermark scores are heuristics, not proof.

Heatmaps are returned for "resnet18" and "ensemble" only; classical models return None.

Feature Extraction

from src.preprocessing import extract_features
import numpy as np

img    = np.random.randint(0, 255, (64, 64, 3), dtype=np.uint8)
features = extract_features(img)   # HOG + LBP β†’ numpy array

πŸ› οΈ Tech Stack

CategoryLibrary
Deep LearningPyTorch 2.13, TorchVision
Classical MLscikit-learn 1.9
Image ProcessingOpenCV 5.0, Pillow 12
Feature Extractionscikit-image 0.26 (HOG, LBP)
Web AppStreamlit 1.61
VisualisationMatplotlib, Seaborn, Plotly
DataNumPy 2.5, Pandas
LoggingTensorBoard
Testingpytest, pytest-cov

πŸ“ License

This README identifies the project as MIT-licensed, but no LICENSE file is tracked in this revision. Confirm and add the intended license terms before redistribution.


Developer guide Β· Source reference