Skip to content

Slay3r00/PixelForensics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PixelForensics

AI-Assisted Image Infringement Detection

A robust, multi-layered forensic analysis tool designed to detect image infringement, derivative works, and manipulation. It combines cryptographic hashing, semantic AI analysis, and computer vision techniques to provide a comprehensive similarity score.

Features

The tool employs a 4-Layer Analysis pipeline:

  1. Perceptual Hashing (Layer 1): fast retrieval using pHash, aHash, dHash, and wHash to detect near-duplicates.
  2. Semantic AI (Layer 2): uses CLIP (Contrastive Language-Image Pre-Training) to detect semantic similarity (concepts/content) even if the pixels are completely changed (requires User Flag).
  3. Visual Similarity (Layer 3):
    • Pixel Logic: Structural Similarity Index (SSIM) and pixel-by-pixel comparison.
    • Feature Matching: ORB (Oriented FAST and Rotated BRIEF) + RANSAC to detect geometric matches (crops, rotations, collages).
  4. Metadata Forensics (Layer 4): extracts and compares metadata using exiftool to find shared origin traces.

Installation

Prerequisites

  • Python 3.8+
  • ExifTool (must be installed and in your system PATH)

Setup

# Clone the repository
git clone https://github.com/Slay3r00/PixelForensics.git
cd PixelForensics

# Create a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Usage

Basic Comparison

Compare two images to get a full forensic report:

python main.py -i source.jpg -c suspect.png

Options

  • -i, --image: Path to the original/source image.
  • -c, --compare: Path to the suspect/comparison image.
  • -o, --output-file: Save the report to a text file.
  • --tolerance: Pixel matching tolerance (default: 0.05).
  • --enable-ai: Enable CLIP-based semantic analysis (slower, requires downloading models).
  • --show-diff: Display a visual difference map.
  • --save-diff <path>: Save the difference map image.

Example

python main.py -i assets/original.jpg -c assets/modified.jpg --enable-ai --show-diff

Architecture

  • image_forensics/: Core package.
    • utils/: Core logic and database handling.
      • core.py: orchestrates the analysis pipeline.
      • database.py: SQLite storage for cases, images, and analysis results.
    • layers/: modular logic for Hashing, AI, Visual, and Metadata.
  • main.py: CLI entry point.
  • data/forensics.db: Local database auto-created to store analysis history.

Development

Run tests:

python -m unittest discover tests

License

MIT

About

Forensics-grade image metadata and provenance analysis for identifying infringing content.

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages