Code Monkey home page Code Monkey logo

deepfake-detection's Introduction

DeepFake Detection

This project implements a deep learning-based image classification model for detecting real or fake faces, specifically designed for facial image manipulation detection. It integrates face detection with MTCNN (Multi-task Cascaded Convolutional Networks), face recognition with InceptionResnetV1,and explainability visualization with Grad-CAM (Gradient-weighted Class Activation Mapping). The model is fine-tuned for binary classification (real or fake) and provides confidence scores for each prediction.

Technologies and Components

1)Face Detection with MTCNN: MTCNN identifies faces in images and outputs bounding box coordinates to extract the face region.

2)Face Recognition with InceptionResnetV1: InceptionResnetV1, pretrained on the VGGFace2 dataset, is loaded and fine-tuned for binary classification.

3)Model Checkpoint Loading: Pre-trained model checkpoint (resnetinceptionv1_epoch_32.pth) is loaded to initialize the InceptionResnetV1 model.

4)Image Preprocessing: Input images are preprocessed using MTCNN-detected face bounding boxes and resized to (256, 256) for model input.

5)Model Inference: The model takes input images, detects faces using MTCNN, preprocesses faces, and performs inference. It generates predictions and provides confidence scores for each class.

6)Grad-CAM for Explainability: PyTorch Grad-CAM generates heatmaps highlighting regions contributing most to model predictions, aiding in explaining classification decisions.

7)Gradio Interface: Gradio creates a simple web interface for testing the model. Users upload images and view predictions along with explainability visualizations.

8)Prediction and Confidence Calculation: The model predicts whether input faces are real or fake, and confidence scores for each prediction are calculated and returned.

Process of Execution

For Windows OS,

  • Download, extract the deepfake-detetction zip file from the above files. Do ensure to extract the zip file before running it.

  • After successful installation of the kit,search for the windows batch file in the above zip file and run the batch file.

  • press 'Y' to run the kit and execute cells in the notebook.

  • To run the kit manually, press N and locate the zip file deepfake-detection.zip.

  • Extract the zip file and navigate to the directory deepfake-detection.

  • Open command prompt in the extracted directory deepfake-detection and run the command jupyter notebook.

  • Locate and open the Deepfake_detection.ipynb notebook from the Jupyter Notebook browser window.

  • Execute cells in the notebook.

For other Operating Systems,

• Download and extract the kit_installer zip file.

• Follow the above execution information to begin set-up.

• This 1-click kit has all the required dependencies and resources to build your DeepFake Detection Engine.

Output screens represent the expected results and visual feedback from the deep fake detection system during testing.When we run the application,a Jupyter source file will be opened and screen appears as follows:

1

Now we need to run all the cells to activate the user interface (Gradio Interface)

2

At the bottom of the page the following interface will be activated :

3

Now you have an option to drop or choose a picture from your system for detection and click the submit button for final results :

i) Lets check for a DeepFake Image

4

As we all know the above picture is of Elon Musk , which is really deepfake image , and our model predicts it very accurately. The results are as follows :

5

ii)Now we will be testing a real image:

6

Acknowledgements

Applications

This DeepFake Engine is best suitable for:

  • Social Media Platforms: Identify and flag manipulated images or videos to prevent the spread of misinformation.

  • News Verification: Verify the authenticity of images and videos used in news articles and reports.

  • Law Enforcement: Detect DeepFake content used in criminal activities such as identity theft and cyberbullying.

  • Entertainment Industry: Protect intellectual property by identifying and preventing unauthorized distribution of DeepFake content.

  • Personal Security: Verify the authenticity of shared images and videos to avoid falling victim to scams or manipulation tactics.

Authors

Feedback

If you have any feedback or questions, please reach me out at [email protected]

deepfake-detection's People

Contributors

saivaraprasadmandala avatar

Stargazers

A V REVANTH avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.