AMontiB commited on
Commit
8860a18
·
1 Parent(s): 6a489d1

update ALL

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +19 -1
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -192,7 +192,15 @@ def predict(image_path, detector_name):
192
  ax.set_ylabel('Confidence')
193
  ax.set_title('Detector Confidence Scores')
194
  ax.axhline(y=0.6, color='gray', linestyle='--', alpha=0.5, label='Vote Threshold (0.6)')
195
- ax.legend()
 
 
 
 
 
 
 
 
196
 
197
  # Add value labels
198
  for bar in bars:
@@ -258,6 +266,12 @@ with demo:
258
  * **Confidence**: The confidence with which the model determines if the image is real or fake.
259
  * **Elapsed Time**: The time the model needed to make the prediction (excluding preprocessing or model building).
260
 
 
 
 
 
 
 
261
  ### Note
262
  ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments. <br>
263
  ⚠️ To provide a free service, all models run on CPU. The detection process may take a few seconds, depending on the image size and the selected detector.
@@ -285,6 +299,10 @@ with demo:
285
 
286
  with gr.Accordion("📚 Model Details", open=False):
287
  gr.Markdown("""
 
 
 
 
288
  ### **R50_TF**
289
  * **Description**: A ResNet50 architecture modified to exclude downsampling at the first layer. It uses "learned prototypes" in the classification head for robust detection.
290
  * **Paper**: [TrueFake: A Real World Case Dataset of Last Generation Fake Images also Shared on Social Networks](https://arxiv.org/pdf/2504.20658)
 
192
  ax.set_ylabel('Confidence')
193
  ax.set_title('Detector Confidence Scores')
194
  ax.axhline(y=0.6, color='gray', linestyle='--', alpha=0.5, label='Vote Threshold (0.6)')
195
+
196
+ # Add custom legend for colors
197
+ from matplotlib.patches import Patch
198
+ legend_elements = [
199
+ Patch(facecolor='green', label='Real'),
200
+ Patch(facecolor='red', label='Fake'),
201
+ ax.lines[0] # The threshold line
202
+ ]
203
+ ax.legend(handles=legend_elements)
204
 
205
  # Add value labels
206
  for bar in bars:
 
266
  * **Confidence**: The confidence with which the model determines if the image is real or fake.
267
  * **Elapsed Time**: The time the model needed to make the prediction (excluding preprocessing or model building).
268
 
269
+ ### Understanding the Results produced by "ALL"
270
+ * Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
271
+ * 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.
272
+ * In the plot, **Green** bars indicate a **Real** prediction, while **Red** bars indicate a **Fake** prediction.
273
+
274
+
275
  ### Note
276
  ⚠️ Due to file size limitations, model weights need to be downloaded automatically on first use. This may take a few moments. <br>
277
  ⚠️ To provide a free service, all models run on CPU. The detection process may take a few seconds, depending on the image size and the selected detector.
 
299
 
300
  with gr.Accordion("📚 Model Details", open=False):
301
  gr.Markdown("""
302
+ ### **ALL**
303
+ * **Description**: Runs all available detectors (R50_TF, R50_nodown, CLIP-D, P2G, NPR) sequentially on the input image.
304
+ * **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.
305
+
306
  ### **R50_TF**
307
  * **Description**: A ResNet50 architecture modified to exclude downsampling at the first layer. It uses "learned prototypes" in the classification head for robust detection.
308
  * **Paper**: [TrueFake: A Real World Case Dataset of Last Generation Fake Images also Shared on Social Networks](https://arxiv.org/pdf/2504.20658)