Locate
MTCNN extracts and aligns the most prominent face from an uploaded image, or from up to 15 evenly sampled frames of an uploaded video.
XAI Forensics pairs a fine-tuned EfficientNet classifier with Grad-CAM heatmaps, turning a plain "real or fake" label into a visual, defendable verdict — built to be verified, not just trusted.
Deepfake detectors are everywhere, but most of them are black boxes — they return a probability and nothing else. XAI Forensics was built to close that gap: a full-stack system that classifies uploaded images and videos as real or fake, and then shows exactly which region of the face drove that decision.
The project pairs a fine-tuned EfficientNet binary classifier with MTCNN face detection and Grad-CAM explainability on the backend, delivered through a Flask API and a React/TanStack Start forensic dashboard designed to feel like an actual investigative tool rather than a demo toy.
Most deepfake classifiers output a single confidence score and stop there. That's a dead end for journalists, forensic analysts, and platforms that need to justify a decision, not just receive one — a black-box "94% fake" verdict can't be cross-examined, cited, or trusted at face value.
The goal was to build a system that keeps the accuracy of a modern CNN classifier while adding a second, independent layer: visual proof of where the model is looking, so a human reviewer can agree or disagree with the reasoning, not just the label.
Rather than treating detection as a single opaque step, the pipeline separates face localization, binary classification, and explainability into three distinct stages — so each one can be inspected, tested, and improved independently.
MTCNN extracts and aligns the most prominent face from an uploaded image, or from up to 15 evenly sampled frames of an uploaded video.
A EfficientNet backbone, fine-tuned with a custom dropout-linear-ReLU head, scores each detected face and averages the results across all sampled frames for a single verdict.
Grad-CAM hooks into the final convolutional layer of EfficientNet to generate a heatmap over the highest-confidence face, overlaid and returned alongside the verdict.
Images are analyzed directly; videos are decoded and evenly sampled at up to 15 frames using OpenCV, so a short clip and a longer one both get proportional coverage without processing every frame.
Each sampled frame is passed through MTCNN with a 20px margin around the detected face, producing consistently sized 224×224 crops that feed directly into the classifier's expected input shape.
Each face crop gets an independent sigmoid probability from EfficientNet; the final verdict is the mean across all detected faces, giving a video-level judgment instead of a single fragile frame-level guess.
/analyze endpoint wired to a React drag-and-drop upload flow with live pipeline-stage animation.Built with React, TanStack Start, and Framer Motion, the interface walks the reviewer through each pipeline stage in real time — frame extraction, spatial scan, confidence fusion — before surfacing the verdict, spatial and temporal sub-scores, and the Grad-CAM heatmap overlaid directly on the uploaded media.
The "temporal anomaly" score shown in the dashboard is derived from the variance of per-frame predictions rather than a purpose-built temporal model like an LSTM or 3D-CNN — a reasonable proxy, but not true motion-consistency analysis.
The listed "findings" (lighting inconsistency, lip-sync drift, frequency artifacts) are selected from a fixed set based on the confidence score rather than each being independently verified by a dedicated detector — useful context, but not standalone evidence.
MTCNN is configured to detect only the most prominent face per frame, so multi-person videos are evaluated on one subject at a time rather than analyzing every face present.
XAI Forensics runs end to end: a real upload triggers real MTCNN face detection, real EfficientNet inference, and a real Grad-CAM heatmap — not mocked data. That heatmap is the core deliverable of the project, turning an opaque classifier into something a reviewer can actually inspect and argue with.
The clearest next step is replacing the heuristic temporal score with a genuine sequence model (e.g. a frame-level LSTM or 3D-CNN) and validating the classifier against a public benchmark like FaceForensics++ or Celeb-DF to quantify accuracy beyond the current qualitative testing.
Tell us what you are trying to make clearer, faster, or more capable.
Start a conversation ↗