Prerequisites
Before starting, ensure you have the following installed on your system:Rust
Install via rustup
OpenCV 4.x
Required for image processing
- macOS
- Ubuntu/Debian
- Fedora/RHEL
For Windows installation, follow the OpenCV-Rust installation guide.
Installation
Clone the repository
Clone Iris from GitHub and navigate to the project directory:The repository includes:
src/- Rust source codeCargo.toml- Dependency configurationsetup.sh- AI model download scriptDockerfile- Container deployment config
Download AI models
Iris requires two ONNX models for face detection and recognition. These files are excluded from Git due to size (~5MB each).Option 1: Automated setup (recommended)Option 2: Manual download
These models are from OpenCV Zoo, a collection of pre-trained deep learning models optimized for OpenCV.
Verify Installation
Test that Iris is running correctly:Your First Face Comparison
Let’s compare a target face against a database of people to find matches.Understand the request structure
The
/compare endpoint accepts a JSON payload with:target_url- The face you want to identify (URL or Base64 data URI)people[]- Array of known individuals to compare againstname- Identifier for this person (e.g., patient ID)image_url- Reference photo (URL or Base64 data URI)
Interpret the response
Iris returns matches sorted by probability (highest first):Response fields:
matches- Array of matching people (empty if no matches)name- The identifier from your requestprobability- Match confidence (0-100)
Only matches with similarity > 36.3% are returned. This threshold is based on the SFace model’s recommendation for positive matches.
Using Base64 Data URIs
Instead of image URLs, you can send images directly as Base64-encoded data URIs:Check API Statistics
Monitor API usage with the/stats endpoint:
- Monitoring traffic patterns
- Debugging rate limit issues
- Capacity planning
- Health checks
Common Issues
OpenCV not found during compilation
OpenCV not found during compilation
Error:
Could not find OpenCV librarySolution:- macOS
- Linux
Port 8080 already in use
Port 8080 already in use
Error: Then rebuild:
Address already in use (os error 48)Solution: Change the port in src/main.rs:151:cargo run --releaseONNX models not found
ONNX models not found
Error: Should show:If missing, re-run
Failed to load model: face_detection_yunet_2023mar.onnxSolution: Ensure models are in the project root:./setup.sh or download manually.Empty matches array
Empty matches array
Issue: Check that:
/compare returns {"matches": []}Possible causes:- No face detected: Image quality too low, face too small, or heavily obscured
- Similarity too low: Faces don’t match (different people)
- Invalid image URL: Download failed or returned non-image data
- Images contain clearly visible faces
- URLs are publicly accessible
- Images are in supported formats (JPEG, PNG, WebP)
Rate limit errors (429)
Rate limit errors (429)
Error: Or adjust rate limits in
429 Too Many RequestsCause: Exceeded 5 requests/second per IP (burst: 10)Solution: Implement exponential backoff:src/main.rs:128-129:Next Steps
Now that Iris is running, explore advanced topics:API Reference
Complete documentation for all endpoints and request/response models
Architecture Deep Dive
Learn how Iris processes faces and maintains stateless design
Docker Deployment
Deploy Iris as a containerized service for production
Security Model
Understand privacy guarantees and rate limiting
Need help? Check the GitHub repository for issues and discussions, or review the complete API reference.