Skip to content

Image Intelligence ​

GhostAI's image intelligence system detects sensitive content in uploaded images — from ID cards and credit cards to faces and bank checks — and automatically creates redacted versions to prevent PII exposure.

Content Detection ​

Sensitive Document Detection ​

GhostAI identifies the following document types in uploaded images:

Content TypeDetection MethodConfidenceAction
ID CardsTemplate matching (50 US states + federal)95%Full blur + OCR redaction
Driver's LicensesState-specific templates95%Full blur + OCR redaction
PassportsInternational format matching90%Full blur + OCR redaction
Credit CardsCard number pattern detection92%Full blur + OCR redaction
Bank ChecksCheck layout recognition90%Full blur + OCR redaction
Medical RecordsDocument format analysis88%Full blur + OCR redaction
Badges/IDsCorporate/government ID formats85%Full blur + OCR redaction

Biometric Detection ​

Content TypeMethodAction
FacesFacial detection (not recognition)De-identification blur
FingerprintsPattern matchingFlagged for review

Code & Data Detection ​

Content TypeMethodAction
QR CodesDecode and scan for PIIFlag embedded URLs/data
BarcodesDecode and scanFlag encoded PII
ScreenshotsOCR + context analysisPII text redaction

Content Moderation ​

Content TypeMethodAction
NSFW ContentClassification modelFlagged and blocked
ViolenceClassification modelFlagged for review

Steganography Detection ​

GhostAI detects hidden data embedded in images using statistical analysis:

MethodWhat It DetectsConfidence
Chi-square testNon-random LSB distribution indicating data embeddingHigh
LSB uniformitySuspiciously uniform bit distribution in least significant bitsMedium
Combined analysisMulti-signal correlation for higher accuracyHigh

Images flagged with steganographic content are marked in scan results for security review.

Polyglot File Detection (Planned) ​

Images that are simultaneously valid as other file types (e.g., a JPEG that is also a valid ZIP archive — known as a GIFAR attack) will be detected and flagged.

Adversarial Image Detection (Planned) ​

ML-based detection of images specifically crafted to fool OCR or content classification models, such as adversarial text that OCRs as prompt injection commands while appearing as noise to human viewers.

How Image Redaction Works ​

┌──────────┐    ┌──────────┐    ┌──────────┐    ┌──────────┐
│  Image   │───▶│ Content  │───▶│   OCR    │───▶│ Redacted │
│ Upload   │    │ Classify │    │ Extract  │    │  Image   │
└──────────┘    └──────────┘    └──────────┘    └──────────┘
                     │               │                │
                     ▼               ▼                ▼
              ┌──────────┐    ┌──────────┐    ┌──────────┐
              │ Sensitive │    │ PII Word │    │  Region  │
              │ Content?  │    │ Matching │    │ Blurring │
              └──────────┘    └──────────┘    └──────────┘

Redaction Process ​

  1. Classification: Image analyzed for sensitive document types
  2. OCR Extraction: Text extracted from the image via Tesseract
  3. PII Matching: Extracted words compared against detected PII entities
  4. Region Mapping: PII text locations mapped to image coordinates
  5. Redaction: Matching regions covered with colored redaction boxes
  6. Full Blur: If sensitive document type detected (ID, check, etc.), entire image blurred

Redaction Methods ​

ScenarioMethod
Text PII foundTargeted redaction boxes over PII text
Sensitive document typeFull Gaussian blur of entire image
BothFull blur + targeted boxes for text
EXIF metadataStripped from all images

EXIF Metadata Stripping ​

All uploaded images have metadata automatically inspected and optionally stripped:

Metadata FieldPrivacy RiskDefault Action
GPS coordinatesLocation trackingStrip
Camera modelDevice fingerprintingStrip
TimestampActivity trackingStrip
Creator nameIdentity exposureStrip
SoftwareSystem fingerprintingPreserve
Image dimensionsLow riskPreserve

OCR Capabilities ​

Supported Features ​

  • Printed text: High accuracy for typed/printed content
  • Handwritten text: Limited support for clear handwriting
  • Multi-language: English, Spanish, French, German, and more
  • Rotated text: Handles various orientations
  • Low quality: Adaptive preprocessing for poor quality images

OCR Pipeline ​

  1. Image preprocessing (deskew, contrast enhancement)
  2. Text region detection
  3. Character recognition via Tesseract
  4. PII entity matching against detected text
  5. Bounding box extraction for redaction overlay

Viewing Redacted Images ​

In the Preview Modal ​

  • Default view: Shows the redacted version with PII blurred/covered
  • Loading indicator: Spinner while redacted image is generated
  • Error handling: Graceful fallback if image can't be processed
  • Toggle: Admins can switch to the original (unredacted) image

Redaction Badges ​

The preview modal shows visual indicators:

  • PII Redacted badge: Green badge when PII has been redacted
  • Sensitive Content badge: Red badge for IDs, checks, etc.
  • PII Count: Number of PII entities detected

API Usage ​

Scan Image for PII ​

bash
curl -X POST http://localhost:8000/api/files/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@bank_check.jpg" \
  -F "scan=true"

Response includes image detection results:

json
{
  "file_id": "img_abc123",
  "scan_results": {
    "pii_count": 8,
    "entities": [
      {"type": "PERSON", "text": "John Smith"},
      {"type": "US_BANK_NUMBER", "text": "123456789012"},
      {"type": "ROUTING_NUMBER", "text": "021000021"}
    ],
    "image_detections": [
      {
        "label": "bank_check",
        "confidence": 0.92,
        "category": "financial",
        "is_sensitive": true
      }
    ],
    "has_sensitive_image_content": true
  }
}

Get Redacted Image ​

bash
# Returns the redacted version by default
curl http://localhost:8000/api/files/img_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o redacted_check.jpg

Configuration ​

bash
# Image intelligence settings
IMAGE_DETECTION_ENABLED=true
OCR_ENABLED=true
OCR_LANGUAGES=eng,spa,fra
EXIF_STRIP_ENABLED=true
NSFW_DETECTION_ENABLED=true
FACE_DETECTION_ENABLED=true

Best Practices ​

  1. Enable all detectors: Each catches different sensitive content
  2. Review redacted images: Verify no PII is visible before sharing
  3. Strip EXIF by default: Prevent accidental location exposure
  4. Monitor bank check uploads: Common vector for financial PII
  5. Train users: Remind users not to photograph sensitive documents

Next Steps ​

SOC 2 Type II Certified | BAA Available | HIPAA-Ready