Token AI
Friday AI
Back to Models

Face Detector

Real-time Face Detection & Recognition

Computer Vision
Hugging FaceDownload

What Face Detector Does

Face Detector is a state-of-the-art computer vision model designed for accurate and efficient face detection and recognition in images and video streams. Built on advanced deep learning architectures, it can detect multiple faces simultaneously with high precision across various lighting conditions and angles.

Perfect for security systems, attendance tracking, photo organization, augmented reality applications, and any scenario requiring reliable face detection and identification.

Key Features

  • Real-time Detection – Process video streams at 30+ FPS
  • Multi-face Support – Detect and track multiple faces simultaneously
  • Robust Performance – Works in various lighting and angle conditions
  • Facial Landmarks – Detects key facial features for advanced applications

System Requirements

GPU Memory
4GB+
Model Size
~200MB
Latency
~30ms

How to Use

Load and Use the Model

"keyword">from transformers "keyword">import AutoModelForImageClassification, AutoImageProcessor
"keyword">import torch
"keyword">from PIL "keyword">import Image

# Load model and processor
model = AutoModelForImageClassification.from_pretrained("tokenaii/face-detector")
processor = AutoImageProcessor.from_pretrained("tokenaii/face-detector")

# Load image
image = Image.open("path/to/image.jpg")
inputs = processor(images=image, return_tensors="pt")

# Detect faces
"keyword">with torch.no_grad():
    outputs = model(**inputs)
    predictions = outputs.logits.softmax(dim=-"number">1)

print("Face detection results:", predictions)

Real-time Video Detection

"keyword">import cv2
"keyword">from transformers "keyword">import AutoModelForImageClassification, AutoImageProcessor

# Load model
model = AutoModelForImageClassification.from_pretrained("tokenaii/face-detector")
processor = AutoImageProcessor.from_pretrained("tokenaii/face-detector")

# Open video stream
cap = cv2.VideoCapture("number">0)

"keyword">while "constant">True:
    ret, frame = cap.read()
    "keyword">if not ret:
        "keyword">break
    
    # Process frame
    inputs = processor(images=frame, return_tensors="pt")
    outputs = model(**inputs)
    
    # Draw bounding boxes (simplified)
    # ... detection logic ...
    
    cv2.imshow('Face Detection', frame)
    "keyword">if cv2.waitKey("number">1) & 0xFF == ord('q'):
        "keyword">break

cap.release()
cv2.destroyAllWindows()

Download the Model File Only

"keyword">from huggingface_hub "keyword">import hf_hub_download

# Download the model file "keyword">from the repo
model_path = hf_hub_download(
    repo_id="tokenaii/face-detector",
    filename="pytorch_model.bin"
)
print("Model downloaded to:", model_path)