How tejasweesahu/deepfake-image-detector works
Project type and purpose
• This is an ML‐based pipeline for detecting deepfake images.
• It trains a CNN (optionally with transfer learning) on labeled “real” vs. “fake” images, then produces JSON predictions for unseen test images.
File structure
• Top level:
• Bishop_Boys.ipynb – contains all data ingestion, preprocessing, model definition, training, evaluation, and inference code.
• README.md – project description, approach, architecture, results.
• LICENSE.
• No separate “src” or “data” folders—code and documentation are bundled in the notebook.
README for additional insights
• Data sources: fake_cifake_images/, real_cifake_images/, JSON label files, test/ images.
• Steps: preprocessing (resize, normalize, label conversion), CNN model (conv, pooling, dropout, dense), evaluation (train/val split), inference (produce JSON).
a. Main components:
1. Data Storage
– Raw image directories (real, fake, test)
– JSON label files
2. Data Preprocessing
– Image loader & resizer (224×224)
– Normalization step
– Label encoder
3. Model Training
– CNN architecture (or ResNet transfer‐learning block)
– Training loop (loss calculation, optimizer)
4. Evaluation
– Train/validation split
– Metrics calculator (accuracy, robustness)
5. Inference
– Load trained weights
– Predict on test images
– Format output JSON
6. Output Storage
– Predictions JSON file
b. Relationships and data flows:
– Inference → Output Storage.
– Feedback loop from Evaluation back to Model Training (hyperparameter tuning).
c. Architectural patterns and principles:
– Pipeline pattern: distinct stages (ingest → preprocess → train → evaluate → infer).
– Modular separation (data, compute, output).
– Optional micro-batch processing of images.
– Reusability: same preprocessing code for train/test.
d. Key technologies:
– Jupyter Notebook (Bishop_Boys.ipynb) as execution environment.
– Python libraries: TensorFlow/PyTorch (CNN and transfer learning), OpenCV/Pillow (image ops), JSON lib.
– JSON files for labels and output.
Elements
– Clear labels: “Raw Images”, “Preprocessing Module”, “CNN Trainer”, “Evaluator”, “Inference Engine”, “Output JSON”.
Detailed capture of architectural elements
• Break Preprocessing into “Resize” and “Normalize” sub‐components.
• In the Model block, subdivide into “Conv + Pool Layers”, “Dropout”, “Dense”.
• Evaluation metrics branching off the Trainer.