Spaces:
Runtime error
Runtime error
File size: 7,564 Bytes
4d106c0 a671c0b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ---
title: Redeepfake Demo
emoji: 🏢
colorFrom: yellow
colorTo: gray
sdk: streamlit
sdk_version: 1.31.0
app_file: app.py
pinned: false
license: mit
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# ReDeepFake Model Card

[](https://github.com/silvermete0r/redeepfake-demo-app/stargazers/)
[](https://github.com/silvermete0r/redeepfake-demo-app/network/)
[](https://github.com/silvermete0r/redeepfake-demo-app/issues)
[](https://github.com/silvermete0r/redeepfake-demo-app/blob/master/LICENSE)

## Overview
**Model Name:** `ReDeepFake`
**Task:** Advanced Deepfake detection model for 2D flat images.
**Model Type:** Convolutional Neural Network (CNN) -> [EfficientNetB4](https://www.tensorflow.org/api_docs/python/tf/keras/applications/efficientnet) Model Architecture based.
**Framework:** `TensorFlow`
**Current Version:** V1.3
**Key Study:** [Deepfake Detection Challenge (DFDC)](https://www.kaggle.com/competitions/deepfake-detection-challenge) (in 2019-2020, by Meta, AWS, Microsoft and AI’s Media Integrity Steering Committee).
**Key Parthner:** `Microsoft Imagine Cup 2024`
**Kaggle Notebook:** https://www.kaggle.com/code/armanzhalgasbayev/deepfake-detection-efficientnetb4-tf-cnn
**Research Paper:** will be here very soon..
## Description
ReDeepFake is a deep learning model designed for the purpose of detecting deepfake content within 2D flat images. Leveraging EfficientNetB4 advanced CNN architecture, the model is trained to discern subtle patterns indicative of deepfake manipulation.
## Key Features
- **Architecture:** Utilizes EfficientNetB4 model architecture with a custom-designed additional layers. ReDeepFake model architecture shown below in the figure:

- **Training Data:** Pre-processed dataset of 224x224 resized real/fake image from DFDC competition was used for training our `ReDeepFake` model.
- Dataset of 32,000 face images:
- Real: 16,000;
- Fake: 16,000;

- **Performance Metrics:** Evaluated based on `Accuracy` and `F1-score`.
- **Accuracy:** The proportion of correctly classified images.

- **F1-score:** The harmonic mean of precision and recall.
- **Precision:** The ratio of true positive predictions to the total predicted positives.
- **Recall:** The ratio of true positive predictions to the total actual positives.

- **Dataset Source:** [deepfake_faces](https://www.kaggle.com/datasets/dagnelies/deepfake-faces)
- **Deepfake Detection Challenge:** [Deepfake Detection Challenge](https://www.kaggle.com/competitions/deepfake-detection-challenge)
- **Final Trained Model Link:** [ReDeepFake v1.4](https://www.kaggle.com/models/armanzhalgasbayev/redeepfake)
- **Generation of Deepfake images based on ONNX & PyTorch:** https://gist.github.com/silvermete0r/e24f35df5b9a62f03a7e73d1f3d448c3
- **Try using our demo:** https://huggingface.co/spaces/dataflow/redeepfake-demo

## Model Performance

* **Test Loss:** `0.3455`
* **Test Accuracy:** `0.8395`


## Usage
### Prerequisites
* face_recognition<=1.3.0
* numpy<=1.23.5
* opencv_python<=4.7.0.72
* pandas<=2.0.2
* tensorflow==2.15.0.post1
* streamlit<=1.23.1 (Optional - for demo)
### Areas of Usage
1. **Media Integrity Verification:**
- Verify the authenticity of images and videos in the media industry to ensure integrity and trustworthiness.
2. **Social Media Content Moderation:**
- Enhance content moderation on social media platforms by detecting and preventing the spread of deepfake content.
3. **Security and Surveillance:**
- Strengthen security and surveillance systems by identifying manipulated visuals that could compromise the accuracy of facial recognition and surveillance technologies.
### Loading the Model
```python
import tensorflow as tf
## Load the ReDeepFake model
redeepfake_model = tf.keras.models.load_model('redeepfake_model.h5')
```
## Making Predictions
```python
# 'image' -> preprocessed input image data
prediction = redeepfake_model.predict(image)
```
## Model Limitations
1. The model's performance may be influenced by variations in lighting conditions, image quality, and diverse facial expressions.
2. It may not be fully robust against emerging deepfake generation techniques: Modern image generation methods use advanced descriptors to assess the quality of the image's realism, so photos of such faces are difficult to distinguish from real people.
3. Deepfakes made by using 3D image processing technologies and manually modified images by the authors cannot be recognized correctly by the model.
## Ethics
1. **Informed Consent:**
- Ensure that individuals involved in the data used for training and testing the model have given informed consent for their images to be used. Respect privacy and obtain explicit permission when necessary.
2. **Responsible Disclosure:**
- If the model identifies potential deepfake content related to an individual, exercise responsible disclosure. Notify the concerned parties or relevant authorities in a timely and responsible manner, allowing them to address the situation appropriately.
3. **Avoid Unlawful Use:**
- Do not use the ReDeepFake model for any activities that violate laws, regulations, or ethical standards. Prohibit the use of the model for malicious purposes, such as generating harmful deepfake content or engaging in activities that infringe on privacy rights.
**License**
This model is provided under the [LICENSE](LICENSE) file. Please review the terms and conditions before usage.
**Issues and Contributions**
For issues or contributions, please visit the [GitHub repository](https://github.com/silvermete0r/redeepfake-demo-app).
**Acknowledgments**
Special thanks to the contributors and the open-source community for their support and collaboration.
|