A secure, modern banking application with facial recognition authentication using a custom-trained Convolutional Neural Network (CNN).
Muhammad Hanzlah
📧 Contact: codewithhanzlah@gmail.com
🎓 Arfa Kareem Technology Incubators - 6 Month Course Final Project
This is a full-stack web application that combines:
- 🧠 Deep Learning (96% accuracy face recognition model)
- 🌐 Web Development (Flask backend + modern frontend)
- 💰 Banking System (complete financial operations)
- 🔐 Biometric Security (passwordless login via face scan)
Key Feature: Face authentication replaces traditional password login, providing a seamless and secure banking experience.
- Face Recognition Login: CNN model with 96% accuracy
- Biometric Authentication: No password needed for login
- Session Management: Secure 30-minute sessions
- 3-Attempt Limit: Prevents brute force attacks
- Password Protection: Required for sensitive operations (withdraw, transfer)
- ✅ Check Balance: Real-time balance display
- ✅ Deposit Money: Instant deposits with voice confirmation
- ✅ Withdraw Money: Secure withdrawals (password required)
- ✅ Transfer to Beneficiary: Send money to saved contacts
- ✅ Beneficiary Management: Save and view beneficiaries
- ✅ Transaction History: Complete audit trail with timestamps
- ✅ Voice Announcements: Audio feedback for transactions
- Modern, responsive design (works on mobile + desktop)
- Smooth animations and transitions
- Real-time camera preview
- Confidence score display during authentication
- Voice feedback for key actions
- Professional banking interface
- Framework: Flask 3.0
- Language: Python 3.8+
- Session Management: Flask sessions with secure cookies
- Framework: PyTorch 2.2
- Model: ResNet18 (Transfer Learning)
- Face Detection: MTCNN (FaceNet PyTorch)
- Accuracy: 96% on validation set
- Training Dataset: 233 authorized + 300+ unauthorized face samples
- HTML5: Semantic markup
- CSS3: Modern styling with animations
- JavaScript: Camera access, AJAX, voice synthesis
- WebRTC: Real-time camera streaming
torch&torchvision: Deep learningopencv-python: Image processingfacenet-pytorch: Face detection (MTCNN)pillow: Image manipulationpyttsx3: Text-to-speech (backend)Web Speech API: Text-to-speech (frontend)
face_banking_system/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── README.md # This file
├── face_recognition_model.pth # Trained CNN model (96% accuracy)
├── .gitignore # Git ignore rules
│
├── utils/
│ ├── __init__.py
│ ├── face_auth.py # Face authentication (singleton)
│ ├── banking.py # Banking logic & Account class
│ └── decorators.py # Route protection decorators
│
├── static/
│ ├── css/
│ │ └── style.css # Modern banking design
│ ├── js/
│ │ └── script.js # Frontend logic
│ └── images/
│ └── logo.png # Bank logo (optional)
│
└── templates/
├── face_login.html # Face scan login page
├── welcome.html # Welcome splash screen
├── dashboard.html # Main banking dashboard
├── deposit.html # Deposit page
├── withdraw.html # Withdraw page
├── transfer.html # Transfer to beneficiary
├── save_beneficiary.html # Save new beneficiary
├── beneficiaries.html # View all beneficiaries
└── history.html # Transaction history
- Python 3.8 or higher
- Webcam (for face authentication)
pippackage manager
git clone <your-repo-url>
cd face_banking_systempip install -r requirements.txt- Place your trained
face_recognition_model.pthfile in the project root - This file should be the output from your Google Colab training
python app.pyOpen browser and navigate to:
http://127.0.0.1:5000
- Open the application
- Position your face in front of the camera
- Click "Scan Face" button
- System detects and authenticates your face
- Shows confidence score (must be ≥85%)
- Full-screen welcome message
- Voice announcement: "Welcome Muhammad Hanzlah"
- Automatic redirect to dashboard after 3 seconds
- View current balance
- Access quick actions (deposit, withdraw, transfer)
- See recent transactions
- Navigate to any banking feature
- Deposit: No password required
- Withdraw: Password required (enter your configured password)
- Transfer: Select beneficiary, enter amount, password required
- Save Beneficiary: Add new contact with 11-digit account number
- Complete transaction log
- Timestamps for all operations
- Filter by transaction type
- Secure logout from any page
- Clears session completely
- Base Model: ResNet18 (pre-trained on ImageNet)
- Transfer Learning: Froze early layers (conv1-layer3)
- Fine-tuned: Layer4 + custom classifier
- Classes: 2 (Authorized / Unauthorized)
- Dataset: 233 authorized faces + 300+ unauthorized faces
- Data Augmentation: Rotation, flip, brightness, zoom
- Epochs: 50 (with early stopping)
- Optimizer: Adam (with filtered parameters)
- Loss: CrossEntropyLoss
- Validation Accuracy: 96%
- Library: MTCNN (Multi-task Cascaded Convolutional Networks)
- Confidence Threshold: 90% for face detection
- Authentication Threshold: 85% for authorization
Edit config.py to customize:
# Authentication
FACE_CONFIDENCE_THRESHOLD = 85.0 # Min confidence for login
MAX_LOGIN_ATTEMPTS = 3
# Account Details
# Sensitive values loaded from environment variables
# Session
PERMANENT_SESSION_LIFETIME = 30 # minutes- Face Authentication: 96% accurate CNN model
- Session Management: Expires after 30 minutes
- Attempt Limiting: 3 failed attempts = lockout
- Password Protection: Required for withdrawals/transfers
- HTTPS Ready: Can be deployed with SSL certificate
- No Credential Storage: Face features extracted on-the-fly
- Model Accuracy: 96%
- False Accept Rate: <3%
- False Reject Rate: <5%
- Face Detection Speed: ~100-200ms
- Authentication Speed: ~300-500ms
- Total Login Time: <1 second
This project demonstrates proficiency in:
- ✅ Deep Learning (CNN, Transfer Learning)
- ✅ Computer Vision (Face Detection, Recognition)
- ✅ Web Development (Flask, HTML/CSS/JS)
- ✅ System Design (MVC pattern, Singleton)
- ✅ Security (Session management, Authentication)
- ✅ User Experience (Modern UI, Voice feedback)
- ✅ Software Engineering (Clean code, Documentation)
- Requires good lighting for face detection
- Single-user system (designed for one account holder)
- In-memory data storage (resets on restart)
- Requires webcam access
- Multi-user support
- Database integration (PostgreSQL/MySQL)
- Mobile app version
- Liveness detection (anti-spoofing)
- Dark mode toggle
- Multi-factor authentication (face + OTP)
- Email notifications for transactions
- API for third-party integrations
This project is created for educational purposes as part of a 6-month course final project.
- Instructor: Sir Saad
- Institute: Arfa Kareem Technology Incubators
- Course: 6-Month Generative AI Course
- PyTorch: For the deep learning framework
- MTCNN: For face detection capabilities
- Flask: For the web framework
Muhammad Hanzlah
📧 codewithhanzlah@gmail.com
🔗 github.com/codewithhanzlah
🔗 linkedin.com/in/codewithhanzlah
⭐ If you found this project interesting, please star the repository!