Skip to content

dearabhin/reverse-synthid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🕵️‍♂️ Reverse SynthID: AI Watermark Forensics Lab

A deep learning and computer vision research tool designed to extract, visualize, and analyze hidden imperceptible watermarks (specifically targeting Google's SynthID) embedded in AI-generated images.

This project provides both a Python/Flask backend utilizing scientific computing libraries (SciPy, PyWavelets) and a Client-Side (OpenCV.js) implementation for rapid browser-based analysis.

🔬 The Science Behind the Tool

SynthID and similar invisible watermarking technologies embed data within the high-frequency components of an image. This tool reverse-engineers the visual traces of these watermarks using a three-step forensic pipeline:

  1. Noise Extraction (High-Pass Filtering): - Python: Utilizes Discrete Wavelet Transform (db4 wavelets via PyWavelets) to separate the low-frequency structural image data from the high-frequency residual noise.
    • JavaScript: Uses a Difference of Gaussians (DoG) approximation to isolate the noise layer.
  2. Residual Amplification: The extracted noise is heavily amplified (e.g., 50x) to make the imperceptible pixel variations visible to the human eye, often revealing grid-like or wave patterns.
  3. Frequency Domain Analysis (FFT): A Fast Fourier Transform (FFT) converts the spatial noise map into a frequency spectrum. By shifting the DC component to the center and applying a logarithmic scale, the tool reveals "star patterns" or bright dots.
  4. Pattern Matching: The tool overlays known "secret" carrier frequencies (derived from research) onto the FFT spectrum. If the bright spots in the frequency domain align exactly with these targeted coordinates, it indicates a high probability of SynthID presence.

📁 Project Structure

The repository contains two distinct implementations:

1. Python Flask Application (/app.py, /analysis_engine.py)

A robust server-side application for deep analysis.

  • app.py: The Flask web server handling uploads and routing.
  • analysis_engine.py: The core scientific pipeline performing wavelet denoising and FFT generation.
  • requirements.txt: Python dependencies.
  • templates/ & static/: Frontend UI and storage for generated analysis maps.

2. Client-Side JS Visualizer (/SynthID-Visualizer/)

A lightweight, browser-only tool leveraging OpenCV.js.

  • index.html: The UI for the client-side tool.
  • js/visualizer.js: Handles image processing, FFT, and canvas rendering entirely in the browser.
  • assets/carriers.json: The coordinate map of known SynthID carrier frequencies.

🚀 Installation and Usage

Running the Python/Flask App

  1. Clone the repository and navigate to the project directory.
  2. Install the required dependencies:
   pip install -r requirements.txt

(Requires: Flask, numpy, opencv-python, scipy, PyWavelets, matplotlib)

  1. Start the Flask server:
    python app.py
  2. Open your browser and navigate to http://127.0.0.1:5000/. Upload an image to see the noise residual and frequency fingerprint.

Running the Client-Side Visualizer

  1. Navigate to the SynthID-Visualizer directory.
  2. Serve the directory using any local web server to avoid CORS issues with the local JSON file. For example:
    python -m http.server 8000
  3. Open http://localhost:8000/index.html in your browser.

📊 Interpreting the Results

When an image is analyzed, you will see two primary outputs:

  • Extracted Noise: A static-like image. Look for repeating diagonal or grid-like textures hidden within the noise.
  • Frequency Fingerprint: A heatmap of the frequency domain.
    • Look for the Green Circles (the known carrier frequencies).
    • If bright white/yellow dots appear perfectly centered inside these green circles, the image exhibits the signature of a Gemini/SynthID watermark.

⚠️ Disclaimer

This is an educational research tool designed to demonstrate computer vision and signal processing techniques. It relies on approximated client-side and open-source methods to visualize frequency patterns and is not an official Google SynthID decoding tool.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors