AMontiB commited on
Commit
b182276
Β·
1 Parent(s): 64a8901
Files changed (3) hide show
  1. README.md +37 -25
  2. README_HF.md +42 -24
  3. app.py +32 -29
README.md CHANGED
@@ -10,43 +10,55 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- # Deepfake Detection Space
14
 
15
- This Space provides a unified interface to test multiple state-of-the-art deepfake detection models on your images. These are the detectors that you can find in the [Image-Deepfake-Detectors-Public-Library](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
16
 
17
- ## Available Detectors
18
 
19
- - **R50_TF** - ResNet-50 based detector trained on TrueFake dataset
20
- - **R50_nodown** - ResNet-50 without downsampling operations
21
- - **CLIP-D** - CLIP-based deepfake detector
22
- - **P2G** - Prompt2Guard: Conditioned prompt-optimization for continual deepfake detection
23
- - **NPR** - Neural Posterior Regularization
24
 
25
- ## Usage
26
 
27
- 1. Upload an image
28
- 2. Select a detector from the dropdown
29
- 3. Click "Detect" to get the prediction
 
30
 
31
- The detector will return:
32
- - **Prediction**: Real or Fake
33
- - **Confidence**: Model confidence score (0-1)
34
- - **Elapsed Time**: Processing time
35
 
36
- ## Models
 
 
 
 
37
 
38
- All models have been pretrained on images generated with StyleGAN2 and StableDiffusionXL, and real images from the FFHQ Dataset and the FORLAB Dataset.
39
 
40
- ## References
 
 
41
 
42
- For more information about the implementation and benchmarking, visit the [GitHub repository](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
 
 
 
43
 
44
- ## Acknowledgment
45
 
46
- This work has been funded by the European Union under Horizon Europe Grant Agreement no. 101092887 (NGI Sargasso – Open Call OC5 | Deepshield Project).
47
- Website page: [NGI Sargasso Innovators](https://ngisargasso.eu/2025/02/28/discover-the-last-13-ngi-sargasso-innovators-from-our-open-call-5-creating-an-internet-of-humans-across-continents/)
 
48
 
49
- ## Note
50
 
51
- ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments.
52
 
 
 
 
 
 
 
 
 
 
10
  license: mit
11
  ---
12
 
13
+ # Deepfake Detection Space (Open-Source Demonstrator)
14
 
15
+ Welcome to the Truebees Deepfake Detection Space! This Space provides a unified, user-friendly interface to test multiple open-source state-of-the-art deepfake detection models on your own images.
16
 
17
+ These detectors are available in the [Image-Deepfake-Detectors-Public-Library](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
18
 
19
+ ## 🎯 Goal and Context
 
 
 
 
20
 
21
+ This demonstrator is designed as an **educational and open-source contribution** to the community. We want to allow users, researchers, and developers to experiment with baseline forensic models for free, familiarize themselves with AI detection tools, and understand both their capabilities and their limitations.
22
 
23
+ **⚠️ Important Limitations & Disclaimer:**
24
+ * **Non-Social Training Data:** The models included here were trained specifically on non-social datasets.
25
+ * **"In-the-Wild" Performance Drop:** Because these models lack training on highly compressed data, you may experience a severe drop in performance or inaccurate results when testing images downloaded from social media platforms or messaging apps (e.g., WhatsApp).
26
+ * **Not Proprietary Software:** This Space showcases open-source baseline networks. It **does not** reflect the performance, robustness, or accuracy of Truebees' proprietary commercial detection methods, which are designed to handle complex "in-the-wild" manipulations.
27
 
28
+ ## πŸ› οΈ Available Detectors
 
 
 
29
 
30
+ * **R50_TF**: ResNet-50 based detector trained on the TrueFake dataset.
31
+ * **R50_nodown**: ResNet-50 without downsampling operations.
32
+ * **CLIP-D**: CLIP-based deepfake detector.
33
+ * **P2G**: Prompt2Guard: Conditioned prompt-optimization for continual deepfake detection.
34
+ * **NPR**: Neural Posterior Regularization.
35
 
36
+ ## πŸš€ Usage Guide
37
 
38
+ 1. **Upload an image**: Choose an image you want to analyze.
39
+ 2. **Select a detector**: Choose one of the open-source models from the dropdown menu.
40
+ 3. **Detect**: Click the "Detect" button to generate the prediction.
41
 
42
+ **Understanding the Output:**
43
+ * **Prediction**: Indicates whether the model believes the image is "Real" or "Fake".
44
+ * **Confidence**: The model's confidence score, ranging from 0 to 1.
45
+ * **Elapsed Time**: Total processing time taken by the model.
46
 
47
+ ## 🧠 Training Data Overview
48
 
49
+ All open-source models featured in this Space have been pretrained on specific datasets:
50
+ * **Fake Images:** Generated using StyleGAN2 and StableDiffusionXL.
51
+ * **Real Images:** Sourced from the FFHQ Dataset and the FORLAB Dataset.
52
 
53
+ ## πŸ“š References
54
 
55
+ For technical details, implementation specifics, and benchmarking data, please visit our [GitHub repository](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
56
 
57
+ ## 🀝 Acknowledgment
58
+
59
+ This work has been funded by the European Union under Horizon Europe Grant Agreement no. 101092887 (NGI Sargasso – Open Call OC5 | Deepshield Project).
60
+ * **Website page**: [NGI Sargasso Innovators](https://ngisargasso.eu/2025/02/28/discover-the-last-13-ngi-sargasso-innovators-from-our-open-call-5-creating-an-internet-of-humans-across-continents/)
61
+
62
+ ## ⏳ Note
63
+
64
+ ⚠️ Due to file size limitations, model weights need to be downloaded automatically upon first use. This may take a few moments.
README_HF.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Deepfake Detection Library
3
  emoji: πŸ”
4
  colorFrom: red
5
- colorTo: orange
6
  sdk: gradio
7
  sdk_version: 5.49.1
8
  app_file: app.py
@@ -10,37 +10,55 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- # Deepfake Detection Library
14
 
15
- This Space provides a unified interface to test multiple state-of-the-art deepfake detection models on your images.
16
 
17
- ## Available Detectors
18
 
19
- - **R50_TF** - ResNet-50 based detector trained on TrueFake dataset
20
- - **R50_nodown** - ResNet-50 without downsampling operations
21
- - **CLIP-D** - CLIP-based deepfake detector
22
- - **P2G** - Prompt2Guard: Conditioned prompt-optimization for continual deepfake detection
23
- - **NPR** - Neural Posterior Regularization
24
 
25
- ## Usage
26
 
27
- 1. Upload an image
28
- 2. Select a detector from the dropdown
29
- 3. Click "Detect" to get the prediction
 
30
 
31
- The detector will return:
32
- - **Prediction**: Real or Fake
33
- - **Confidence**: Model confidence score (0-1)
34
- - **Elapsed Time**: Processing time
35
 
36
- ## Models
 
 
 
 
37
 
38
- All models have been pretrained on images generated with StyleGAN2 and StableDiffusionXL, and real images from the FFHQ Dataset and the FORLAB Dataset.
39
 
40
- ## References
 
 
41
 
42
- For more information about the implementation and benchmarking, visit the [GitHub repository](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
 
 
 
43
 
44
- ## Note
45
 
46
- ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Deepfake Detection Space
3
  emoji: πŸ”
4
  colorFrom: red
5
+ colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.49.1
8
  app_file: app.py
 
10
  license: mit
11
  ---
12
 
13
+ # Deepfake Detection Space (Open-Source Demonstrator)
14
 
15
+ Welcome to the Truebees Deepfake Detection Space! This Space provides a unified, user-friendly interface to test multiple open-source state-of-the-art deepfake detection models on your own images.
16
 
17
+ These detectors are available in the [Image-Deepfake-Detectors-Public-Library](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
18
 
19
+ ## 🎯 Goal and Context
 
 
 
 
20
 
21
+ This demonstrator is designed as an **educational and open-source contribution** to the community. We want to allow users, researchers, and developers to experiment with baseline forensic models for free, familiarize themselves with AI detection tools, and understand both their capabilities and their limitations.
22
 
23
+ **⚠️ Important Limitations & Disclaimer:**
24
+ * **Non-Social Training Data:** The models included here were trained specifically on non-social datasets.
25
+ * **"In-the-Wild" Performance Drop:** Because these models lack training on highly compressed data, you may experience a severe drop in performance or inaccurate results when testing images downloaded from social media platforms or messaging apps (e.g., WhatsApp).
26
+ * **Not Proprietary Software:** This Space showcases open-source baseline networks. It **does not** reflect the performance, robustness, or accuracy of Truebees' proprietary commercial detection methods, which are designed to handle complex "in-the-wild" manipulations.
27
 
28
+ ## πŸ› οΈ Available Detectors
 
 
 
29
 
30
+ * **R50_TF**: ResNet-50 based detector trained on the TrueFake dataset.
31
+ * **R50_nodown**: ResNet-50 without downsampling operations.
32
+ * **CLIP-D**: CLIP-based deepfake detector.
33
+ * **P2G**: Prompt2Guard: Conditioned prompt-optimization for continual deepfake detection.
34
+ * **NPR**: Neural Posterior Regularization.
35
 
36
+ ## πŸš€ Usage Guide
37
 
38
+ 1. **Upload an image**: Choose an image you want to analyze.
39
+ 2. **Select a detector**: Choose one of the open-source models from the dropdown menu.
40
+ 3. **Detect**: Click the "Detect" button to generate the prediction.
41
 
42
+ **Understanding the Output:**
43
+ * **Prediction**: Indicates whether the model believes the image is "Real" or "Fake".
44
+ * **Confidence**: The model's confidence score, ranging from 0 to 1.
45
+ * **Elapsed Time**: Total processing time taken by the model.
46
 
47
+ ## 🧠 Training Data Overview
48
 
49
+ All open-source models featured in this Space have been pretrained on specific datasets:
50
+ * **Fake Images:** Generated using StyleGAN2 and StableDiffusionXL.
51
+ * **Real Images:** Sourced from the FFHQ Dataset and the FORLAB Dataset.
52
+
53
+ ## πŸ“š References
54
+
55
+ For technical details, implementation specifics, and benchmarking data, please visit our [GitHub repository](https://github.com/truebees-ai/Image-Deepfake-Detectors-Public-Library).
56
+
57
+ ## 🀝 Acknowledgment
58
+
59
+ This work has been funded by the European Union under Horizon Europe Grant Agreement no. 101092887 (NGI Sargasso – Open Call OC5 | Deepshield Project).
60
+ * **Website page**: [NGI Sargasso Innovators](https://ngisargasso.eu/2025/02/28/discover-the-last-13-ngi-sargasso-innovators-from-our-open-call-5-creating-an-internet-of-humans-across-continents/)
61
+
62
+ ## ⏳ Note
63
+
64
+ ⚠️ Due to file size limitations, model weights need to be downloaded automatically upon first use. This may take a few moments.
app.py CHANGED
@@ -268,26 +268,29 @@ def predict(image_path, detector_name):
268
  demo = gr.Blocks(title="Deepfake Detection Space", theme=gr.themes.Soft())
269
 
270
  with demo:
271
- gr.Markdown("# πŸ” Deepfake Detection Space")
272
  gr.Markdown("""
273
- This space collects a series of state-of-the-art methods for deepfake detection, allowing for free and unlimited use.
 
274
 
 
 
 
 
275
  ### Training & Performance
276
  All methods have been trained using the **[DeepShield dataset](https://zenodo.org/records/15648378)**, on images generated with **Stable Diffusion XL** and **StyleGAN 2**.
277
  You can expect performance comparable to the results shown in [Dell'Anna et al. (2025)](https://arxiv.org/pdf/2504.20658).
278
 
279
  ### Understanding the Results
280
- * **Prediction**: Tells if an image is **Real** or **Fake**.
281
- * **Confidence**: The confidence with which the model determines if the image is real or fake.
282
- * **Elapsed Time**: The time the model needed to make the prediction (excluding preprocessing or model building).
283
 
284
  ### Understanding the Results produced by "ALL"
285
- * Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
286
- * Produces a **Weighted Majority Vote** verdict (Real/Fake). Each model's vote is weighted by a fixed importance score (summing to 1) based on user ranking **and its confidence score**. Only confident predictions (> 0.6) are counted.
287
- * You can find the specific weights used for each model in the **"βš–οΈ Weight Details"** menu below.
288
- * Also generates a **Confidence Plot** visualizing each model's score and a textual **Explanation** of the consensus.
289
- * In the plot, **Green** bars indicate a **Real** prediction, while **Red** bars indicate a **Fake** prediction.
290
-
291
 
292
  ### Note
293
  ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments. <br>
@@ -331,33 +334,33 @@ with demo:
331
  with gr.Accordion("πŸ“š Model Details", open=False):
332
  gr.Markdown("""
333
  ### **ALL**
334
- * **Description**: Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
335
- * **Results**: Produces a **Majority Vote** verdict (Real/Fake) considering only confident predictions (> 0.6). Also generates a **Confidence Plot** visualizing each model's score and a textual **Explanation** of the consensus.
336
 
337
  ### **R50_TF**
338
- * **Description**: A ResNet50 architecture modified to exclude downsampling at the first layer. It uses "learned prototypes" in the classification head for robust detection.
339
- * **Paper**: [TrueFake: A Real World Case Dataset of Last Generation Fake Images also Shared on Social Networks](https://arxiv.org/pdf/2504.20658)
340
- * **Code**: [GitHub Repository](https://github.com/MMLab-unitn/TrueFake-IJCNN25)
341
 
342
  ### **R50_nodown**
343
- * **Description**: A ResNet-50 model without downsampling operations in the first layer, designed to preserve high-frequency artifacts common in synthetic images.
344
- * **Paper**: [On the detection of synthetic images generated by diffusion models](https://arxiv.org/abs/2211.00680)
345
- * **Code**: [GitHub Repository](https://grip-unina.github.io/DMimageDetection/)
346
 
347
  ### **CLIP-D**
348
- * **Description**: A lightweight detection strategy based on CLIP features. It exhibits surprising generalization ability using only a handful of example images.
349
- * **Paper**: [Raising the Bar of AI-generated Image Detection with CLIP](https://arxiv.org/abs/2312.00195v2)
350
- * **Code**: [GitHub Repository](https://grip-unina.github.io/ClipBased-SyntheticImageDetection/)
351
 
352
  ### **P2G (Prompt2Guard)**
353
- * **Description**: Uses Vision-Language Models (VLMs) with conditioned prompt-optimization for continual deepfake detection. It leverages read-only prompts for efficiency.
354
- * **Paper**: [Conditioned Prompt-Optimization for Continual Deepfake Detection](https://arxiv.org/abs/2407.21554)
355
- * **Code**: [GitHub Repository](https://github.com/laitifranz/Prompt2Guard)
356
 
357
  ### **NPR**
358
- * **Description**: Focuses on Neighboring Pixel Relationships (NPR) to capture generalized structural artifacts stemming from up-sampling operations in generative networks.
359
- * **Paper**: [Rethinking the Up-Sampling Operations in CNN-based Generative Network for Generalizable Deepfake Detection](https://arxiv.org/abs/2312.10461)
360
- * **Code**: [GitHub Repository](https://github.com/chuangchuangtan/NPR-DeepfakeDetection)
361
  """)
362
 
363
  gr.Markdown("""
@@ -382,4 +385,4 @@ if __name__ == "__main__":
382
  demo.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=["."])
383
  else:
384
  # Local execution
385
- demo.launch()
 
268
  demo = gr.Blocks(title="Deepfake Detection Space", theme=gr.themes.Soft())
269
 
270
  with demo:
 
271
  gr.Markdown("""
272
+ # πŸ” Deepfake Detection Space
273
+ This space provides an **educational, open-source demonstrator** collecting a series of baseline state-of-the-art methods for deepfake detection, allowing for free and unlimited use.
274
 
275
+ ### ⚠️ Important Limitations
276
+ * **Not Proprietary Software:** This tool showcases open-source networks. It **does not** reflect the performance, robustness, or accuracy of Truebees' commercial detection methods.
277
+ * **"In-the-Wild" Performance Drop:** These models were trained on non-social datasets. You may experience a severe drop in accuracy when testing highly compressed images downloaded from social media platforms or messaging apps (e.g., WhatsApp).
278
+
279
  ### Training & Performance
280
  All methods have been trained using the **[DeepShield dataset](https://zenodo.org/records/15648378)**, on images generated with **Stable Diffusion XL** and **StyleGAN 2**.
281
  You can expect performance comparable to the results shown in [Dell'Anna et al. (2025)](https://arxiv.org/pdf/2504.20658).
282
 
283
  ### Understanding the Results
284
+ * **Prediction**: Tells if an image is **Real** or **Fake**.
285
+ * **Confidence**: The confidence with which the model determines if the image is real or fake.
286
+ * **Elapsed Time**: The time the model needed to make the prediction (excluding preprocessing or model building).
287
 
288
  ### Understanding the Results produced by "ALL"
289
+ * Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
290
+ * Produces a **Weighted Majority Vote** verdict (Real/Fake). Each model's vote is weighted by a fixed importance score (summing to 1) based on user ranking **and its confidence score**. Only confident predictions (> 0.6) are counted.
291
+ * You can find the specific weights used for each model in the **"βš–οΈ Weight Details"** menu below.
292
+ * Also generates a **Confidence Plot** visualizing each model's score and a textual **Explanation** of the consensus.
293
+ * In the plot, **Green** bars indicate a **Real** prediction, while **Red** bars indicate a **Fake** prediction.
 
294
 
295
  ### Note
296
  ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments. <br>
 
334
  with gr.Accordion("πŸ“š Model Details", open=False):
335
  gr.Markdown("""
336
  ### **ALL**
337
+ * **Description**: Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
338
+ * **Results**: Produces a **Majority Vote** verdict (Real/Fake) considering only confident predictions (> 0.6). Also generates a **Confidence Plot** visualizing each model's score and a textual **Explanation** of the consensus.
339
 
340
  ### **R50_TF**
341
+ * **Description**: A ResNet50 architecture modified to exclude downsampling at the first layer. It uses "learned prototypes" in the classification head for robust detection.
342
+ * **Paper**: [TrueFake: A Real World Case Dataset of Last Generation Fake Images also Shared on Social Networks](https://arxiv.org/pdf/2504.20658)
343
+ * **Code**: [GitHub Repository](https://github.com/MMLab-unitn/TrueFake-IJCNN25)
344
 
345
  ### **R50_nodown**
346
+ * **Description**: A ResNet-50 model without downsampling operations in the first layer, designed to preserve high-frequency artifacts common in synthetic images.
347
+ * **Paper**: [On the detection of synthetic images generated by diffusion models](https://arxiv.org/abs/2211.00680)
348
+ * **Code**: [GitHub Repository](https://grip-unina.github.io/DMimageDetection/)
349
 
350
  ### **CLIP-D**
351
+ * **Description**: A lightweight detection strategy based on CLIP features. It exhibits surprising generalization ability using only a handful of example images.
352
+ * **Paper**: [Raising the Bar of AI-generated Image Detection with CLIP](https://arxiv.org/abs/2312.00195v2)
353
+ * **Code**: [GitHub Repository](https://grip-unina.github.io/ClipBased-SyntheticImageDetection/)
354
 
355
  ### **P2G (Prompt2Guard)**
356
+ * **Description**: Uses Vision-Language Models (VLMs) with conditioned prompt-optimization for continual deepfake detection. It leverages read-only prompts for efficiency.
357
+ * **Paper**: [Conditioned Prompt-Optimization for Continual Deepfake Detection](https://arxiv.org/abs/2407.21554)
358
+ * **Code**: [GitHub Repository](https://github.com/laitifranz/Prompt2Guard)
359
 
360
  ### **NPR**
361
+ * **Description**: Focuses on Neighboring Pixel Relationships (NPR) to capture generalized structural artifacts stemming from up-sampling operations in generative networks.
362
+ * **Paper**: [Rethinking the Up-Sampling Operations in CNN-based Generative Network for Generalizable Deepfake Detection](https://arxiv.org/abs/2312.10461)
363
+ * **Code**: [GitHub Repository](https://github.com/chuangchuangtan/NPR-DeepfakeDetection)
364
  """)
365
 
366
  gr.Markdown("""
 
385
  demo.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=["."])
386
  else:
387
  # Local execution
388
+ demo.launch()