Transformer-based face detection
Detects and localizes human faces in images using the DETR (Detection Transformer) model. Fine-tuned on face detection datasets for real-world performance. Perfect for computer vision applications, security systems, photo apps, and any face detection workflow.
What it does
DETR Face Detection finds and locates human faces in any photo using the Detection Transformer architecture. You give it an image, and it returns the exact locations of all visible faces (bounding boxes) with confidence scores. Unlike traditional detection methods that use convolutional neural networks with anchor boxes, DETR uses a pure transformer architecture to directly predict face locations in an end-to-end manner. This makes it simpler, more efficient, and easier to extend to other detection tasks.
Problem it solves
Find all faces in a photo | Automatically locates every face without manual detection |
Face detection without anchors | Pure transformer approach, no hand-crafted anchor boxes |
End-to-end detection | Fast inference on standard hardware |
Real-time face localization | Identify faces in security camera footage |
Photo organization | Automatically tag or group photos by face locations |
Photo apps | Face-focused cropping, filtering, and enhancement |
Input/Output
- Input: RGB or grayscale images (any resolution)
- Output: Face detections with precise locations
- Bounding box: Coordinates where each face is [x_min, y_min, x_max, y_max]
- Confidence score: How sure the model is (0.0–1.0, where 1.0 = 100% certain)
- Class label: "face"
Accuracy
- Detection Quality:
- Large faces (>96px): 55.14% accuracy ✓ Good
- Medium faces (32-96px): 21.11% accuracy (moderate)
- Small faces (<32px): 1.35% accuracy (challenging)
- Overall recall (AR@100): 15.65% (finds ~16% of all faces with high confidence)
- Performance by Scenario:
- Close-up faces (>100px): 55%+ detection
- Medium distance (50-100px): 20-30% detection
- Far distance (20-50px): 1-5% detection
- Frontal faces: Best performance
- Angled faces: Reduced performance
- Multiple faces in image: Handles well
- Low light: Performance may degrade
Technical Details
Architecture | Encoder-Decoder Transformer (DETR) |
Core Innovation | Direct set prediction for object detection using 100 learnable "object queries" that simultaneously search for faces and predict locations |
Components | • CNN Backbone (ResNet-50): Extracts multi-scale image features (2048 channels)
• Transformer Encoder: 6 layers with 8 attention heads, 256-dim embeddings
• Transformer Decoder: 100 object queries with cross-attention to encoder features
• Prediction Heads: Classification (2 classes: background, face) and bounding box regression [cx, cy, w, h] |
Training | • Base Model: facebook/detr-resnet-50
• Dataset: Face detection dataset (not documented)
• Loss: Bipartite matching (Hungarian algorithm) + cross-entropy classification + L1 + Generalized IoU
• Optimizer: AdamW (lr=5e-05) over 70 epochs with cosine annealing |
Requirements | • PyTorch (v1.9+) + HuggingFace Transformers
• GPU recommended for inference
• Model size: 320MB (~159M parameters) |
Compliance & Provenance
Provider | Open-source |
Provider type | Specialized |
License | Apache 2.0 |
EU AI Act risk class | To Be Classified |
Art. 50 transparency | Under review |
Region availability | Restricted in: EU, UK |
Training data summary | Pending — provider has not yet published per Art. 53(d) |
⚠️ This model is currently under legal review and is not available to users in the EU or United Kingdom. If you have a specific lawful use case in those regions, contact legal@cnaps.ai.
For more on how we classify models and mark outputs, see our AI Policy.
Model Source
- HuggingFace: https://huggingface.co/EsraaFouad/detr_fine_tune_face_detection_final
- License: apache-2.0