Mustafa Akcanca commited on
Commit ·
7241695
1
Parent(s): 070b922
Add denoiser prompt
Browse files
src/agents/forensic_agent.py
CHANGED
|
@@ -95,7 +95,7 @@ Available tools:
|
|
| 95 |
- analyze_jpeg_compression: Analyze JPEG compression artifacts and quantization tables
|
| 96 |
- extract_noiseprint: Extract camera model fingerprint features (noiseprint)
|
| 97 |
- analyze_frequency_domain: Analyze DCT/FFT frequency domain features
|
| 98 |
-
- extract_residuals: Extract denoiser residual statistics
|
| 99 |
- perform_ela: Error Level Analysis (recompress + error map for localized inconsistencies)
|
| 100 |
- perform_trufor: AI-driven forgery detection and localization (combines RGB + Noiseprint++ features)
|
| 101 |
- execute_python_code: Execute Python code dynamically for custom analysis (zoom, crop, statistics, etc.)
|
|
|
|
| 95 |
- analyze_jpeg_compression: Analyze JPEG compression artifacts and quantization tables
|
| 96 |
- extract_noiseprint: Extract camera model fingerprint features (noiseprint)
|
| 97 |
- analyze_frequency_domain: Analyze DCT/FFT frequency domain features
|
| 98 |
+
- extract_residuals: Extract denoiser residual statistics using DRUNet (deep learning denoiser). Returns comprehensive statistics including mean, std, skew, kurtosis, and energy metrics. Useful for detecting manipulation, AI generation, or compression artifacts.
|
| 99 |
- perform_ela: Error Level Analysis (recompress + error map for localized inconsistencies)
|
| 100 |
- perform_trufor: AI-driven forgery detection and localization (combines RGB + Noiseprint++ features)
|
| 101 |
- execute_python_code: Execute Python code dynamically for custom analysis (zoom, crop, statistics, etc.)
|
src/tools/forensic/noise_tools.py
CHANGED
|
@@ -321,7 +321,22 @@ def extract_noiseprint(input_str: str) -> str:
|
|
| 321 |
|
| 322 |
def extract_residuals(input_str: str) -> str:
|
| 323 |
"""
|
| 324 |
-
Extract denoiser residual statistics using DRUNet denoiser.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
"""
|
| 326 |
image_path = input_str.strip()
|
| 327 |
try:
|
|
|
|
| 321 |
|
| 322 |
def extract_residuals(input_str: str) -> str:
|
| 323 |
"""
|
| 324 |
+
Extract denoiser residual statistics using DRUNet (deep learning denoiser).
|
| 325 |
+
|
| 326 |
+
This function applies a state-of-the-art neural network denoiser (DRUNet) to the image
|
| 327 |
+
and analyzes the residual patterns. Returns comprehensive statistics including:
|
| 328 |
+
- residual_mean, residual_std: Basic statistics of the residual distribution
|
| 329 |
+
- residual_skew, residual_kurtosis: Higher-order moments indicating distribution shape
|
| 330 |
+
- residual_energy: Overall energy in the residual signal
|
| 331 |
+
- residual_energy_mean, residual_energy_std, residual_energy_p95: Statistics of absolute residuals
|
| 332 |
+
|
| 333 |
+
These statistics can reveal manipulation, AI generation artifacts, or compression inconsistencies.
|
| 334 |
+
|
| 335 |
+
Args:
|
| 336 |
+
input_str: Path to the image file
|
| 337 |
+
|
| 338 |
+
Returns:
|
| 339 |
+
JSON string with status and all residual statistics
|
| 340 |
"""
|
| 341 |
image_path = input_str.strip()
|
| 342 |
try:
|
src/tools/forensic_tools.py
CHANGED
|
@@ -49,8 +49,12 @@ def create_forensic_tools() -> List[Tool]:
|
|
| 49 |
name="extract_residuals",
|
| 50 |
func=extract_residuals,
|
| 51 |
description=(
|
| 52 |
-
"Extract denoiser residual statistics. "
|
| 53 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
"Input format: 'image_path'. Example: 'path/to/image.jpg'"
|
| 55 |
),
|
| 56 |
),
|
|
|
|
| 49 |
name="extract_residuals",
|
| 50 |
func=extract_residuals,
|
| 51 |
description=(
|
| 52 |
+
"Extract denoiser residual statistics using DRUNet (deep learning denoiser). "
|
| 53 |
+
"This tool applies a state-of-the-art neural network denoiser and analyzes the residual patterns. "
|
| 54 |
+
"Returns comprehensive statistics: residual_mean, residual_std, residual_skew, residual_kurtosis, "
|
| 55 |
+
"residual_energy, residual_energy_mean, residual_energy_std, residual_energy_p95. "
|
| 56 |
+
"Use this to detect statistical anomalies in image residuals that may indicate manipulation, "
|
| 57 |
+
"AI generation, or compression artifacts. Higher energy values or unusual distributions may indicate tampering. "
|
| 58 |
"Input format: 'image_path'. Example: 'path/to/image.jpg'"
|
| 59 |
),
|
| 60 |
),
|