A comprehensive dual-authentication parking lot access control system combining AI-powered license plate detection with face recognition for maximum security and convenience.
This integrated system provides dual-layer authentication requiring both:
- Face Recognition - Verify authorized personnel
- License Plate Detection - Confirm authorized vehicle
Both checks must pass for system authorization, providing enhanced security for sensitive parking facilities.
parkingLotSystem/
├── README.md # This file - Integration guide
├── main.py # Main integration controller
├── requirements.txt # All system dependencies
├── utils.py # Shared utilities
├── face_recognition/ # Independent face recognition system
│ ├── README.md # Face system documentation
│ ├── main_face_recognition.py
│ ├── People/ # Known faces directory
│ └── *.wav # Audio notifications
└── plate_detection/ # Independent plate detection system
├── README.md # Plate system documentation
├── yolo_detect.py
├── authorized_plates.xlsx
└── model/ # YOLO models directory
pip install -r requirements.txtCore Dependencies:
opencv-python- Camera and image processingface-recognition- Face detection and recognitionultralytics- YOLO v11 modelseasyocr- License plate text recognitionpandas- Excel file managementpygame- Audio notificationsnumpy- Numerical operations
Add authorized personnel photos to face_recognition/People/:
face_recognition/People/
├── john_doe.jpg
├── jane_smith.jpg
└── security_guard.jpg
Edit plate_detection/authorized_plates.xlsx:
| Plate Number | Owner Name | Vehicle Type | Status |
|---|---|---|---|
| ABC123 | John Doe | Car | Active |
| XYZ789 | Jane Smith | SUV | Active |
# Standard mode (single frame detection)
python main.py
# Continuous monitoring mode (constant face detection with no delays)
python main.py --continuous
# Individual system testing
cd face_recognition && python main_face_recognition.py # Face recognition only
cd plate_detection && python yolo_detect.py # Plate detection onlyNew Constant Detection Mode:
- Processes every frame with no delays
- Real-time face recognition on every camera frame
- Instant detection and authorization
- Visual overlay showing detection status
- Camera Activation - System captures live video feed
- Face Detection - Scans for known faces in the frame
- Plate Detection - Simultaneously detects license plates
- Dual Verification - Both face AND plate must be authorized
- Access Decision - Grant/deny access based on dual authentication
- Logging - Record all authentication attempts
- Live camera feed with overlay information
- Face detection boxes with names
- License plate detection boxes with text
- Authorization status indicators
- Confidence scores for both systems
- 'q' - Quit the system
- 's' - Save current frame
- 'f' - Force face recognition check
- 'p' - Force plate detection check
- 'r' - Generate activity report
- 'c' - Clear detection cache
# Authentication Requirements
REQUIRE_BOTH_FACE_AND_PLATE = True # Dual authentication mode
FACE_CONFIDENCE_THRESHOLD = 0.6 # Face recognition sensitivity
PLATE_CONFIDENCE_THRESHOLD = 0.5 # Plate detection sensitivity
# Timing Configuration
DETECTION_INTERVAL = 1.0 # Seconds between checks
CACHE_DURATION = 30 # Seconds to cache detections
AUTHORIZATION_TIMEOUT = 10 # Seconds for full authorization
# Camera Settings
CAMERA_INDEX = 0 # Camera device index
FRAME_WIDTH = 1280 # Camera resolution width
FRAME_HEIGHT = 720 # Camera resolution heightREQUIRE_BOTH_FACE_AND_PLATE = TrueBoth face and plate must be authorized for access.
REQUIRE_BOTH_FACE_AND_PLATE = FalseEither valid face OR valid plate grants access.
FACE_PRIORITY_MODE = TrueCheck face first, only check plate if face fails.
def smart_cache_detection(face_result, plate_result):
"""Cache results to avoid redundant processing"""
cache_key = f"{face_result}_{plate_result}_{timestamp}"
return authorization_cache.get(cache_key)- Stage 1: Detect presence (any face or plate)
- Stage 2: Identify specific face and plate
- Stage 3: Cross-verify authorization match
- Stage 4: Grant access with full logging
# Configure multiple camera feeds
CAMERA_CONFIGS = [
{"index": 0, "role": "entry", "position": "front"},
{"index": 1, "role": "exit", "position": "rear"},
{"index": 2, "role": "overview", "position": "top"}
]from main import capture_camera_frame
from face_recognition.main_face_recognition import recognize_face_id
from plate_detection.yolo_detect import detect_plate_text
def authorize_access():
"""Main authorization function"""
frame = capture_camera_frame()
# Parallel detection
face_name = recognize_face_id(frame)
plate_text = detect_plate_text(frame)
# Authorization logic
face_authorized = face_name is not None
plate_authorized = is_plate_authorized(plate_text)
return face_authorized and plate_authorized, {
'face': face_name,
'plate': plate_text,
'timestamp': time.time()
}def on_authorization_success(auth_data):
"""Callback for successful authorization"""
print(f"Access granted to {auth_data['face']} with vehicle {auth_data['plate']}")
# Trigger gate opening, lighting, etc.
def on_authorization_failure(auth_data):
"""Callback for failed authorization"""
print(f"Access denied - Face: {auth_data['face']}, Plate: {auth_data['plate']}")
# Trigger security alerts, logging, etc.import cv2
from main import authorize_access
# Simple authorization check
authorized, details = authorize_access()
if authorized:
print(f"Welcome {details['face']}! Vehicle {details['plate']} authorized.")
else:
print("Access denied. Please ensure both face and vehicle are registered.")def parking_lot_monitor():
while True:
authorized, details = authorize_access()
if authorized:
open_gate()
log_entry(details)
send_notification(f"Entry: {details['face']}")
time.sleep(1) # Check every secondimport RPi.GPIO as GPIO # For Raspberry Pi
def hardware_integration():
# GPIO setup for gate control
GPIO.setup(18, GPIO.OUT) # Gate relay
GPIO.setup(24, GPIO.OUT) # Status LED
authorized, details = authorize_access()
if authorized:
GPIO.output(18, GPIO.HIGH) # Open gate
GPIO.output(24, GPIO.HIGH) # Green light
time.sleep(5) # Keep open 5 seconds
GPIO.output(18, GPIO.LOW) # Close gate
GPIO.output(24, GPIO.LOW) # Turn off light- Check
face_recognition/People/directory has photos - Verify camera permissions and lighting
- Test face recognition independently:
cd face_recognition && python main_face_recognition.py
- Verify YOLO models exist in
plate_detection/model/ - Check
authorized_plates.xlsxformat - Test plate detection independently:
cd plate_detection && python yolo_detect.py
- Check import paths in
main.py - Verify both subsystems work independently
- Review error logs in terminal output
- Slow Detection: Reduce camera resolution or enable GPU
- Memory Issues: Close other applications, monitor RAM usage
- CPU Usage: Consider frame skipping or detection intervals
# Enable debug mode in main.py
DEBUG_MODE = True
VERBOSE_LOGGING = True
# Individual system testing
python face_recognition/main_face_recognition.py # Test face system
python plate_detection/yolo_detect.py # Test plate system
python main.py --debug # Debug integration- CPU: Quad-core 2.5GHz
- RAM: 8GB
- Storage: 2GB free space
- Camera: 720p USB webcam
- GPU: NVIDIA RTX 3060 or better
- CPU: 8-core 3.0GHz+
- RAM: 16GB
- Storage: SSD with 5GB free space
- Camera: 1080p with good low-light performance
- GPU: RTX 4080+ or Tesla series
- CPU: 16-core 3.5GHz+
- RAM: 32GB+
- Storage: NVMe SSD
- Camera: 4K with multiple angles
- Network: Gigabit connection for cloud features
# Optimize for speed
FRAME_SKIP = 2 # Process every 2nd frame
FACE_DETECTION_INTERVAL = 2.0 # Face check every 2 seconds
PLATE_DETECTION_INTERVAL = 1.5 # Plate check every 1.5 seconds
PARALLEL_PROCESSING = True # Enable concurrent detection- Biometric Authentication (face recognition)
- Vehicle Authentication (license plate)
- Temporal Validation (time-based access rules)
- Behavioral Analysis (unusual pattern detection)
- Complete Activity Logs - Every detection attempt recorded
- Image Evidence - Auto-captured photos for security review
- Access Reports - Detailed analytics and reporting
- Compliance Export - Data export for security audits
- Liveness Detection - Prevents photo-based spoofing
- Plate Validation - Format and region verification
- Confidence Thresholding - Reject low-confidence detections
- Pattern Analysis - Detect suspicious behavior patterns
# Standard local deployment
python main.py
# Background service (Linux)
nohup python main.py > parking_system.log 2>&1 &
# Windows service
python main.py --serviceFROM python:3.9
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 8080
CMD ["python", "main.py", "--web-interface"]- Google Colab: GPU acceleration for development
- AWS EC2: Scalable cloud hosting
- Azure IoT: Edge device deployment
- Google Cloud: AI/ML optimized instances
- Smart Gates: Automatic barrier control
- LED Indicators: Visual status feedback
- Sensors: Motion detection, vehicle presence
- Alarms: Security breach notifications
- Web Dashboard: Remote monitoring and control
- Mobile Apps: Staff notifications and management
- Payment Systems: Automatic billing integration
- Building Management: HVAC, lighting control
- Active Directory: User authentication
- SIEM Systems: Security event logging
- HR Systems: Employee database sync
- Visitor Management: Temporary access control
GET /api/status # System health check
POST /api/authorize # Manual authorization check
GET /api/logs # Access activity logs
POST /api/users # Add authorized users
GET /api/stats # System statistics
# Configure webhooks for real-time notifications
WEBHOOK_CONFIG = {
"url": "https://your-system.com/parking-events",
"events": ["access_granted", "access_denied", "system_error"],
"authentication": "Bearer your-token"
}- Install dependencies:
pip install -r requirements.txt - Add face photos to
face_recognition/People/ - Configure authorized plates in
plate_detection/authorized_plates.xlsx - Test face recognition:
cd face_recognition && python main_face_recognition.py - Test plate detection:
cd plate_detection && python yolo_detect.py - Run integrated system:
python main.py - Configure authentication mode in
main.py - Test with real users and vehicles
- Set up logging and monitoring
- Deploy to production environment
Ready for Production! This integrated parking lot system provides enterprise-grade security with dual authentication and comprehensive logging.