Skip to content

suhanganesh/Deepfake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Deepfake Detection & Blockchain Integration

Overview

This project combines AI-powered deepfake detection with blockchain technology to create a secure, verifiable system for identifying manipulated media. The system analyzes images and videos for signs of deepfake manipulation, then stores the results on the Ethereum blockchain for immutable verification.

Key Features

  • 🔍 Ensemble Deepfake Detection: Uses multiple AI models (MesoNet, MesoInception, EfficientNet-ViT, Xception) for improved accuracy
  • ⛓️ Enhanced Blockchain Integration: Stores comprehensive analysis results on Ethereum including file hash, detection result, confidence score, timestamp, and uploader address
  • 🖼️ Multi-format Support: Analyzes both images and videos
  • 📊 Confidence Scoring: Provides confidence levels for all detections
  • 🚀 Web Interface: User-friendly React frontend with detailed blockchain data display
  • 🧠 Training Capabilities: Comprehensive training script for all models

System Architecture

┌─────────────────┐    ┌────────────────────┐    ┌──────────────────┐
│   React Frontend│────│  Flask Backend     │────│  Ethereum Network│
│                 │    │                    │    │                  │
│ • File Upload   │    │ • Deepfake Detection│    │ • Smart Contract │
│ • Results Display│    │ • Blockchain Storage│    │ • Immutable Records│
└─────────────────┘    └────────────────────┘    └──────────────────┘
                                │
                                ▼
                   ┌─────────────────────────┐
                   │  AI Model Ensemble      │
                   │                         │
                   │ • MesoNet               │
                   │ • MesoInception         │
                   │ • EfficientNet-ViT      │
                   │ • Xception              │
                   └─────────────────────────┘

Directory Structure

  • deepfake-chain/ - Backend system with deepfake detection and blockchain integration
    • backend/ - Flask API server, AI models, and blockchain integration
    • blockchain/ - Solidity smart contracts and deployment scripts
  • deepfake-ui/ - React frontend for user interaction

Prerequisites

  • Python 3.8+
  • Node.js 14+
  • Ethereum wallet (MetaMask recommended)
  • Infura account for Ethereum node access
  • Docker (optional, for containerized deployment)

Getting Started

Backend Setup:

  1. Navigate to the backend directory:
    cd deepfake-chain/backend
  2. Install Python dependencies:
    pip install -r requirements.txt
  3. Set up environment variables: Create a .env file with the following variables:
    INFURA_PROJECT_ID=your_infura_project_id
    CONTRACT_ADDRESS=deployed_contract_address
    PRIVATE_KEY=your_wallet_private_key
    
  4. Run the backend server:
    python app.py

Frontend Setup:

  1. Navigate to the frontend directory:
    cd deepfake-ui
  2. Install Node dependencies:
    npm install
  3. Configure blockchain connection: Update src/config.js with your contract address and Infura project ID
  4. Start the development server:
    npm start

Smart Contract Deployment:

  1. Navigate to the blockchain directory:
    cd deepfake-chain/blockchain
  2. Deploy using Remix IDE or Hardhat:
    • Using Remix: Load DeepfakeAuthentication.sol in Remix and deploy to Sepolia testnet
    • Using script: Modify deploy_contract.py with your credentials and run:
      python deploy_contract.py

Training Models (optional):

To train the ensemble models with your own dataset:

cd deepfake-chain/backend
python train_ensemble.py --data_dir /path/to/dataset

Technology Stack

  • Backend: Python, Flask, TensorFlow, PyTorch
  • Frontend: React, Tailwind CSS
  • Blockchain: Ethereum (Sepolia Testnet), Web3.py, Solidity
  • AI Models: MesoNet, EfficientNet, Xception, Vision Transformers

API Endpoints

  • POST /detect - Analyze media for deepfakes
  • GET /results/{file_hash} - Retrieve analysis results
  • POST /store - Store results on blockchain
  • GET /blockchain/{file_hash} - Retrieve blockchain record

Security & Privacy

  • All media analysis is performed locally
  • SHA-256 hashes are used for file identification
  • Blockchain records contain only analysis results, not media content
  • Private keys are never exposed in the codebase

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors