verisight 2.2.3__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.
- {verisight-2.2.3/verisight.egg-info → verisight-2.2.4}/PKG-INFO +18 -1
- {verisight-2.2.3 → verisight-2.2.4}/README.md +17 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/__init__.py +1 -1
- {verisight-2.2.3 → verisight-2.2.4}/backend/agent.py +39 -17
- {verisight-2.2.3 → verisight-2.2.4}/backend/forensics.py +31 -2
- verisight-2.2.4/backend/generate_real_life_samples.py +292 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/main.py +4 -4
- {verisight-2.2.3 → verisight-2.2.4}/backend/mcp_server.py +2 -2
- {verisight-2.2.3 → verisight-2.2.4}/pyproject.toml +1 -1
- {verisight-2.2.3 → verisight-2.2.4/verisight.egg-info}/PKG-INFO +18 -1
- verisight-2.2.3/backend/generate_real_life_samples.py +0 -175
- {verisight-2.2.3 → verisight-2.2.4}/LICENSE +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/aws_adapter.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/benchmark_runner.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/cli.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/generate_demo_samples.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/test_mcp_tools.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/backend/test_sanity.py +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/setup.cfg +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/verisight.egg-info/SOURCES.txt +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/verisight.egg-info/dependency_links.txt +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/verisight.egg-info/entry_points.txt +0 -0
- {verisight-2.2.3 → verisight-2.2.4}/verisight.egg-info/requires.txt +0 -0
- {verisight-2.2.3 → 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.
|
|
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
|
|
@@ -35,6 +35,7 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
[](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
|
|
37
37
|
[](https://pypi.org/project/verisight/)
|
|
38
|
+
[](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
|
|
38
39
|
[](https://mcprush.com/to/verisight-mcp?ref=badge)
|
|
39
40
|
[](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
|
|
40
41
|
[](LICENSE)
|
|
@@ -289,6 +290,19 @@ Executing 100 continuous perception-decision pipeline frames...
|
|
|
289
290
|
|
|
290
291
|
---
|
|
291
292
|
|
|
293
|
+
### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
|
|
294
|
+
|
|
295
|
+
[](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
|
+
|
|
292
306
|
## 📁 Repository Structure
|
|
293
307
|
|
|
294
308
|
```
|
|
@@ -297,6 +311,9 @@ verisight/
|
|
|
297
311
|
│ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
|
|
298
312
|
│ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
|
|
299
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
|
|
300
317
|
├── backend/
|
|
301
318
|
│ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
|
|
302
319
|
│ ├── cli.py # Terminal CLI entry point (verisight command)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
|
|
4
4
|
[](https://pypi.org/project/verisight/)
|
|
5
|
+
[](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
|
|
5
6
|
[](https://mcprush.com/to/verisight-mcp?ref=badge)
|
|
6
7
|
[](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
|
|
7
8
|
[](LICENSE)
|
|
@@ -256,6 +257,19 @@ Executing 100 continuous perception-decision pipeline frames...
|
|
|
256
257
|
|
|
257
258
|
---
|
|
258
259
|
|
|
260
|
+
### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
|
|
261
|
+
|
|
262
|
+
[](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
|
+
|
|
259
273
|
## 📁 Repository Structure
|
|
260
274
|
|
|
261
275
|
```
|
|
@@ -264,6 +278,9 @@ verisight/
|
|
|
264
278
|
│ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
|
|
265
279
|
│ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
|
|
266
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
|
|
267
284
|
├── backend/
|
|
268
285
|
│ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
|
|
269
286
|
│ ├── cli.py # Terminal CLI entry point (verisight command)
|
|
@@ -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.
|
|
41
|
+
self.version = "2.2.4"
|
|
42
42
|
|
|
43
43
|
def run_investigation(
|
|
44
44
|
self,
|
|
@@ -440,16 +440,18 @@ class ForensicAgent:
|
|
|
440
440
|
# -------------------------------------------------------------
|
|
441
441
|
clusters_detected = ela_meta.get("clusters_detected", 0)
|
|
442
442
|
rx, ry, rw, rh = roi
|
|
443
|
-
|
|
444
|
-
|
|
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
448
|
# Natural Camera vs Document / Synthetic Domain Differentiation:
|
|
447
449
|
# In natural camera photos (damaged items, vehicles, nature, people), natural optical color transitions
|
|
448
450
|
# produce high whole-frame chrominance variance that must not be confused with generative AI fringing.
|
|
449
451
|
# In documents/vouchers, paper is predominantly monochrome/duotone so character editing creates high chrominance spikes.
|
|
450
|
-
is_doc_or_voucher =
|
|
451
|
-
k in claim_type.lower() for k in ["voucher", "coupon", "bill", "invoice", "receipt", "document", "
|
|
452
|
-
)
|
|
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
456
|
# Generative AI detection & Corroboration:
|
|
455
457
|
if is_doc_or_voucher:
|
|
@@ -457,28 +459,48 @@ class ForensicAgent:
|
|
|
457
459
|
(cr_sobel_std >= 6.0 and ela_score >= 35.0 and has_isolated_cluster) or
|
|
458
460
|
(sensor_noise_std < 1.15 and ela_score >= 30.0) or
|
|
459
461
|
(harmonic_ratio >= 2.8 and fft_energy >= 85.0 and ela_score >= 38.0) or
|
|
460
|
-
(ghost_discrepancy >=
|
|
462
|
+
(ghost_discrepancy >= 1.25 and noise_divergence >= 35.0 and has_isolated_cluster) or
|
|
461
463
|
(is_feathered and has_isolated_cluster)
|
|
462
464
|
)
|
|
463
465
|
has_corroboration = (
|
|
464
466
|
is_feathered or
|
|
465
|
-
(ghost_discrepancy >= 0
|
|
466
|
-
(noise_divergence >= 45.0 and ela_score >=
|
|
467
|
-
(ela_score >= 68.0) or
|
|
467
|
+
(ghost_discrepancy >= 1.25 and ela_score >= 30.0) or
|
|
468
|
+
(noise_divergence >= 45.0 and ela_score >= 35.0) or
|
|
468
469
|
is_generative_ai or
|
|
469
470
|
provenance.get("is_edited_software_flag", False)
|
|
470
471
|
)
|
|
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
|
+
|
|
472
491
|
is_generative_ai = (
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
(
|
|
492
|
+
pillar_spectral or
|
|
493
|
+
pillar_seam or
|
|
494
|
+
pillar_sensor_void or
|
|
495
|
+
(pillar_noise and (has_ghost_mismatch or is_feathered))
|
|
477
496
|
)
|
|
478
497
|
has_corroboration = (
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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
|
|
482
504
|
is_generative_ai or
|
|
483
505
|
provenance.get("is_edited_software_flag", False)
|
|
484
506
|
)
|
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
271
|
+
"version": "2.2.4",
|
|
272
272
|
"capabilities": {"tools": True, "resources": False, "prompts": False}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: verisight
|
|
3
|
-
Version: 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
|
|
@@ -35,6 +35,7 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
[](https://github.com/Adityarajtiwari880/verisight/actions/workflows/ci.yml)
|
|
37
37
|
[](https://pypi.org/project/verisight/)
|
|
38
|
+
[](https://colab.research.google.com/github/Adityarajtiwari880/verisight/blob/main/benchmarks/verisight_forensic_benchmark.ipynb)
|
|
38
39
|
[](https://mcprush.com/to/verisight-mcp?ref=badge)
|
|
39
40
|
[](https://m8ven.ai/mcp/adityarajtiwari880-verisight-11ohzr?s=readme)
|
|
40
41
|
[](LICENSE)
|
|
@@ -289,6 +290,19 @@ Executing 100 continuous perception-decision pipeline frames...
|
|
|
289
290
|
|
|
290
291
|
---
|
|
291
292
|
|
|
293
|
+
### 🧪 1-Click Cloud Benchmark Suite (Zero Local Disk Space)
|
|
294
|
+
|
|
295
|
+
[](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
|
+
|
|
292
306
|
## 📁 Repository Structure
|
|
293
307
|
|
|
294
308
|
```
|
|
@@ -297,6 +311,9 @@ verisight/
|
|
|
297
311
|
│ ├── workflows/ci.yml # Automated Python 3.11 & Next.js CI
|
|
298
312
|
│ ├── ISSUE_TEMPLATE/ # Bug reports & feature requests
|
|
299
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
|
|
300
317
|
├── backend/
|
|
301
318
|
│ ├── __init__.py # Python SDK exports (scan_image, verify_claim)
|
|
302
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|