YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Real vs Synthetic Face Classifier

This package contains tools to classify images as Real or Synthetic (AI-Generated). It specifically targets high-quality generations (e.g., from ComfyUI/Flux) that are often difficult to detect.

Models

There are two trained models available. When uploading, you can choose one or both.

  1. trained_classifier_random (Baselne ResNet):

    • Trained on standard dataset.
    • Good for general detection, but might miss high-quality "hard" fakes.
  2. trained_classifier_densenet_hard_mining (Recommended):

    • Trained on an expanded dataset including "Hard Negatives" (high-quality fakes that fooled the baseline).
    • Architecture: DenseNet121.
    • Higher robustness.

How to Share/Upload

Option A: Hugging Face (Simplest for Sharing)

  1. Create a new Model repository on Hugging Face.
  2. Upload the contents of this deployment folder to the repo.
  3. Crucial: You must also upload the model_weights.pth and model_info.json from the trained model folder (e.g., trained_classifier_densenet_hard_mining) into the root of your Hugging Face repo (or a subfolder).

Option B: GitHub

  1. Create a new repo.
  2. Commit this deployment folder.
  3. Warning: The .pth weight files are large (~30-50MB). GitHub standard file limit is 100MB, so they should fit. If they are larger, you need Git LFS.
    • git lfs install
    • git lfs track "*.pth"

Usage Guide (For your Users)

1. Installation

pip install -r requirements.txt

2. Run Inference

Use the inference.py script to classify a single image.

Command:

python inference.py path/to/image.jpg --model path/to/model_folder

Example:

# Assuming you downloaded the model weights into a folder named 'my_model'
python inference.py test_image.png --model my_model

3. Output

The script will print the confidence scores for both "Real" and "Synthetic". It automatically handles background removal (using rembg) before classification, matching the training pipeline.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support