feat: enhance forensic analysis by adding additional gradient and MinMax processing variations
Browse files- app_mcp.py +7 -3
app_mcp.py
CHANGED
|
@@ -361,8 +361,11 @@ def predict_with_ensemble(img, confidence_threshold, augment_methods, rotate_deg
|
|
| 361 |
|
| 362 |
# 6. Perform forensic processing
|
| 363 |
gradient_image = gradient_processing(img_np_og) # Added gradient processing
|
|
|
|
|
|
|
| 364 |
minmax_image = minmax_process(img_np_og) # Added MinMax processing
|
| 365 |
-
|
|
|
|
| 366 |
|
| 367 |
|
| 368 |
# First pass - standard analysis
|
|
@@ -372,7 +375,7 @@ def predict_with_ensemble(img, confidence_threshold, augment_methods, rotate_deg
|
|
| 372 |
ela2 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=True)
|
| 373 |
ela3 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=False)
|
| 374 |
|
| 375 |
-
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, minmax_image,
|
| 376 |
|
| 377 |
# 7. Generate boilerplate descriptions for forensic outputs for anomaly agent
|
| 378 |
forensic_output_descriptions = [
|
|
@@ -381,8 +384,9 @@ def predict_with_ensemble(img, confidence_threshold, augment_methods, rotate_deg
|
|
| 381 |
"ELA analysis (Pass 2): Grayscale error map, quality 75, enhanced contrast.",
|
| 382 |
"ELA analysis (Pass 3): Color error map, quality 75, enhanced contrast.",
|
| 383 |
"Gradient processing: Highlights edges and transitions.",
|
|
|
|
| 384 |
"MinMax processing: Deviations in local pixel values.",
|
| 385 |
-
"
|
| 386 |
]
|
| 387 |
# You could also add descriptions for Wavelet and Bit Plane if they were dynamic outputs
|
| 388 |
# For instance, if wavelet_blocking_noise_estimation had parameters that changed and you wanted to describe them.
|
|
|
|
| 361 |
|
| 362 |
# 6. Perform forensic processing
|
| 363 |
gradient_image = gradient_processing(img_np_og) # Added gradient processing
|
| 364 |
+
gradient_image2 = gradient_processing(img_np_og, int=45, equalize=True) # Added gradient processing
|
| 365 |
+
|
| 366 |
minmax_image = minmax_process(img_np_og) # Added MinMax processing
|
| 367 |
+
minmax_image2 = minmax_process(img_np_og, radius=6) # Added MinMax processing
|
| 368 |
+
# bitplane_image = bit_plane_extractor(img_pil)
|
| 369 |
|
| 370 |
|
| 371 |
# First pass - standard analysis
|
|
|
|
| 375 |
ela2 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=True)
|
| 376 |
ela3 = ELA(img_np_og, quality=75, scale=75, contrast=25, linear=False, grayscale=False)
|
| 377 |
|
| 378 |
+
forensics_images = [img_pil, ela1, ela2, ela3, gradient_image, gradient_image2, minmax_image, minmax_image2]
|
| 379 |
|
| 380 |
# 7. Generate boilerplate descriptions for forensic outputs for anomaly agent
|
| 381 |
forensic_output_descriptions = [
|
|
|
|
| 384 |
"ELA analysis (Pass 2): Grayscale error map, quality 75, enhanced contrast.",
|
| 385 |
"ELA analysis (Pass 3): Color error map, quality 75, enhanced contrast.",
|
| 386 |
"Gradient processing: Highlights edges and transitions.",
|
| 387 |
+
"Gradient processing: Int=45, Equalize=True",
|
| 388 |
"MinMax processing: Deviations in local pixel values.",
|
| 389 |
+
"MinMax processing (Radius=6): Deviations in local pixel values.",
|
| 390 |
]
|
| 391 |
# You could also add descriptions for Wavelet and Bit Plane if they were dynamic outputs
|
| 392 |
# For instance, if wavelet_blocking_noise_estimation had parameters that changed and you wanted to describe them.
|