Downloads · 30 days
0
fangpenlin/cakelens-v5
cakelens-v5 is a video classification model from fangpenlin. Use it for the video classification task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Open-source AI-gen video detection model
Downloads · 30 days
0
Access
Public
Updated Jul 30, 2025
Repo size
3.2 GB
Likes
2
Public
Click a slice to open those files.
.pth3.2 GB · 100%
From the Hugging Face model README
Open-source AI-gen video detection model
Please see the blog post and the open-source Python library plus CLI tool cakelens-v5 for more details.
Install the package with its dependencies:
pip install cakelens-v5
The package provides a command line tool cakelens for easy video detection:
# Using Hugging Face Hub (recommended)
cakelens video.mp4
# Using local model file
cakelens video.mp4 --model-path model.pt
--model-path: Path to the model checkpoint file (optional - will load from Hugging Face Hub if not provided)--batch-size: Batch size for inference (default: 1)--device: Device to run inference on (cpu, cuda, mps) - auto-detected if not specified--verbose, -v: Enable verbose logging--output: Output file path for results (JSON format)# Basic detection (uses Hugging Face Hub)
cakelens video.mp4
# Using local model file
cakelens video.mp4 --model-path model.pt
# With custom batch size and device
cakelens video.mp4 --batch-size 4 --device cuda
# Save results to JSON file
cakelens video.mp4 --output results.json
# Verbose output
cakelens video.mp4 --verbose
The tool provides:
--verbose flag)You can also use the detection functionality programmatically in your Python code:
import pathlib
from cakelens.detect import Detector
from cakelens.model import Model
# Create model and load from Hugging Face Hub
model = Model()
# load the model weights from Hugging Face Hub
model.load_from_huggingface_hub()
# or, if you have a local model file:
# model.load_state_dict(torch.load("model.pt")["model_state_dict"])
# Create detector
detector = Detector(
model=model,
batch_size=1,
device="cpu" # or "cuda", "mps", or None for auto-detection
)
# Run detection
video_path = pathlib.Path("video.mp4")
verdict = detector.detect(video_path)
# Access results
print(f"Video: {verdict.video_filepath}")
print(f"Frame count: {verdict.frame_count}")
print("Predictions:")
for i, prob in enumerate(verdict.predictions):
print(f" Label {i}: {prob * 100:.2f}%")
The model can detect the following labels:
Note: The AI_GEN label is the most accurate as it has the most training data. Other labels have limited training data and may be less accurate.
The PR curve of the model is shown below:
<p align="center"> <img src="https://github.com/LaunchPlatform/cakelens-v5/raw/master/assets/pr-curve.png?raw=true" alt="PR Curve" /> </p>At threshold 0.5, the model has an precision of 0.77 and a recall of 0.74. The dataset size is 5,093 videos for training and 498 videos for validation. Please note that the model is not perfect and may make mistakes.