Link to app: https://lfw-face-recognition-demo.streamlit.app/
This project was developed as the final assignment of my Data Science Bootcamp (2025).
The goal was to implement, compare, and deploy different approaches for face recognition using an interactive Streamlit app, providing a hands-on demonstration of machine learnaing technologies.
- Technologies: Python, NumPy, scikit-learn, openCV2, Streamlit
- Algorithms: Principal Component Analysis (PCA), Support Vector Machines (SVM), Cosine Similarity
- Dataset: LFW – Labeled Faces in the Wild fetched from scikit-learn
- Outcome: Interactive face recognition app comparing two model approaches
- Data preprocessing
- Loading & cleaning the LFW dataset
- Normalization
- Hyperparameter tuning
- Grid search for optimal PCA and SVM parameters
- Cross-validation for robust evaluation
- Model training
- Dimensionality reduction using PCA
- Training an SVM classifier
- Cosine similarity as an alternative approach without traditional training
- Evaluation
- Accuracy comparison
- Confusion matrix visualization
- Deployment
- Streamlit app for interactive testing
- SVM model: between 74.87% (19 different targets) and 95.15% (3 different targets) accuracy
- Cosine similarity: between 77.54% (19 different targets) and 96.15% (3 different targets) accuracy
- Screenshot of the app:

# Clone the repository and change into the directory
git clone https://github.com/sergejlembke/streamlit-face-recognition-app.git
cd streamlit-face-recognition-app
# Create and activate a virtual environment (recommended)
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the Streamlit app
streamlit run streamlit_app/main.pyRequired Python version: 3.10 or higher
This project is licensed under the AGPL-3.0 License – see the LICENSE file for details.
This project uses the following third-party dependencies:
- OpenCV (cv2), licensed under the Apache 2.0 License.
- Haar cascade file haarcascade_frontalface_default.xml, part of the OpenCV project and also licensed under the Apache 2.0 License.