verisight 2.2.2__tar.gz → 2.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {verisight-2.2.2/verisight.egg-info → verisight-2.2.4}/PKG-INFO +30 -2
  2. {verisight-2.2.2 → verisight-2.2.4}/README.md +29 -1
  3. {verisight-2.2.2 → verisight-2.2.4}/backend/__init__.py +1 -1
  4. {verisight-2.2.2 → verisight-2.2.4}/backend/agent.py +74 -30
  5. {verisight-2.2.2 → verisight-2.2.4}/backend/forensics.py +31 -2
  6. verisight-2.2.4/backend/generate_real_life_samples.py +292 -0
  7. {verisight-2.2.2 → verisight-2.2.4}/backend/main.py +4 -4
  8. {verisight-2.2.2 → verisight-2.2.4}/backend/mcp_server.py +2 -2
  9. {verisight-2.2.2 → verisight-2.2.4}/pyproject.toml +1 -1
  10. {verisight-2.2.2 → verisight-2.2.4/verisight.egg-info}/PKG-INFO +30 -2
  11. verisight-2.2.2/backend/generate_real_life_samples.py +0 -175
  12. {verisight-2.2.2 → verisight-2.2.4}/LICENSE +0 -0
  13. {verisight-2.2.2 → verisight-2.2.4}/backend/aws_adapter.py +0 -0
  14. {verisight-2.2.2 → verisight-2.2.4}/backend/benchmark_runner.py +0 -0
  15. {verisight-2.2.2 → verisight-2.2.4}/backend/cli.py +0 -0
  16. {verisight-2.2.2 → verisight-2.2.4}/backend/generate_demo_samples.py +0 -0
  17. {verisight-2.2.2 → verisight-2.2.4}/backend/test_mcp_tools.py +0 -0
  18. {verisight-2.2.2 → verisight-2.2.4}/backend/test_sanity.py +0 -0
  19. {verisight-2.2.2 → verisight-2.2.4}/setup.cfg +0 -0
  20. {verisight-2.2.2 → verisight-2.2.4}/verisight.egg-info/SOURCES.txt +0 -0
  21. {verisight-2.2.2 → verisight-2.2.4}/verisight.egg-info/dependency_links.txt +0 -0
  22. {verisight-2.2.2 → verisight-2.2.4}/verisight.egg-info/entry_points.txt +0 -0
  23. {verisight-2.2.2 → verisight-2.2.4}/verisight.egg-info/requires.txt +0 -0
  24. {verisight-2.2.2 → verisight-2.2.4}/verisight.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: verisight
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: Sub-3ms Physical Multi-Spectral Image Forensics & Presentation Attack Detection engine powered by OpenCV 5 and Model Context Protocol (MCP).
5
5
  Author-email: Aditya Raj Tiwari <adityasantosh2026@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -34,6 +34,9 @@ Dynamic: license-file
34
34
  # 🔬 VeriSight MCP — Autonomous Physical AI Visual Forensics Engine
35
35
 
36
36
  [![VeriSight CI](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
37
+ [![PyPI version](https://img.shields.io/pypi/v/verisight.svg?color=blue)](https://pypi.org/project/verisight/)
38
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
39
+ [![mcprush score](https://mcprush.com/badge/verisight-mcp/score.svg)](https://mcprush.com/to/verisight-mcp?ref=badge)
37
40
  [![M8ven Score](https://m8ven.ai/badge/mcp/adityarajtiwari880-verisight-11ohzr?v=5ddb567da1a0cb2e2f12567300d7ff24)](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
38
41
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
39
42
  [![Python Version](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-3776AB?logo=python&logoColor=white)](pyproject.toml)
@@ -43,6 +46,10 @@ Dynamic: license-file
43
46
  [![Next.js 16](https://img.shields.io/badge/Next.js-16.4.3-000000?logo=next.js&logoColor=white)](https://nextjs.org/)
44
47
  [![FastAPI](https://img.shields.io/badge/FastAPI-Production%20Ready-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
45
48
 
49
+ <p align="center">
50
+ <a href="https://mcprush.com/to/verisight-mcp?ref=badge"><img width="380" height="200" src="https://mcprush.com/badge/verisight-mcp/card.svg" alt="VeriSight MCP server" /></a>
51
+ </p>
52
+
46
53
  > **Sub-3ms Physical AI and multi-spectral visual forensics engine built on pure OpenCV 5 and SIMD acceleration.** Detects generative AI inpainting, deepfake manipulation, duplicate photo reuse, and presentation recapture attacks with zero heavyweight neural network dependencies.
47
54
 
48
55
  ---
@@ -165,12 +172,17 @@ verisight server --port 8000
165
172
 
166
173
  VeriSight natively implements the **Anthropic Model Context Protocol (MCP)** specification (`protocol_version: 2024-11-05`). External LLM agents (**Claude Desktop**, **Cursor**, **Windsurf**, **LangChain**) can discover and call VeriSight tools autonomously via high-performance standard I/O (`stdio`).
167
174
 
168
- ### 1-Click Zero-Install (`uvx`)
175
+ ### 1-Click Zero-Install (`uvx` & `claude mcp`)
169
176
  Run directly via Astral `uvx` with zero manual cloning or environment setup:
170
177
  ```bash
171
178
  uvx verisight mcp
172
179
  ```
173
180
 
181
+ Or add directly to **Claude Code CLI**:
182
+ ```bash
183
+ claude mcp add --scope user verisight-mcp '--' uvx verisight mcp
184
+ ```
185
+
174
186
  ### Claude Desktop & Cursor Configuration
175
187
 
176
188
  Add VeriSight directly to your `claude_desktop_config.json` (or Cursor MCP settings):
@@ -278,6 +290,19 @@ Executing 100 continuous perception-decision pipeline frames...
278
290
 
279
291
  ---
280
292
 
293
+ ### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
294
+
295
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
296
+
297
+ Evaluate VeriSight against real-world camera photographs, spliced manipulations, and generative AI inpaintings directly in the cloud with **0 KB local disk usage**:
298
+
299
+ * **Interactive Notebook:** [`benchmarks/verisight_forensic_benchmark.ipynb`](benchmarks/verisight_forensic_benchmark.ipynb)
300
+ * **Headless Evaluation Script:** [`benchmarks/run_colab_benchmark.py`](benchmarks/run_colab_benchmark.py)
301
+ * **Streaming Architecture:** Images are fetched in-memory (`RAM-only`) from standard vision corpuses (COCO, Open Images, OpenCV test suites) and evaluated on-the-fly without saving any image files to disk.
302
+ * **Metrics Generated:** Confusion Matrix, Precision, Recall, Specificity, F1-Score, Processing Latency, and ROC Curve.
303
+
304
+ ---
305
+
281
306
  ## 📁 Repository Structure
282
307
 
283
308
  ```
@@ -286,6 +311,9 @@ verisight/
286
311
  │ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
287
312
  │ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
288
313
  │ └── PULL_REQUEST_TEMPLATE.md # Contributor review standards
314
+ ├── benchmarks/ # 1-Click cloud benchmark suite (Colab / RAM streaming)
315
+ │ ├── run_colab_benchmark.py # Headless streaming evaluator
316
+ │ └── verisight_forensic_benchmark.ipynb # Interactive notebook with confusion heatmaps
289
317
  ├── backend/
290
318
  │ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
291
319
  │ ├── cli.py # Terminal CLI entry point (verisight command)
@@ -1,6 +1,9 @@
1
1
  # 🔬 VeriSight MCP — Autonomous Physical AI Visual Forensics Engine
2
2
 
3
3
  [![VeriSight CI](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/verisight.svg?color=blue)](https://pypi.org/project/verisight/)
5
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
6
+ [![mcprush score](https://mcprush.com/badge/verisight-mcp/score.svg)](https://mcprush.com/to/verisight-mcp?ref=badge)
4
7
  [![M8ven Score](https://m8ven.ai/badge/mcp/adityarajtiwari880-verisight-11ohzr?v=5ddb567da1a0cb2e2f12567300d7ff24)](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
5
8
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6
9
  [![Python Version](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-3776AB?logo=python&logoColor=white)](pyproject.toml)
@@ -10,6 +13,10 @@
10
13
  [![Next.js 16](https://img.shields.io/badge/Next.js-16.4.3-000000?logo=next.js&logoColor=white)](https://nextjs.org/)
11
14
  [![FastAPI](https://img.shields.io/badge/FastAPI-Production%20Ready-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
12
15
 
16
+ <p align="center">
17
+ <a href="https://mcprush.com/to/verisight-mcp?ref=badge"><img width="380" height="200" src="https://mcprush.com/badge/verisight-mcp/card.svg" alt="VeriSight MCP server" /></a>
18
+ </p>
19
+
13
20
  > **Sub-3ms Physical AI and multi-spectral visual forensics engine built on pure OpenCV 5 and SIMD acceleration.** Detects generative AI inpainting, deepfake manipulation, duplicate photo reuse, and presentation recapture attacks with zero heavyweight neural network dependencies.
14
21
 
15
22
  ---
@@ -132,12 +139,17 @@ verisight server --port 8000
132
139
 
133
140
  VeriSight natively implements the **Anthropic Model Context Protocol (MCP)** specification (`protocol_version: 2024-11-05`). External LLM agents (**Claude Desktop**, **Cursor**, **Windsurf**, **LangChain**) can discover and call VeriSight tools autonomously via high-performance standard I/O (`stdio`).
134
141
 
135
- ### 1-Click Zero-Install (`uvx`)
142
+ ### 1-Click Zero-Install (`uvx` & `claude mcp`)
136
143
  Run directly via Astral `uvx` with zero manual cloning or environment setup:
137
144
  ```bash
138
145
  uvx verisight mcp
139
146
  ```
140
147
 
148
+ Or add directly to **Claude Code CLI**:
149
+ ```bash
150
+ claude mcp add --scope user verisight-mcp '--' uvx verisight mcp
151
+ ```
152
+
141
153
  ### Claude Desktop & Cursor Configuration
142
154
 
143
155
  Add VeriSight directly to your `claude_desktop_config.json` (or Cursor MCP settings):
@@ -245,6 +257,19 @@ Executing 100 continuous perception-decision pipeline frames...
245
257
 
246
258
  ---
247
259
 
260
+ ### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
261
+
262
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
263
+
264
+ Evaluate VeriSight against real-world camera photographs, spliced manipulations, and generative AI inpaintings directly in the cloud with **0 KB local disk usage**:
265
+
266
+ * **Interactive Notebook:** [`benchmarks/verisight_forensic_benchmark.ipynb`](benchmarks/verisight_forensic_benchmark.ipynb)
267
+ * **Headless Evaluation Script:** [`benchmarks/run_colab_benchmark.py`](benchmarks/run_colab_benchmark.py)
268
+ * **Streaming Architecture:** Images are fetched in-memory (`RAM-only`) from standard vision corpuses (COCO, Open Images, OpenCV test suites) and evaluated on-the-fly without saving any image files to disk.
269
+ * **Metrics Generated:** Confusion Matrix, Precision, Recall, Specificity, F1-Score, Processing Latency, and ROC Curve.
270
+
271
+ ---
272
+
248
273
  ## 📁 Repository Structure
249
274
 
250
275
  ```
@@ -253,6 +278,9 @@ verisight/
253
278
  │ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
254
279
  │ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
255
280
  │ └── PULL_REQUEST_TEMPLATE.md # Contributor review standards
281
+ ├── benchmarks/ # 1-Click cloud benchmark suite (Colab / RAM streaming)
282
+ │ ├── run_colab_benchmark.py # Headless streaming evaluator
283
+ │ └── verisight_forensic_benchmark.ipynb # Interactive notebook with confusion heatmaps
256
284
  ├── backend/
257
285
  │ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
258
286
  │ ├── cli.py # Terminal CLI entry point (verisight command)
@@ -30,7 +30,7 @@ from forensics import (
30
30
  tool_perceptual_hash
31
31
  )
32
32
 
33
- __version__ = "2.2.2"
33
+ __version__ = "2.2.4"
34
34
  __author__ = "Aditya Raj Tiwari"
35
35
  __license__ = "Apache-2.0"
36
36
 
@@ -38,7 +38,7 @@ class ForensicAgent:
38
38
  JPEG Ghost Sweeper, and PRNU Sensor Noise.
39
39
  """
40
40
  def __init__(self):
41
- self.version = "2.2.2"
41
+ self.version = "2.2.4"
42
42
 
43
43
  def run_investigation(
44
44
  self,
@@ -440,54 +440,98 @@ class ForensicAgent:
440
440
  # -------------------------------------------------------------
441
441
  clusters_detected = ela_meta.get("clusters_detected", 0)
442
442
  rx, ry, rw, rh = roi
443
- is_full_frame = (rw > 0.65 * working_dim[0] and rh > 0.65 * working_dim[1])
444
- has_isolated_cluster = not is_full_frame and (clusters_detected > 0) and (ela_score > 25.0)
443
+ roi_area = rw * rh
444
+ frame_area = working_dim[0] * working_dim[1]
445
+ is_full_frame = (rw > 0.70 * working_dim[0] and rh > 0.70 * working_dim[1]) or (roi_area > 0.55 * frame_area)
446
+ has_isolated_cluster = not is_full_frame and (clusters_detected > 0) and (ela_score > 25.0) and ela_meta.get("has_isolated_cluster", True)
445
447
 
446
- # Generative AI detection:
447
- # Detects diffusion micro-fringing, synthetic sensor voids, or lattice harmonics
448
- is_generative_ai = (
449
- (cr_sobel_std >= 6.0 and ela_score >= 35.0) or
450
- (sensor_noise_std < 1.15 and ela_score >= 30.0) or
451
- (harmonic_ratio >= 2.8 and fft_energy >= 85.0 and ela_score >= 38.0)
452
- )
448
+ # Natural Camera vs Document / Synthetic Domain Differentiation:
449
+ # In natural camera photos (damaged items, vehicles, nature, people), natural optical color transitions
450
+ # produce high whole-frame chrominance variance that must not be confused with generative AI fringing.
451
+ # In documents/vouchers, paper is predominantly monochrome/duotone so character editing creates high chrominance spikes.
452
+ is_doc_or_voucher = any(
453
+ k in claim_type.lower() for k in ["voucher", "coupon", "bill", "invoice", "receipt", "document", "tax"]
454
+ ) or (scene_triage.get("has_document_structure", False) and scene_triage.get("text_lines_count", 0) >= 15 and not scene_triage.get("face_detected", False))
453
455
 
454
- # Multi-modal concordance: Requires corroboration from multiple orthogonal forensic probes
455
- has_corroboration = (
456
- is_feathered or
457
- (ghost_discrepancy >= 0.8) or
458
- (noise_divergence >= 45.0 and ela_score >= 25.0) or
459
- (ela_score >= 68.0) or
460
- is_generative_ai or
461
- provenance.get("is_edited_software_flag", False)
462
- )
456
+ # Generative AI detection & Corroboration:
457
+ if is_doc_or_voucher:
458
+ is_generative_ai = (
459
+ (cr_sobel_std >= 6.0 and ela_score >= 35.0 and has_isolated_cluster) or
460
+ (sensor_noise_std < 1.15 and ela_score >= 30.0) or
461
+ (harmonic_ratio >= 2.8 and fft_energy >= 85.0 and ela_score >= 38.0) or
462
+ (ghost_discrepancy >= 1.25 and noise_divergence >= 35.0 and has_isolated_cluster) or
463
+ (is_feathered and has_isolated_cluster)
464
+ )
465
+ has_corroboration = (
466
+ is_feathered or
467
+ (ghost_discrepancy >= 1.25 and ela_score >= 30.0) or
468
+ (noise_divergence >= 45.0 and ela_score >= 35.0) or
469
+ is_generative_ai or
470
+ provenance.get("is_edited_software_flag", False)
471
+ )
472
+ else:
473
+ # Natural camera scenes: Corroboration strictly requires orthogonal physical concurrence.
474
+ # Natural camera optical edges and high-contrast scene features produce elevated ELA scores
475
+ # that must NEVER be flagged as tampering unless physically corroborated by independent probes.
476
+ has_ghost_mismatch = (
477
+ (abs(ghost_meta.get("optimal_roi_quality", 0) - ghost_meta.get("optimal_bg_quality", 0)) >= 4) or
478
+ (ghost_discrepancy >= 1.60 and chrom_diff >= 45.0)
479
+ )
480
+ pillar_ghost = (has_ghost_mismatch and ela_score >= 30.0 and has_isolated_cluster)
481
+ pillar_noise = (noise_divergence >= 50.0 and (has_ghost_mismatch or is_feathered or sensor_noise_std < 1.15) and has_isolated_cluster)
482
+ pillar_ghost_noise = (
483
+ ((has_ghost_mismatch and noise_divergence >= 35.0) or
484
+ (ghost_discrepancy >= 1.30 and noise_divergence >= 65.0 and ela_score >= 40.0 and (rw >= 45 and rh >= 45)))
485
+ and has_isolated_cluster
486
+ )
487
+ pillar_seam = (is_feathered and has_isolated_cluster)
488
+ pillar_spectral = (harmonic_ratio >= 2.6 and fft_energy >= 82.0 and has_isolated_cluster)
489
+ pillar_sensor_void = (sensor_noise_std < 1.15 and noise_divergence >= 30.0 and ela_score >= 26.0 and has_isolated_cluster)
490
+
491
+ is_generative_ai = (
492
+ pillar_spectral or
493
+ pillar_seam or
494
+ pillar_sensor_void or
495
+ (pillar_noise and (has_ghost_mismatch or is_feathered))
496
+ )
497
+ has_corroboration = (
498
+ pillar_seam or
499
+ pillar_ghost or
500
+ pillar_noise or
501
+ pillar_ghost_noise or
502
+ pillar_spectral or
503
+ pillar_sensor_void or
504
+ is_generative_ai or
505
+ provenance.get("is_edited_software_flag", False)
506
+ )
463
507
 
464
508
  # 1. Calibrated ELA contribution:
465
509
  # Organic cameras: ELA <= 20 (contrib 0-5%)
466
- # Moderate recompression: ELA 20-35 (contrib 5-32%)
467
- # Corroborated inpainting: ELA > 35 (contrib 32-75%)
468
- # Uncorroborated document text/graphics: capped at 18% to avoid false positives
510
+ # Moderate recompression: ELA 20-35 (contrib 5-27%)
511
+ # Corroborated inpainting: ELA > 35 (contrib 28-75%)
512
+ # Uncorroborated natural optical edges / texture: capped safely at 16%
469
513
  if ela_score <= 20.0:
470
514
  ela_contrib = max(0.0, (ela_score - 14.0) * 0.8)
471
515
  elif ela_score <= 35.0:
472
- ela_contrib = 5.0 + (ela_score - 20.0) * 1.8
516
+ ela_contrib = 5.0 + (ela_score - 20.0) * 1.5
473
517
  else:
474
- if has_corroboration:
475
- ela_contrib = 32.0 + (ela_score - 35.0) * 2.2
518
+ if has_corroboration and has_isolated_cluster:
519
+ ela_contrib = 28.0 + (ela_score - 35.0) * 1.8
476
520
  else:
477
- ela_contrib = min(18.0, 5.0 + (ela_score - 20.0) * 0.50)
521
+ ela_contrib = min(16.0, 5.0 + (ela_score - 20.0) * 0.35)
478
522
 
479
523
  # 2. Diffusion / Generative AI Spectral penalty:
480
524
  diffusion_contrib = 30.0 if is_generative_ai else 0.0
481
525
 
482
526
  # 3. Chrominance & Multi-probe contributions:
483
- if has_corroboration:
484
- chrom_contrib = min(40.0, max(0.0, (chrom_diff - 25.0) * 0.45)) if has_isolated_cluster else 0.0
527
+ if has_corroboration and has_isolated_cluster:
528
+ chrom_contrib = min(35.0, max(0.0, (chrom_diff - 25.0) * 0.45))
485
529
  else:
486
- chrom_contrib = min(6.0, max(0.0, (chrom_diff - 25.0) * 0.10)) if has_isolated_cluster else 0.0
530
+ chrom_contrib = min(5.0, max(0.0, (chrom_diff - 25.0) * 0.08)) if has_isolated_cluster else 0.0
487
531
 
488
532
  noise_contrib = max(0.0, (noise_divergence - 70.0) * 0.35) if (has_isolated_cluster and has_corroboration) else 0.0
489
533
  ghost_contrib = max(0.0, (ghost_discrepancy - 0.8) * 6.0) if (has_isolated_cluster and has_corroboration) else 0.0
490
- seam_contrib = 22.0 if (is_feathered and has_isolated_cluster) else 0.0
534
+ seam_contrib = 25.0 if (is_feathered and has_isolated_cluster) else 0.0
491
535
  software_contrib = 35.0 if provenance.get("is_edited_software_flag") else 0.0
492
536
 
493
537
  # Sensitivity modifier
@@ -173,6 +173,33 @@ def tool_global_ela_scan(img: np.ndarray, quality: int = 90) -> Tuple[np.ndarray
173
173
 
174
174
  # Prioritize genuine interior content anomalies over peripheral screenshot/crop frame borders
175
175
  pool = interior_candidates if interior_candidates else all_candidates
176
+
177
+ # If no candidate was isolated (e.g. background fused into full-frame blob),
178
+ # run a second pass with a higher selective percentile threshold to isolate the peak core
179
+ if not pool:
180
+ dyn_thresh_high = max(28, int(p95 * 0.88))
181
+ _, thresh_high = cv2.threshold(blurred, dyn_thresh_high, 255, cv2.THRESH_BINARY)
182
+ closed_high = cv2.morphologyEx(thresh_high, cv2.MORPH_CLOSE, kernel)
183
+ contours_high, _ = cv2.findContours(closed_high, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
184
+ for cnt in contours_high:
185
+ area = cv2.contourArea(cnt)
186
+ if area < min_area_thresh:
187
+ continue
188
+ x, y, cw, ch = cv2.boundingRect(cnt)
189
+ if (cw > 0.70 * w and ch > 0.70 * h) or area > 0.45 * total_frame_area:
190
+ continue
191
+ mask_cnt = np.zeros(blurred.shape, dtype=np.uint8)
192
+ cv2.drawContours(mask_cnt, [cnt], -1, 255, -1)
193
+ cnt_p95 = float(np.percentile(blurred[mask_cnt > 0], 95)) if np.any(mask_cnt > 0) else 0.0
194
+ score = cnt_p95 * np.log10(area + 10.0)
195
+ is_border = (x <= margin_x) or (y <= margin_y) or (x + cw >= w - margin_x) or (y + ch >= h - margin_y)
196
+ cand = (score, x, y, cw, ch)
197
+ all_candidates.append(cand)
198
+ if not is_border:
199
+ interior_candidates.append(cand)
200
+ pool = interior_candidates if interior_candidates else all_candidates
201
+
202
+ cluster_isolated = bool(pool)
176
203
  if pool:
177
204
  pool.sort(key=lambda item: item[0], reverse=True)
178
205
  score, x, y, cw, ch = pool[0]
@@ -197,7 +224,8 @@ def tool_global_ela_scan(img: np.ndarray, quality: int = 90) -> Tuple[np.ndarray
197
224
  return ela_heatmap, suspect_roi, round(anomaly_score, 2), {
198
225
  "roi": suspect_roi,
199
226
  "ela_p95_score": round(anomaly_score, 2),
200
- "clusters_detected": len(contours),
227
+ "clusters_detected": len(pool) if pool else len(contours),
228
+ "has_isolated_cluster": cluster_isolated,
201
229
  "dyn_thresh_used": dyn_thresh,
202
230
  "edge_compensation_active": True,
203
231
  "latency_ms": elapsed_ms
@@ -600,7 +628,8 @@ def tool_micro_roi_seam_inspection(img: np.ndarray, roi: List[int]) -> Dict[str,
600
628
  interior_std = float(np.std(lap_mag[interior_mask > 0])) if np.sum(interior_mask) > 0 else 1.0
601
629
 
602
630
  ratio = round(seam_std / max(interior_std, 0.01), 2)
603
- is_feathered = ratio > 1.85 or ratio < 0.35
631
+ # Generative AI inpainting feathering produces elevated Laplacian boundary variance discontinuity along the perimeter seam
632
+ is_feathered = ratio > 1.85
604
633
 
605
634
  # Overlay glowing border and heatmap on super-resolved crop
606
635
  colored_lap = cv2.applyColorMap(lap_mag, cv2.COLORMAP_MAGMA)
@@ -0,0 +1,292 @@
1
+ """
2
+ VeriSight MCP - Real-Life Forensic Sample Generator
3
+ Generates realistic real-world photos with genuine camera sensor noise, optical textures,
4
+ and authentic generative AI inpainting artifacts for competition demonstration.
5
+ """
6
+
7
+ import cv2
8
+ import numpy as np
9
+ import os
10
+
11
+ OUTPUT_DIR = os.path.dirname(__file__)
12
+
13
+ def generate_strawberry_mold_claim():
14
+ """Real-world Quick-Commerce case: Fresh strawberries with AI-inpainted rotten fungal patch."""
15
+ w, h = 800, 600
16
+ img = np.full((h, w, 3), (180, 205, 220), dtype=np.uint8)
17
+ rng = np.random.default_rng(2026)
18
+
19
+ grain = rng.normal(0, 5, img.shape).astype(np.int16)
20
+ img = np.clip(img.astype(np.int16) + grain, 0, 255).astype(np.uint8)
21
+
22
+ cv2.rectangle(img, (140, 80), (660, 520), (160, 185, 200), 2)
23
+ cv2.putText(img, "BLINKIT FRESH - LOT #90412 (FRESH STRAWBERRIES 250G)", (160, 115),
24
+ cv2.FONT_HERSHEY_SIMPLEX, 0.55, (80, 100, 120), 2)
25
+
26
+ centers = [(280, 260), (420, 240), (520, 300), (340, 380), (480, 400)]
27
+ for cx, cy in centers:
28
+ cv2.ellipse(img, (cx, cy), (65, 80), 15, 0, 360, (25, 30, 205), -1)
29
+ for sx in range(cx - 45, cx + 45, 14):
30
+ for sy in range(cy - 55, cy + 55, 14):
31
+ if ((sx - cx)/45)**2 + ((sy - cy)/55)**2 < 0.8:
32
+ cv2.circle(img, (sx + int(rng.integers(-2, 3)), sy), 2, (60, 180, 240), -1)
33
+ cv2.circle(img, (cx, cy - 70), 18, (45, 145, 55), -1)
34
+
35
+ base_path = os.path.join(OUTPUT_DIR, "real_strawberries_base.jpg")
36
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 85])
37
+
38
+ tampered = cv2.imread(base_path)
39
+ rx, ry, rw, rh = 360, 200, 180, 160
40
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
41
+
42
+ cv2.ellipse(patch, (90, 80), (60, 50), -10, 0, 360, (75, 95, 85), -1)
43
+ cv2.ellipse(patch, (90, 80), (40, 32), -10, 0, 360, (140, 160, 150), -1)
44
+
45
+ y_g, x_g = np.indices((rh, rw))
46
+ grid = ((np.sin(x_g * 0.5) * np.cos(y_g * 0.5)) * 16).astype(np.int16)
47
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
48
+ patch[:, :, 1] = np.clip(patch[:, :, 1].astype(np.int16) + grid, 0, 255).astype(np.uint8)
49
+
50
+ mask = np.zeros((rh, rw), dtype=np.float32)
51
+ cv2.ellipse(mask, (90, 80), (68, 56), -10, 0, 360, 1.0, -1)
52
+ mask = cv2.GaussianBlur(mask, (21, 21), 0)[:, :, np.newaxis]
53
+
54
+ blended = (patch * mask + tampered[ry:ry+rh, rx:rx+rw] * (1.0 - mask)).astype(np.uint8)
55
+ tampered[ry:ry+rh, rx:rx+rw] = blended
56
+
57
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_strawberries_inpainted.jpg")
58
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
59
+ print(f"Generated: {final_path}")
60
+
61
+ def generate_invoice_tampering_claim():
62
+ """Real-world Receipt case: Delivery receipt with inpainted fake date & inflated refund amount."""
63
+ w, h = 800, 600
64
+ img = np.full((h, w, 3), (242, 246, 248), dtype=np.uint8)
65
+ rng = np.random.default_rng(404)
66
+ paper_texture = rng.normal(0, 3, img.shape).astype(np.int16)
67
+ img = np.clip(img.astype(np.int16) + paper_texture, 0, 255).astype(np.uint8)
68
+
69
+ cv2.rectangle(img, (180, 40), (620, 560), (200, 210, 215), 2)
70
+ cv2.putText(img, "ZEPTO HYPERLOCAL - TAX INVOICE", (210, 85), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (30, 40, 50), 2)
71
+ cv2.line(img, (200, 105), (600, 105), (180, 190, 200), 2)
72
+
73
+ cv2.putText(img, "ORDER ID: ZEP-994102-OCT", (210, 140), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
74
+ cv2.putText(img, "DATE: 2026-10-18 19:42 IST", (210, 170), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
75
+ cv2.putText(img, "CUSTOMER: Rahul Sharma", (210, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
76
+ cv2.line(img, (200, 220), (600, 220), (180, 190, 200), 1)
77
+
78
+ items = [
79
+ ("1x Organic Alphonso Mangoes", "Rs 650.00"),
80
+ ("2x Artisanal Greek Yogurt", "Rs 280.00"),
81
+ ("1x Cold Pressed Olive Oil", "Rs 520.00"),
82
+ ("Delivery & Platform Fee", "Rs 45.00")
83
+ ]
84
+ y_pos = 260
85
+ for name, price in items:
86
+ cv2.putText(img, name, (210, y_pos), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (50, 60, 70), 1)
87
+ cv2.putText(img, price, (500, y_pos), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (50, 60, 70), 1)
88
+ y_pos += 35
89
+
90
+ cv2.line(img, (200, y_pos + 10), (600, y_pos + 10), (180, 190, 200), 2)
91
+ cv2.putText(img, "TOTAL AMOUNT: Rs 1,495.00", (210, y_pos + 45), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (20, 30, 40), 2)
92
+
93
+ base_path = os.path.join(OUTPUT_DIR, "real_invoice_base.jpg")
94
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 84])
95
+
96
+ tampered = cv2.imread(base_path)
97
+ rx, ry, rw, rh = 380, y_pos + 15, 210, 50
98
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
99
+
100
+ cv2.rectangle(patch, (10, 5), (195, 42), (242, 246, 248), -1)
101
+ cv2.putText(patch, "Rs 5,980.00", (15, 32), cv2.FONT_HERSHEY_SIMPLEX, 0.72, (20, 25, 35), 2)
102
+
103
+ noise = rng.normal(0, 1.2, patch.shape).astype(np.int16)
104
+ patch = np.clip(patch.astype(np.int16) + noise, 0, 255).astype(np.uint8)
105
+ tampered[ry:ry+rh, rx:rx+rw] = patch
106
+
107
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_invoice_tampered.jpg")
108
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 97])
109
+ print(f"Generated: {final_path}")
110
+
111
+ def generate_car_bumper_dent_claim():
112
+ """Real-world Auto Insurance case: Intact car bumper with generative AI dent/scratch."""
113
+ w, h = 800, 600
114
+ img = np.full((h, w, 3), (195, 205, 212), dtype=np.uint8)
115
+ cv2.ellipse(img, (400, 650), (450, 350), 0, 0, 180, (160, 175, 185), 6)
116
+ cv2.line(img, (50, 420), (750, 420), (145, 155, 165), 3)
117
+
118
+ cv2.rectangle(img, (310, 440), (490, 510), (235, 240, 245), -1)
119
+ cv2.rectangle(img, (310, 440), (490, 510), (30, 40, 50), 2)
120
+ cv2.putText(img, "DL 01 AB 8842", (325, 485), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (20, 30, 40), 2)
121
+
122
+ base_path = os.path.join(OUTPUT_DIR, "real_car_base.jpg")
123
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 86])
124
+
125
+ tampered = cv2.imread(base_path)
126
+ rx, ry, rw, rh = 180, 220, 180, 150
127
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
128
+
129
+ cv2.ellipse(patch, (90, 75), (65, 45), -25, 0, 360, (70, 80, 88), -1)
130
+ cv2.ellipse(patch, (90, 75), (45, 30), -25, 0, 360, (40, 48, 55), -1)
131
+ cv2.line(patch, (40, 50), (140, 95), (25, 28, 30), 3)
132
+ cv2.line(patch, (55, 75), (120, 110), (25, 28, 30), 2)
133
+
134
+ y_g, x_g = np.indices((rh, rw))
135
+ grid = ((np.sin(x_g * 0.4) + np.cos(y_g * 0.4)) * 12).astype(np.int16)
136
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
137
+
138
+ tampered[ry:ry+rh, rx:rx+rw] = patch
139
+
140
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_car_bumper_dent.jpg")
141
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
142
+ print(f"Generated: {final_path}")
143
+
144
+ def generate_puncture_box_claim():
145
+ """Real-world Logistics case: Crushed/punctured shipping carton claim."""
146
+ w, h = 800, 600
147
+ img = np.full((h, w, 3), (135, 170, 200), dtype=np.uint8)
148
+ rng = np.random.default_rng(101)
149
+ img = np.clip(img.astype(np.int16) + rng.normal(0, 4, img.shape).astype(np.int16), 0, 255).astype(np.uint8)
150
+ cv2.rectangle(img, (140, 80), (660, 520), (105, 140, 170), 3)
151
+ cv2.putText(img, "AMAZON LOGISTICS - AIRWAY BILL #99214", (160, 120), cv2.FONT_HERSHEY_SIMPLEX, 0.55, (60, 80, 100), 2)
152
+
153
+ base_path = os.path.join(OUTPUT_DIR, "real_box_base.jpg")
154
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 84])
155
+
156
+ tampered = cv2.imread(base_path)
157
+ rx, ry, rw, rh = 320, 240, 180, 160
158
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
159
+ cv2.ellipse(patch, (90, 80), (55, 45), 20, 0, 360, (25, 30, 35), -1)
160
+ cv2.ellipse(patch, (90, 80), (65, 55), 20, 0, 360, (80, 110, 135), 4)
161
+ y_g, x_g = np.indices((rh, rw))
162
+ grid = ((np.sin(x_g * 0.45) * np.cos(y_g * 0.45)) * 16).astype(np.int16)
163
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
164
+ mask = np.zeros((rh, rw), dtype=np.float32)
165
+ cv2.ellipse(mask, (90, 80), (68, 58), 20, 0, 360, 1.0, -1)
166
+ mask = cv2.GaussianBlur(mask, (15, 15), 0)[:, :, np.newaxis]
167
+ tampered[ry:ry+rh, rx:rx+rw] = (patch * mask + tampered[ry:ry+rh, rx:rx+rw] * (1.0 - mask)).astype(np.uint8)
168
+
169
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_delivery_box_puncture.jpg")
170
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
171
+ print(f"Generated: {final_path}")
172
+
173
+ def generate_windshield_crack_claim():
174
+ """Real-world Auto Glass case: Inpainted bullseye impact crack on car windshield."""
175
+ w, h = 800, 600
176
+ img = np.full((h, w, 3), (120, 135, 140), dtype=np.uint8)
177
+ cv2.line(img, (100, 500), (700, 500), (40, 45, 50), 6)
178
+
179
+ base_path = os.path.join(OUTPUT_DIR, "real_windshield_base.jpg")
180
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 85])
181
+
182
+ tampered = cv2.imread(base_path)
183
+ rx, ry, rw, rh = 300, 180, 200, 180
184
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
185
+ cv2.circle(patch, (100, 90), 18, (230, 240, 245), -1)
186
+ for angle in np.linspace(0, 2*np.pi, 10, endpoint=False):
187
+ x2 = int(100 + 85 * np.cos(angle))
188
+ y2 = int(90 + 85 * np.sin(angle))
189
+ cv2.line(patch, (100, 90), (x2, y2), (210, 225, 235), 2)
190
+ y_g, x_g = np.indices((rh, rw))
191
+ grid = ((np.sin(x_g * 0.45) * np.cos(y_g * 0.45)) * 16).astype(np.int16)
192
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
193
+ mask = np.zeros((rh, rw), dtype=np.float32)
194
+ cv2.ellipse(mask, (100, 90), (90, 80), 0, 0, 360, 1.0, -1)
195
+ mask = cv2.GaussianBlur(mask, (15, 15), 0)[:, :, np.newaxis]
196
+ tampered[ry:ry+rh, rx:rx+rw] = (patch * mask + tampered[ry:ry+rh, rx:rx+rw] * (1.0 - mask)).astype(np.uint8)
197
+
198
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_cracked_windshield.jpg")
199
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
200
+ print(f"Generated: {final_path}")
201
+
202
+ def generate_spoiled_milk_claim():
203
+ """Real-world Dairy Grocery case: Inpainted curdled green mold in milk carton."""
204
+ w, h = 800, 600
205
+ img = np.full((h, w, 3), (210, 215, 220), dtype=np.uint8)
206
+ cv2.rectangle(img, (260, 100), (540, 520), (180, 190, 200), 2)
207
+ cv2.putText(img, "AMUL TAZA TONED MILK 1L", (280, 150), cv2.FONT_HERSHEY_SIMPLEX, 0.55, (50, 70, 90), 2)
208
+
209
+ base_path = os.path.join(OUTPUT_DIR, "real_milk_base.jpg")
210
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 85])
211
+
212
+ tampered = cv2.imread(base_path)
213
+ rx, ry, rw, rh = 300, 240, 200, 180
214
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
215
+ cv2.ellipse(patch, (100, 90), (60, 50), -15, 0, 360, (50, 90, 70), -1)
216
+ cv2.ellipse(patch, (100, 90), (40, 30), -15, 0, 360, (90, 140, 110), -1)
217
+ y_g, x_g = np.indices((rh, rw))
218
+ grid = ((np.sin(x_g * 0.45) * np.cos(y_g * 0.45)) * 16).astype(np.int16)
219
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
220
+ mask = np.zeros((rh, rw), dtype=np.float32)
221
+ cv2.ellipse(mask, (100, 90), (70, 60), -15, 0, 360, 1.0, -1)
222
+ mask = cv2.GaussianBlur(mask, (15, 15), 0)[:, :, np.newaxis]
223
+ tampered[ry:ry+rh, rx:rx+rw] = (patch * mask + tampered[ry:ry+rh, rx:rx+rw] * (1.0 - mask)).astype(np.uint8)
224
+
225
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_spoiled_milk_mold.jpg")
226
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
227
+ print(f"Generated: {final_path}")
228
+
229
+ def generate_prescription_alteration_claim():
230
+ """Real-world Medical Claim case: Digitally altered prescription dosage quantity."""
231
+ w, h = 800, 600
232
+ img = np.full((h, w, 3), (245, 248, 250), dtype=np.uint8)
233
+ cv2.rectangle(img, (180, 50), (620, 550), (210, 220, 225), 2)
234
+ cv2.putText(img, "APOLLO HOSPITALS - OUTPATIENT RX", (210, 95), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (40, 50, 60), 2)
235
+ cv2.line(img, (200, 115), (600, 115), (180, 190, 200), 2)
236
+ cv2.putText(img, "PATIENT: Ananya Gupta", (210, 150), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
237
+ cv2.putText(img, "1. Amoxicillin 500mg - Qty: 10 Tabs", (210, 220), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (40, 50, 60), 1)
238
+ cv2.putText(img, "2. Paracetamol 650mg - Qty: 15 Tabs", (210, 270), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (40, 50, 60), 1)
239
+ cv2.putText(img, "TOTAL PHARMACY BILL: Rs 480.00", (210, 360), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (30, 40, 50), 2)
240
+
241
+ base_path = os.path.join(OUTPUT_DIR, "real_rx_base.jpg")
242
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 84])
243
+
244
+ tampered = cv2.imread(base_path)
245
+ rx, ry, rw, rh = 440, 330, 160, 45
246
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
247
+ cv2.rectangle(patch, (5, 5), (150, 40), (245, 248, 250), -1)
248
+ cv2.putText(patch, "Rs 2,480.00", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (20, 25, 30), 2)
249
+ tampered[ry:ry+rh, rx:rx+rw] = patch
250
+
251
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_altered_prescription.jpg")
252
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 97])
253
+ print(f"Generated: {final_path}")
254
+
255
+ def generate_broken_phone_screen_claim():
256
+ """Real-world Electronics Warranty case: Inpainted shattered spiderweb crack on OLED screen."""
257
+ w, h = 800, 600
258
+ img = np.full((h, w, 3), (35, 40, 42), dtype=np.uint8)
259
+ cv2.rectangle(img, (220, 50), (580, 550), (15, 18, 20), -1)
260
+ cv2.rectangle(img, (240, 80), (560, 520), (50, 75, 95), -1)
261
+ cv2.putText(img, "12:45", (350, 150), cv2.FONT_HERSHEY_SIMPLEX, 1.2, (220, 230, 240), 2)
262
+
263
+ base_path = os.path.join(OUTPUT_DIR, "real_phone_base.jpg")
264
+ cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 84])
265
+
266
+ tampered = cv2.imread(base_path)
267
+ rx, ry, rw, rh = 280, 200, 240, 220
268
+ patch = tampered[ry:ry+rh, rx:rx+rw].copy()
269
+ cv2.circle(patch, (120, 110), 12, (240, 245, 255), -1)
270
+ for angle in np.linspace(0, 2*np.pi, 8, endpoint=False):
271
+ x2 = int(120 + 95 * np.cos(angle))
272
+ y2 = int(110 + 95 * np.sin(angle))
273
+ cv2.line(patch, (120, 110), (x2, y2), (220, 230, 245), 2)
274
+ y_g, x_g = np.indices((rh, rw))
275
+ grid = (np.sin(x_g * 0.45) * 18).astype(np.int16)
276
+ patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
277
+ tampered[ry:ry+rh, rx:rx+rw] = patch
278
+
279
+ final_path = os.path.join(OUTPUT_DIR, "sample_real_broken_screen_phone.jpg")
280
+ cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
281
+ print(f"Generated: {final_path}")
282
+
283
+ if __name__ == "__main__":
284
+ generate_strawberry_mold_claim()
285
+ generate_invoice_tampering_claim()
286
+ generate_car_bumper_dent_claim()
287
+ generate_puncture_box_claim()
288
+ generate_windshield_crack_claim()
289
+ generate_spoiled_milk_claim()
290
+ generate_prescription_alteration_claim()
291
+ generate_broken_phone_screen_claim()
292
+ print("All 8 real-life forensic samples successfully created!")
@@ -31,7 +31,7 @@ from mcp_server import MCP_TOOLS_MANIFEST, handle_json_rpc
31
31
  app = FastAPI(
32
32
  title="VeriSight MCP - OpenCV 5 Agentic Forensics Engine",
33
33
  description="Multi-spectral forensic vision agent powered by OpenCV 5 on AWS Graviton Arm64",
34
- version="2.2.2"
34
+ version="2.2.4"
35
35
  )
36
36
 
37
37
  app.add_middleware(
@@ -47,7 +47,7 @@ def root_status():
47
47
  return {
48
48
  "service": "VeriSight MCP - Autonomous Physical AI Forensics Engine",
49
49
  "status": "ONLINE",
50
- "version": "2.2.2",
50
+ "version": "2.2.4",
51
51
  "engine": "OpenCV 5.0.0 (ARM64 SIMD)",
52
52
  "docs_url": "/docs",
53
53
  "api_url": "/api",
@@ -56,7 +56,7 @@ def root_status():
56
56
 
57
57
  @app.get("/health")
58
58
  def health_check():
59
- return {"status": "healthy", "service": "verisight-backend", "version": "2.2.2"}
59
+ return {"status": "healthy", "service": "verisight-backend", "version": "2.2.4"}
60
60
 
61
61
  @app.get("/api")
62
62
  @app.get("/api/")
@@ -64,7 +64,7 @@ def api_index():
64
64
  return {
65
65
  "service": "VeriSight MCP REST API",
66
66
  "status": "ONLINE",
67
- "version": "2.2.2",
67
+ "version": "2.2.4",
68
68
  "documentation": "/docs",
69
69
  "endpoints": {
70
70
  "health": "/health",
@@ -251,7 +251,7 @@ def handle_json_rpc(payload: Dict[str, Any], agent_pipeline_callback) -> Optiona
251
251
  },
252
252
  "serverInfo": {
253
253
  "name": "verisight-mcp-engine",
254
- "version": "2.2.2"
254
+ "version": "2.2.4"
255
255
  }
256
256
  }
257
257
  }
@@ -268,7 +268,7 @@ def handle_json_rpc(payload: Dict[str, Any], agent_pipeline_callback) -> Optiona
268
268
  "protocol_version": "2024-11-05",
269
269
  "server_info": {
270
270
  "name": "verisight-mcp-engine",
271
- "version": "2.2.2",
271
+ "version": "2.2.4",
272
272
  "capabilities": {"tools": True, "resources": False, "prompts": False}
273
273
  }
274
274
  }
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "verisight"
7
- version = "2.2.2"
7
+ version = "2.2.4"
8
8
  authors = [
9
9
  { name="Aditya Raj Tiwari", email="adityasantosh2026@gmail.com" },
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: verisight
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: Sub-3ms Physical Multi-Spectral Image Forensics & Presentation Attack Detection engine powered by OpenCV 5 and Model Context Protocol (MCP).
5
5
  Author-email: Aditya Raj Tiwari <adityasantosh2026@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -34,6 +34,9 @@ Dynamic: license-file
34
34
  # 🔬 VeriSight MCP — Autonomous Physical AI Visual Forensics Engine
35
35
 
36
36
  [![VeriSight CI](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
37
+ [![PyPI version](https://img.shields.io/pypi/v/verisight.svg?color=blue)](https://pypi.org/project/verisight/)
38
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
39
+ [![mcprush score](https://mcprush.com/badge/verisight-mcp/score.svg)](https://mcprush.com/to/verisight-mcp?ref=badge)
37
40
  [![M8ven Score](https://m8ven.ai/badge/mcp/adityarajtiwari880-verisight-11ohzr?v=5ddb567da1a0cb2e2f12567300d7ff24)](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
38
41
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
39
42
  [![Python Version](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-3776AB?logo=python&logoColor=white)](pyproject.toml)
@@ -43,6 +46,10 @@ Dynamic: license-file
43
46
  [![Next.js 16](https://img.shields.io/badge/Next.js-16.4.3-000000?logo=next.js&logoColor=white)](https://nextjs.org/)
44
47
  [![FastAPI](https://img.shields.io/badge/FastAPI-Production%20Ready-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
45
48
 
49
+ <p align="center">
50
+ <a href="https://mcprush.com/to/verisight-mcp?ref=badge"><img width="380" height="200" src="https://mcprush.com/badge/verisight-mcp/card.svg" alt="VeriSight MCP server" /></a>
51
+ </p>
52
+
46
53
  > **Sub-3ms Physical AI and multi-spectral visual forensics engine built on pure OpenCV 5 and SIMD acceleration.** Detects generative AI inpainting, deepfake manipulation, duplicate photo reuse, and presentation recapture attacks with zero heavyweight neural network dependencies.
47
54
 
48
55
  ---
@@ -165,12 +172,17 @@ verisight server --port 8000
165
172
 
166
173
  VeriSight natively implements the **Anthropic Model Context Protocol (MCP)** specification (`protocol_version: 2024-11-05`). External LLM agents (**Claude Desktop**, **Cursor**, **Windsurf**, **LangChain**) can discover and call VeriSight tools autonomously via high-performance standard I/O (`stdio`).
167
174
 
168
- ### 1-Click Zero-Install (`uvx`)
175
+ ### 1-Click Zero-Install (`uvx` & `claude mcp`)
169
176
  Run directly via Astral `uvx` with zero manual cloning or environment setup:
170
177
  ```bash
171
178
  uvx verisight mcp
172
179
  ```
173
180
 
181
+ Or add directly to **Claude Code CLI**:
182
+ ```bash
183
+ claude mcp add --scope user verisight-mcp '--' uvx verisight mcp
184
+ ```
185
+
174
186
  ### Claude Desktop & Cursor Configuration
175
187
 
176
188
  Add VeriSight directly to your `claude_desktop_config.json` (or Cursor MCP settings):
@@ -278,6 +290,19 @@ Executing 100 continuous perception-decision pipeline frames...
278
290
 
279
291
  ---
280
292
 
293
+ ### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
294
+
295
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
296
+
297
+ Evaluate VeriSight against real-world camera photographs, spliced manipulations, and generative AI inpaintings directly in the cloud with **0 KB local disk usage**:
298
+
299
+ * **Interactive Notebook:** [`benchmarks/verisight_forensic_benchmark.ipynb`](benchmarks/verisight_forensic_benchmark.ipynb)
300
+ * **Headless Evaluation Script:** [`benchmarks/run_colab_benchmark.py`](benchmarks/run_colab_benchmark.py)
301
+ * **Streaming Architecture:** Images are fetched in-memory (`RAM-only`) from standard vision corpuses (COCO, Open Images, OpenCV test suites) and evaluated on-the-fly without saving any image files to disk.
302
+ * **Metrics Generated:** Confusion Matrix, Precision, Recall, Specificity, F1-Score, Processing Latency, and ROC Curve.
303
+
304
+ ---
305
+
281
306
  ## 📁 Repository Structure
282
307
 
283
308
  ```
@@ -286,6 +311,9 @@ verisight/
286
311
  │ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
287
312
  │ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
288
313
  │ └── PULL_REQUEST_TEMPLATE.md # Contributor review standards
314
+ ├── benchmarks/ # 1-Click cloud benchmark suite (Colab / RAM streaming)
315
+ │ ├── run_colab_benchmark.py # Headless streaming evaluator
316
+ │ └── verisight_forensic_benchmark.ipynb # Interactive notebook with confusion heatmaps
289
317
  ├── backend/
290
318
  │ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
291
319
  │ ├── cli.py # Terminal CLI entry point (verisight command)
@@ -1,175 +0,0 @@
1
- """
2
- VeriSight MCP - Real-Life Forensic Sample Generator
3
- Generates realistic real-world photos with genuine camera sensor noise, optical textures,
4
- and authentic generative AI inpainting artifacts for competition demonstration.
5
- """
6
-
7
- import cv2
8
- import numpy as np
9
- import os
10
-
11
- OUTPUT_DIR = os.path.dirname(__file__)
12
-
13
- def generate_strawberry_mold_claim():
14
- """Real-world Quick-Commerce case: Fresh strawberries with AI-inpainted rotten fungal patch."""
15
- w, h = 800, 600
16
- # Realistic background: kitchen counter / cutting board texture
17
- img = np.full((h, w, 3), (180, 205, 220), dtype=np.uint8) # Marble counter tone
18
- rng = np.random.default_rng(2026)
19
-
20
- # Natural counter grain and reflections
21
- grain = rng.normal(0, 5, img.shape).astype(np.int16)
22
- img = np.clip(img.astype(np.int16) + grain, 0, 255).astype(np.uint8)
23
-
24
- # Clear plastic container
25
- cv2.rectangle(img, (140, 80), (660, 520), (160, 185, 200), 2)
26
- cv2.putText(img, "BLINKIT FRESH - LOT #90412 (FRESH STRAWBERRIES 250G)", (160, 115),
27
- cv2.FONT_HERSHEY_SIMPLEX, 0.55, (80, 100, 120), 2)
28
-
29
- # Draw several realistic red strawberries with seed texture
30
- centers = [(280, 260), (420, 240), (520, 300), (340, 380), (480, 400)]
31
- for cx, cy in centers:
32
- # Strawberry body
33
- cv2.ellipse(img, (cx, cy), (65, 80), 15, 0, 360, (25, 30, 205), -1)
34
- # Seeds
35
- for sx in range(cx - 45, cx + 45, 14):
36
- for sy in range(cy - 55, cy + 55, 14):
37
- if ((sx - cx)/45)**2 + ((sy - cy)/55)**2 < 0.8:
38
- cv2.circle(img, (sx + int(rng.integers(-2, 3)), sy), 2, (60, 180, 240), -1)
39
- # Green leafy crown
40
- cv2.circle(img, (cx, cy - 70), 18, (45, 145, 55), -1)
41
-
42
- # Save realistic base at organic camera quality Q=85
43
- base_path = os.path.join(OUTPUT_DIR, "real_strawberries_base.jpg")
44
- cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 85])
45
-
46
- # Now simulate Generative AI Inpainting:
47
- # A user takes an AI inpainting tool to add a disgusting rotting gray-white fungal mold patch
48
- tampered = cv2.imread(base_path)
49
- rx, ry, rw, rh = 360, 200, 180, 160
50
- patch = tampered[ry:ry+rh, rx:rx+rw].copy()
51
-
52
- # Mold spot with fuzzy fungal texture
53
- cv2.ellipse(patch, (90, 80), (60, 50), -10, 0, 360, (75, 95, 85), -1)
54
- cv2.ellipse(patch, (90, 80), (40, 32), -10, 0, 360, (140, 160, 150), -1)
55
-
56
- # Latent diffusion periodic upsampling grid (characteristic of conv/attention decoder layers)
57
- y_g, x_g = np.indices((rh, rw))
58
- grid = ((np.sin(x_g * 0.5) * np.cos(y_g * 0.5)) * 16).astype(np.int16)
59
- patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
60
- patch[:, :, 1] = np.clip(patch[:, :, 1].astype(np.int16) + grid, 0, 255).astype(np.uint8)
61
-
62
- # Smooth blending around inpainting edge
63
- mask = np.zeros((rh, rw), dtype=np.float32)
64
- cv2.ellipse(mask, (90, 80), (68, 56), -10, 0, 360, 1.0, -1)
65
- mask = cv2.GaussianBlur(mask, (21, 21), 0)[:, :, np.newaxis]
66
-
67
- blended = (patch * mask + tampered[ry:ry+rh, rx:rx+rw] * (1.0 - mask)).astype(np.uint8)
68
- tampered[ry:ry+rh, rx:rx+rw] = blended
69
-
70
- # Save final image at Q=98 (creating the classic JPEG Ghost & ELA compression mismatch)
71
- final_path = os.path.join(OUTPUT_DIR, "sample_real_strawberries_inpainted.jpg")
72
- cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
73
- print(f"Generated: {final_path}")
74
-
75
- def generate_invoice_tampering_claim():
76
- """Real-world Receipt case: Delivery receipt with inpainted fake date & inflated refund amount."""
77
- w, h = 800, 600
78
- img = np.full((h, w, 3), (242, 246, 248), dtype=np.uint8) # Paper receipt color
79
- rng = np.random.default_rng(404)
80
- paper_texture = rng.normal(0, 3, img.shape).astype(np.int16)
81
- img = np.clip(img.astype(np.int16) + paper_texture, 0, 255).astype(np.uint8)
82
-
83
- # Receipt borders & header
84
- cv2.rectangle(img, (180, 40), (620, 560), (200, 210, 215), 2)
85
- cv2.putText(img, "ZEPTO HYPERLOCAL - TAX INVOICE", (210, 85), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (30, 40, 50), 2)
86
- cv2.line(img, (200, 105), (600, 105), (180, 190, 200), 2)
87
-
88
- cv2.putText(img, "ORDER ID: ZEP-994102-OCT", (210, 140), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
89
- cv2.putText(img, "DATE: 2026-10-18 19:42 IST", (210, 170), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
90
- cv2.putText(img, "CUSTOMER: Rahul Sharma", (210, 200), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (60, 70, 80), 1)
91
- cv2.line(img, (200, 220), (600, 220), (180, 190, 200), 1)
92
-
93
- items = [
94
- ("1x Organic Alphonso Mangoes", "Rs 650.00"),
95
- ("2x Artisanal Greek Yogurt", "Rs 280.00"),
96
- ("1x Cold Pressed Olive Oil", "Rs 520.00"),
97
- ("Delivery & Platform Fee", "Rs 45.00")
98
- ]
99
- y_pos = 260
100
- for name, price in items:
101
- cv2.putText(img, name, (210, y_pos), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (50, 60, 70), 1)
102
- cv2.putText(img, price, (500, y_pos), cv2.FONT_HERSHEY_SIMPLEX, 0.45, (50, 60, 70), 1)
103
- y_pos += 35
104
-
105
- cv2.line(img, (200, y_pos + 10), (600, y_pos + 10), (180, 190, 200), 2)
106
- cv2.putText(img, "TOTAL AMOUNT: Rs 1,495.00", (210, y_pos + 45), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (20, 30, 40), 2)
107
-
108
- base_path = os.path.join(OUTPUT_DIR, "real_invoice_base.jpg")
109
- cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 84])
110
-
111
- # Tampering: inpaint over total to claim fraudulent 4x refund
112
- tampered = cv2.imread(base_path)
113
- rx, ry, rw, rh = 380, y_pos + 15, 210, 50
114
- patch = tampered[ry:ry+rh, rx:rx+rw].copy()
115
-
116
- # Erase original and write synthetic altered amount
117
- cv2.rectangle(patch, (10, 5), (195, 42), (242, 246, 248), -1)
118
- cv2.putText(patch, "Rs 5,980.00", (15, 32), cv2.FONT_HERSHEY_SIMPLEX, 0.72, (20, 25, 35), 2)
119
-
120
- # Add synthetic inpainting noise divergence
121
- noise = rng.normal(0, 1.2, patch.shape).astype(np.int16)
122
- patch = np.clip(patch.astype(np.int16) + noise, 0, 255).astype(np.uint8)
123
- tampered[ry:ry+rh, rx:rx+rw] = patch
124
-
125
- final_path = os.path.join(OUTPUT_DIR, "sample_real_invoice_tampered.jpg")
126
- cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 97])
127
- print(f"Generated: {final_path}")
128
-
129
- def generate_car_bumper_dent_claim():
130
- """Real-world Auto Insurance case: Intact car bumper with generative AI dent/scratch."""
131
- w, h = 800, 600
132
- # Metallic silver car paint
133
- img = np.full((h, w, 3), (195, 205, 212), dtype=np.uint8)
134
- rng = np.random.default_rng(777)
135
-
136
- # Car body contour lines and reflections
137
- cv2.ellipse(img, (400, 650), (450, 350), 0, 0, 180, (160, 175, 185), 6)
138
- cv2.line(img, (50, 420), (750, 420), (145, 155, 165), 3) # Bumper seam line
139
-
140
- # License plate
141
- cv2.rectangle(img, (310, 440), (490, 510), (235, 240, 245), -1)
142
- cv2.rectangle(img, (310, 440), (490, 510), (30, 40, 50), 2)
143
- cv2.putText(img, "DL 01 AB 8842", (325, 485), cv2.FONT_HERSHEY_SIMPLEX, 0.65, (20, 30, 40), 2)
144
-
145
- base_path = os.path.join(OUTPUT_DIR, "real_car_base.jpg")
146
- cv2.imwrite(base_path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 86])
147
-
148
- # Tampering: inpaint an ugly deep collision dent & black paint scratch
149
- tampered = cv2.imread(base_path)
150
- rx, ry, rw, rh = 180, 220, 180, 150
151
- patch = tampered[ry:ry+rh, rx:rx+rw].copy()
152
-
153
- # Deep concave shadow dent
154
- cv2.ellipse(patch, (90, 75), (65, 45), -25, 0, 360, (70, 80, 88), -1)
155
- cv2.ellipse(patch, (90, 75), (45, 30), -25, 0, 360, (40, 48, 55), -1)
156
- # Paint gouge scratches
157
- cv2.line(patch, (40, 50), (140, 95), (25, 28, 30), 3)
158
- cv2.line(patch, (55, 75), (120, 110), (25, 28, 30), 2)
159
-
160
- # Upsampling grid harmonics
161
- y_g, x_g = np.indices((rh, rw))
162
- grid = ((np.sin(x_g * 0.4) + np.cos(y_g * 0.4)) * 12).astype(np.int16)
163
- patch[:, :, 0] = np.clip(patch[:, :, 0].astype(np.int16) + grid, 0, 255).astype(np.uint8)
164
-
165
- tampered[ry:ry+rh, rx:rx+rw] = patch
166
-
167
- final_path = os.path.join(OUTPUT_DIR, "sample_real_car_bumper_dent.jpg")
168
- cv2.imwrite(final_path, tampered, [int(cv2.IMWRITE_JPEG_QUALITY), 98])
169
- print(f"Generated: {final_path}")
170
-
171
- if __name__ == "__main__":
172
- generate_strawberry_mold_claim()
173
- generate_invoice_tampering_claim()
174
- generate_car_bumper_dent_claim()
175
- print("All real-life forensic samples successfully created!")
File without changes
File without changes
File without changes