A comprehensive deepfake detection and training system with unified model training capabilities and extensive test coverage.
detector_train_system/
βββ π§ͺ train_system/ # Universal PyTorch training system
βββ π€ models/ # Standalone detection models
βββ π Capsule-Forensics-v2/ # Capsule network implementation
βββ βοΈ .github/workflows/ # CI/CD pipelines
βββ π config files # Various training configurations
Location: train_system/
A universal PyTorch training system that provides:
- Universal Model Support: Train any PyTorch model with unified interface
- Configuration-Based Training: YAML/JSON config files
- REST API & CLI: Remote training control and command-line interface
- Adapter System: Handles different model output formats automatically
- Comprehensive Testing: 22 test cases with 95%+ coverage
Quick Start:
cd train_system
pip install -e .
train-system create-template torchvision my_config.yaml
train-system train my_config.yaml
Location: models/
Standalone deepfake detection models:
- Xception
- EfficientNetB4
- Meso4/MesoInception
- UCF models
- YOLO detection
- Capsule networks
- BLIP-based detection
Location: Capsule-Forensics-v2/
Advanced capsule network implementation for deepfake detection with specialized training scripts for various datasets.
The system includes comprehensive testing with 22 test cases:
Component | Coverage | Status |
---|---|---|
Model Wrapping | 100% | β |
Configuration | 100% | β |
Training Pipeline | 90% | β |
Error Handling | 95% | β |
Integration | 100% | β |
- β Automated Testing: GitHub Actions on push/PR
- β Multi-Python: Tests on Python 3.8 & 3.11
- β Cross-platform: Ubuntu environment
- β Coverage Reports: Detailed test coverage analysis
Test Execution:
cd train_system
python run_tests.py # Quick test run
python -m pytest tests/test_comprehensive.py -v # Detailed testing
- Python >= 3.8
- PyTorch >= 1.9.0
- CUDA (optional, for GPU training)
# Clone repository
git clone <repository-url>
cd detector_train_system
# Install train system
cd train_system
pip install -e .
# Install detection models dependencies
pip install -r requirements.txt
model:
name: "ResNet18"
type: "torchvision"
architecture: "resnet18"
pretrained: true
num_classes: 2
data:
type: "class_folders"
train_path: "data/train"
val_path: "data/val"
training:
epochs: 10
learning_rate: 0.001
batch_size: 32
model:
name: "UCF_Model"
type: "file"
path: "models/ucf_standalone.py"
training:
resume_from: "checkpoint_epoch_5.pth"
epochs: 15
cd train_system
train-system create-template torchvision resnet_config.yaml
# Edit config file as needed
train-system train resnet_config.yaml
from models.xception_standalone import XceptionModel
model = XceptionModel(num_classes=2)
model.load_checkpoint("checkpoint_epoch_5.pth")
predictions = model.predict(image_tensor)
cd train_system
python run_tests.py
# Output: 22 passed, 6 warnings in ~9 seconds β
- Any PyTorch model compatibility
- Automatic adapter detection
- Configuration-based training
- Resume training capabilities
- Memory optimization
- 22 comprehensive test cases
- Cross-platform compatibility
- CI/CD integration
- Error handling validation
- Performance benchmarking
- Multiple deepfake detection architectures
- Pre-trained weights available
- Standalone inference scripts
- Specialized dataset handlers
- Template system for quick setup
- Override mechanisms
- Validation and error checking
- YAML/JSON support
- Training Speed: Optimized for GPU acceleration
- Memory Usage: Advanced memory management
- Test Speed: 22 tests in ~9 seconds
- Model Loading: Fast checkpoint resume
- API Response: Sub-second response times
# All tests
cd train_system && python run_tests.py
# Specific test category
python -m pytest tests/test_comprehensive.py::TestModelWrapping -v
# With coverage
python -m pytest tests/test_comprehensive.py --cov=train_system
- Create model file in
models/
- Implement standard interface
- Add configuration template
- Update tests
- Submit PR
- Fork repository
- Create feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit pull request
- Train System README - Detailed train system docs
- Test Coverage - Comprehensive test documentation
- Performance Guide - Optimization tips
- Adapter Guide - Custom adapter development
Latest Test Results: β
22 passed, 6 warnings
Coverage: 95%+ across all components
Platform: Ubuntu, Python 3.8 & 3.11
MIT License - see LICENSE file for details.
Last Updated: August 6, 2025
Repository Version: 1.0
Test Suite: 22 comprehensive tests