MLOps project for binary classification of AI-generated vs real images and videos using deep learning.
The proliferation of AI-generated content has created a need for automated detection systems. This project implements a deep learning solution to distinguish between authentic and AI-generated images and videos, addressing challenges in content verification and media authenticity.
- Muhammad Basil
- Taha Zahid
- Airflow - Workflow orchestration
- DagsHub - Data versioning and collaboration
- MLflow - Experiment tracking and model registry
- MongoDB - Data storage
- Git - Version control
- Deep Learning - Model training
- EfficientNet - Transfer learning model architecture
- FFmpeg - Video frame extraction
- TensorFlow/Keras - Deep learning framework
-
Data Preprocessing
- Extract video frames using FFmpeg
- Clean and resize images to 256x256
- Balance dataset classes
- Split into train/validation/test sets
-
Model Architecture
- EfficientNetB0 with transfer learning (ImageNet weights)
- Two-phase training: frozen backbone then fine-tuning
- Data augmentation: rotation, flipping, zoom, brightness, contrast
-
MLOps Pipeline
- Airflow orchestrates preprocessing and training workflows
- MLflow tracks experiments and model versions
- DagsHub manages data versioning
- MongoDB stores metadata and results
- Git for code version control
-
Training Process
- Phase 1: Train with frozen EfficientNetB0 backbone (10 epochs)
- Phase 2: Fine-tune last 20 layers (10 epochs)
- Callbacks: ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
- Test Accuracy: 86%
- Model successfully distinguishes between real and AI-generated content
- EfficientNetB0 transfer learning approach shows strong performance
Training code available in:
train.py- Main training scripttrain.ipynb- Jupyter notebook with full pipeline
Key components:
- Data preprocessing and augmentation
- EfficientNetB0 model implementation
- Training and evaluation loops
- Model saving and inference
mlops/
├── train.py
├── train.ipynb
└── README.md
Expected structure:
data/
├── train/real/
├── train/fake/
├── val/real/
├── val/fake/
├── test/real/
└── test/fake/
Videos are processed using FFmpeg to extract frames before training.
python train.pyOr use the Jupyter notebook train.ipynb.
pip install tensorflow keras numpy pillow matplotlibNote: Originally developed in Google Colab. Update paths and remove Colab-specific imports for local execution.