This project now supports three layers:
- a FastAPI backend that accepts uploads and runs video analysis
- a Streamlit frontend for interactive testing
- an ML pipeline for preparing datasets and training a reusable frame classifier
Put your raw videos into class-labeled folders:
data/
raw/
ai_generated/
sample_01.mp4
sample_02.mov
real/
clip_01.mp4
clip_02.avi
The dataset prep script will extract evenly spaced frames from each video and create leakage-safe train, val, and optional test splits by video.
DeepAction is a strong starting point because it already pairs real human-action videos with multiple text-to-video model outputs. A dedicated importer is included:
python import_deepaction.py --max-videos 200This script imports:
Pexelsvideos intodata/raw/realBDAnimateDiffLightning,CogVideoX5B,RunwayML,StableDiffusion,Veo, andVideoPoetintodata/raw/ai_generated
If the datasets package is missing, install a compatible version first:
python -m pip install "datasets==3.0.6"python -m ml_models.prepare_dataset --raw-data-dir data/raw --output-dir data/processed/frames --frames-per-video 16 --overwriteThat creates a structure like:
data/
processed/
frames/
train/
val/
test/
dataset_manifest.json
python -m ml_models.train_model --data-dir data/processed/frames --output-dir ml_models/weights --epochs 10 --batch-size 8Training writes:
ml_models/weights/best_model.pthml_models/weights/training_metrics.json
The detector automatically reads ml_models/weights/best_model.pth if it exists.
Start the API:
uvicorn backend.main:app --reloadThen start the frontend in another terminal:
streamlit run frontend/app.py- Without trained weights, the app falls back to heuristic analysis so the product still works.
- Better results depend heavily on dataset quality, label accuracy, and diversity across generators, codecs, and resolutions.
- The current classifier is frame-based. A stronger next step would be adding temporal features or a video transformer.