Towards Context-Aware Image Anonymization with Multi-Agent Reasoning
Organizations: Deggendorf Institute of Technology, Deggendorf, Germany
Abstract
Street-level imagery contains personally identifiable information (PII), some of which is context-dependent. Existing anonymization methods either over-process images or miss subtle identifiers, while API-based solutions compromise data sovereignty. We present an agentic framework CAIAMAR (Context-Aware Image Anonymization with Multi-Agent Reasoning) for context-aware PII segmentation with diffusion-based anonymization, combining pre-defined processing for high-confidence cases with multi-agent reasoning for indirect identifiers. Three specialized agents coordinate via round-robin speaker selection in a Plan-Do-Check-Act (PDCA) cycle, enabling large vision-language models to classify PII based on spatial context (private vs. public property) rather than rigid category rules. The agents implement spatially-filtered coarse-to-fine detection where a scout-and-zoom strategy identifies candidates, open-vocabulary segmentation processes localized crops, and -based deduplication ( threshold) prevents redundant processing. Modal-specific diffusion guidance with appearance decorrelation substantially reduces re-identification (Re-ID) risks. On CUHK03-NP, our method reduces person Re-ID risk by (: vs. baseline). For image quality preservation on CityScapes, we achieve KID: , and FID: , significantly outperforming existing anonymization. The agentic workflow detects non-direct PII instances across object categories, and downstream semantic segmentation is preserved. Operating entirely on-premise with open-source models, the framework generates human-interpretable audit trails supporting EU's GDPR transparency requirements while flagging failed cases for human review.
Figures & tables
| Agent | Role, Tools, and Execution Protocol |
|---|---|
| Orchestrator | Role: Workflow coordinator and state tracker. |
| Tools: None (coordination-only, no direct tool access). | |
| Protocol: Tracks completion status ( classify_pii ✓, inpaint ✓, audit ✓, log ✓) via conversation history analysis. Enforces validation rule: “ONLY report success (✓) if tool result visible in conversation history.” Coordinates retry logic for failed audits, enforces iteration limit. Issues text-only coordination messages to other agents. | |
| Auditor | Role: PII classification, quality validation, logging. |
| Tools: classify_pii , audit_output , log_output . | |
| Protocol: (1) PII Classification : Qwen2.5-VL-32B with structured prompting, returns bboxes in format. System prompt prohibits acknowledgment-without-execution: “When instructed to use a tool, YOU MUST CALL IT – NEVER just acknowledge.” Performs scout-and-zoom verification for each classified instance: crops to LVLM bbox, runs Grounded-SAM-2 [ 23 , 33 ] , maps mask to full coordinates. After the first inpainting pass, classify_pii additionally applies a spatial overlap filter against already-processed masks (persons, license plates, traffic signs, previously inpainted regions) to suppress redundant candidates, distinct from the GenerativeAgent’s deduplication. (2) Independent Quality Validation : Creates masked image (processed areas blacked out with 5-iteration morphological dilation, elliptical kernel), performs LVLM-based residual detection to verify no visible PII remains. This check is independent of GenerativeAgent’s deduplication, providing dual-layer verification. |
| Method | MSE | SSIM | LPIPS | KID | FID |
|---|---|---|---|---|---|
| Gauss. Blur | |||||
| DP2 [ 13 ] | |||||
| FADM [ 49 ] | |||||
| Ours |
| Method | LPIPS | KID | FID |
|---|---|---|---|
| SVIA [ 22 ] | |||
| Ours |
| Method | mAP (%) | R1 (%) | R5 (%) |
|---|---|---|---|
| Original | |||
| Gauss. Blur | |||
| DP2 [ 13 ] | |||
| FADM [ 49 ] | |||
| Ours |
| Method | Dice | IoU | Prec./Rec. |
|---|---|---|---|
| Mask R-CNN [ 10 , 21 , 42 ] | 75.83 | 68.71 | 80.71/78.02 |
| Ours (zero-shot) | 25.78 | 20.83 | 52.98/25.85 |
| Component | Time (s) |
|---|---|
| Phase 1: Detection + Inpainting | 67.8 |
| Phase 2: LVLM + SAM + Inpaint | 55.8 |
| Agent overhead | 9.9 |
| Total | 133.5 |
| Class | Ours (Gap) | SVIA (Gap) |
|---|---|---|
| mIoU | 0.877 ( ) | 0.478 ( ) |
| road | 0.996 ( ) | 0.955 ( ) |
| building | 0.977 ( ) | 0.677 ( ) |
| person | 0.778 ( ) | 0.150 ( ) |
| car | 0.975 ( ) | 0.567 ( ) |
| sky | 0.995 ( ) | 0.820 ( ) |
| Category | Instances | AP (%) |
|---|---|---|
| High Performance (AP 20%) | ||
| Passport | 153 | 70.55 |
| Face | 4,039 | 56.98 |
| Person | 5,937 | 48.68 |
| Fingerprint | 79 | 45.02 |
| License Plate | 371 | 33.02 |
| Agent | Action/Message |
|---|---|
| UserProxyAgent | Phase 1 complete. AuditorAgent: classify PII in 0000000165.png using classify_pii . |
| AuditorAgent | Tool call: classify_pii |
| image: artifacts/.../0000000165.png | |
| Tool Result | instances: [ { det_prompt: "rectangular sign with text .", bbox: [464, 275, 526, 341], instance_id: "pii-0001" } ] |
| meta: {provider: ollama, model: qwen2.5vl:32b, tiles: 1} | |
| OrchestratorAgent | Phase 2: [classify_pii ] Found indirect PII. GenerativeAgent, anonymize instances. |
PII Detection
Personally identifiable information (PII) detection finds sensitive personal details in text, conversations, images, and other data.
See all 39 papers