Skip to content

muffin-123/hamster-deepfake-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐹 Hamster - Deepfake Detection Library

Hamster is a lightweight Python library built around the MesoNet architecture for detecting deepfakes at the frame level. It provides an easy-to-use interface to load a trained model and predict whether an image is real or fake based on subtle mesoscopic features.


🔍 What is Hamster?

Hamster wraps a pre-trained MesoNet model and provides a simple API to:

  • Load the model
  • Predict the authenticity of a face image (Real or Fake)
  • Use in local projects or backend APIs

📦 What's Inside

  • hamster/ - Python package folder
  • predictor.py - Loads the model and makes predictions
  • mesonet_model.h5 - Trained model file (optional, hosted or downloadable)
  • requirements.txt - Required dependencies
  • README.md - Documentation

🚀 Installation & Setup

🔁 Clone the Repository

git clone https://github.com/muffin-123/hamster.git
cd hamster
pip install .

📦 Install Dependencies

pip install -r requirements.txt

🧠 Usage Example

from hamster import model_loader

# Predict an image
result = model_loader.predict_image("sample_image.jpg")
print(result)

Output:

{'label': 'Fake', 'confidence': 0.9421}

📥 Pretrained Model

This library includes the pretrained MesoNet model (mesonet_model.h5) for deepfake detection.

📁 You can also find and download this model separately from its own repository here:
🔗 mesonet-trained-model (GitHub Repo)


🏗️ How It Works

  • The model is a CNN trained using the Meso-4 architecture.

  • Takes a 256×256 image as input

  • Returns a confidence score:

    • Closer to 1 → Fake
    • Closer to 0 → Real

📁 Library Folder Structure

hamster/
├── __init__.py
├── model_loader.py     # loads model + inference
├── predictor.py         # optional CLI or API utilities
├── mesonet_model.h5     # pretrained weights
├── requirements.txt
├── setup.py
└── README.md

About

Hamster is a Python library for deepfake detection using a pretrained MesoNet model.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages