Swift Security Docs
  • Introduction to Swift Security
  • Onboarding
    • Tenant Setup
    • Product Deployments
      • Browser Extension
      • LLM Guardrails
        • LLM Guardrails API Integration
      • VS Code IDE Extension
    • Directory Sync
      • Configuring Google Directory Sync
      • Configuring Microsoft Directory Sync
    • MDM
      • Extension Deployment Via Google Workspace
      • Extension deployment via google workspace + MDM at device level
      • Extension Deployment Via Microsoft Intune
        • Chromium Browsers in Windows
        • Edge Browsers in Windows
        • Firefox Browsers in Windows
      • Extension Deployment Via Kandji
        • Chromium Browsers in Mac
    • Infrastructure
      • SaaS Model
      • Hybrid deployment (coming soon)
  • SSO (Single Sign-On)
    • SSO Configurations identity provider - Google workspace
  • Administrative Guide
    • Console Users
      • Role Creation
      • RBAC General Settings for Login Methods (for the Console)
      • User Creation
      • SSO login(okta)
    • Swift Detection Engines
      • Data Identifiers
        • Custom Data Identifiers
      • EDM Dictionaries
        • EDM Rule
        • EDM Profile
        • EDM Extension Policy
      • Data Rules
        • Custom Rules
      • Data Profiles
      • LLM Guardrail Scanners
        • Data Protection Scanner
        • Gibberish Scanner
        • Ban Substrings Scanner
        • Invisible Text Scanner
        • Code Scanner
        • Language Scanner
        • Sentiment Analysis Scanner
        • Jailbreak Scanner
        • Toxicity Scanner
        • Prompt Injection Scanner
        • Token Limit Scanner
        • Reading Time Scanner
        • Language Same Scanner
        • No Refusal Scanner
        • Factual Consistency Scanner
        • Bias Detection Scanner
        • URL Reachability Scanner
        • Nudity Scanner
        • Gender Scanner
        • Celebrity Scanner
        • Face Scanner
        • Race Scanner
        • Performance and Benchmark
    • Browser Extension
      • Extension Installation
      • Granular Policies
        • Control URL access
        • Protect company data
        • Protect against Threats (Coming Soon)
      • Extension Alerts
      • Extension Events
      • Extension Popups
      • Browser Extension Coverage
    • LLM Guardrails
      • LLM Guardrails Policies
      • LLM Guardrails Alert
      • LLM Guardrails Events
    • Regulation Laws
  • Assets
    • Applications
    • Users
    • Extensions
  • Integration
    • Notification
      • Jira
      • ServiceNow
      • Slack
      • Splunk
    • Forensic
    • Feature
      • Rules Glossary
        • United States
        • Canada
        • Latin America
        • European Union
        • Australia
        • APAC (Asia-Pacific)
        • EMEA Countries
        • Others
      • Data identifiers Glossary
        • United States
        • Canada
        • Latin America
        • European Union
        • Australia
        • APAC (Asia-Pacific)
        • EMEA Countries
        • Others
      • Supported MIME Types
      • Supported OCR Format
    • Manage unauthorized access from unmanaged browser
  • Settings
    • Manage Reasons
    • Audit Log
  • Release Notes
    • Version - 1.27
    • Version - 1.26
    • Version - 1.25
    • Version - 1.24
    • Version - 1.23
    • Version - 1.16
    • Version - 1.15
    • Version - 1.14
    • Version - 1.13
    • Version - 1.12
    • Version - 1.11
    • Version - 1.10
    • Version - 1.09
    • Version - 1.08
    • Version - 1.07
    • Version - 1.06
    • Version - 1.05
    • Version - 1.04
    • Version - 1.03
    • Version - 1.02
    • Version - 1.01
Powered by GitBook
On this page
  1. Administrative Guide
  2. Swift Detection Engines
  3. LLM Guardrail Scanners

Race Scanner

(Input Scanner)

The Race Detector acts as a safeguard in our AI chatbot application, automatically detecting and blocking images to ensure a safe and respectful environment for all users.

Purpose and Scope

Purpose: To outline the workflow for detecting faces in an uploaded image, analyzing the race of the detected face using a deep learning model, and returning the race predictions.

Scope: This document covers the interactions between the race-detector service, the detect_face() function, the DeepFace library, and the temporary file system, including image uploading, face detection, race analysis, and cleanup procedures.

Decision Points

  • Faces Found: If no faces are detected in the uploaded image, the process terminates early with no race predictions.

  • Race Predictions: If faces are detected, race analysis is performed, and the top two race predictions are returned.

How it Works:

Step 1: User Uploads an Image File

  • Procedure: The user uploads an image file through the race-detector endpoint. The image is received and saved as a temporary file on the server.

Step 2: Call detect_face() Function

  • Procedure: The detect_face() function is invoked with the path of the temporary image file to detect and align faces in the image.

Step 3: Load Image

  • Procedure: Inside detect_face(), the image is loaded using dlib.load_rgb_image() to prepare it for processing.

Step 4: Resize Image

  • Procedure: The image is resized to fit within the maximum size limit while maintaining the aspect ratio to optimize face detection.

Step 5: Detect Faces

  • Procedure: The cnn_face_detector model is used to detect faces within the resized image. Detected face regions are identified.

Step 6: Check if Faces Found

  • Procedure: Determine if any faces were detected. If no faces are found, return an empty dictionary and end the process. If faces are found, proceed to the next step.

Step 7: Facial Landmarks

  • Procedure: The sp model is used to locate facial landmarks on the detected face, which are essential for accurate face alignment.

Step 8: Reverse Resize

  • Procedure: Adjust the coordinates of the detected face to match the original image dimensions using the resize ratio.

Step 9: Align Face

  • Procedure: The face is aligned using dlib.get_face_chips() based on the detected landmarks. The aligned face image is saved to a temporary file.

Step 10: Call DeepFace.analyze() to Predict Race

  • Procedure: The aligned face image is passed to the DeepFace.analyze() function to predict the race. The result includes probabilities for different race categories.

Step 11: Extract and Sort Race Information

  • Procedure: Extract the race prediction probabilities from the DeepFace result and sort them in descending order to determine the top two races.

Step 12: Return Top Two Race Predictions

  • Procedure: Return the top two race predictions as a dictionary containing race names and their respective probabilities.

Step 13: Clean Up

  • Procedure: Delete all temporary files created during the process to free up server space and avoid clutter.

Step 14: End

  • Procedure: The process concludes with the return of race predictions or an empty result if no faces were detected.

Race Detection Policy for AI Chatbot

Optionally, perform a test to ensure the policy is functioning as intended. Upload a JPG or PNG image to detect Race.

PreviousFace ScannerNextPerformance and Benchmark

Last updated 8 months ago

Create a new policy as same as shown in , for Race detection select scanner Race.

LLM Guardrails Policy