Find out which Bollywood celebrity or sports personality you look like using advanced facial recognition technology!
- Face Detection: Uses MTCNN for accurate face detection
- Deep Learning: VGGFace with ResNet50 for feature extraction
- High Accuracy: Compares with multiple celebrity images
- Top 5 Matches: Shows your top 5 celebrity matches
- Confidence Scores: Displays match confidence percentages
- Wide Celebrity Database: Includes Bollywood actors and Indian sportspersons
- Python 3.10 (Required for TensorFlow compatibility)
- Webcam or image files for testing
pip install -r requirements.txtstreamlit run celebrity_finder.pyThe app will open in your browser at http://localhost:8501
# Initialize git (if not already done)
git init
git add .
git commit -m "Initial commit for Render deployment"- Go to github.com/new
- Create a new repository (e.g.,
celebrity-lookalike-finder) - Push your code:
git remote add origin https://github.com/YOUR_USERNAME/celebrity-lookalike-finder.git
git branch -M main
git push -u origin main- Go to render.com
- Sign up with GitHub (recommended for easy integration)
- Click "Dashboard"
- Click "New +" → "Web Service"
- Select "Build and deploy from a Git repository"
- Click "Connect" next to your GitHub repository
- Select the repository:
celebrity-lookalike-finder
Basic Settings:
- Name:
celebrity-lookalike-finder - Environment:
Python 3 - Build Command:
pip install --no-cache-dir -r requirements.txt - Start Command:
streamlit run celebrity_finder.py --server.port=8501 --server.address=0.0.0.0
Instance Type: Free (for testing)
Add these environment variables in Render dashboard:
PYTHONUNBUFFERED=1
- Click "Create Web Service"
- Wait for deployment (2-5 minutes)
- Your app will be live at:
https://celebrity-lookalike-finder.onrender.com
The render.yaml file is already configured. You can also deploy by:
- Going to render.com/dashboard
- Click "New +" → "Web Service"
- Select "Build and deploy from Git"
- Render will automatically use
render.yamlconfiguration
├── celebrity_finder.py # Main Streamlit application
├── app.py # Alternative app (older version)
├── extract_features.py # Feature extraction pipeline
├── download_celebrity_images.py # Image downloader setup
├── requirements.txt # Python dependencies
├── Procfile # Render deployment config
├── render.yaml # Render service config
├── .streamlit/config.toml # Streamlit configuration
├── README.md # This file
├── celebrity_images/ # Celebrity image database
├── uploads/ # User uploaded images
├── embedding.pkl # Celebrity facial embeddings
└── filenames.pkl # Celebrity image filenames
- Face Detection: MTCNN detects faces in the uploaded image
- Preprocessing: Face is extracted, padded, and resized to 224x224
- Feature Extraction: VGGFace ResNet50 extracts 2048-dimensional features
- Similarity Matching: Cosine similarity compares with all celebrity embeddings
- Ranking: Top 5 most similar celebrities are displayed with confidence scores
To improve the model's accuracy:
- More Images: Add 30-50 images per celebrity
- Diverse Angles: Include various facial angles and expressions
- Good Quality: Use high-resolution, clear images
- Proper Lighting: Ensure images have good lighting
- Face Clarity: Make sure faces are clearly visible
Current database includes Bollywood actors and Indian sports personalities.
"Dependencies failed to install"
- Ensure Python 3.10 is specified
- Check that all packages in
requirements.txtare compatible - Try removing large packages temporarily
"App crashes on startup"
- Check logs in Render dashboard
- Ensure
embedding.pklandfilenames.pklfiles are present - Verify TensorFlow/Keras versions match
"No face detected"
- Ensure your face is clearly visible
- Use good lighting
- Face the camera directly
- Avoid sunglasses or face coverings
If you get memory errors:
- Use Render's paid plans with more RAM
- Optimize image processing in
extract_features.py - Reduce number of celebrity images processed at once
Set these in Render dashboard if needed:
PYTHONUNBUFFERED=1 # Shows print output immediately
STREAMLIT_SERVER_PORT=8501 # Port for Streamlit
To add more celebrities:
- Create folder:
celebrity_images/category/Celebrity_Name/ - Add 20-50 clear face images
- Run:
python extract_features.py(locally) - Commit and push changes
- Render will auto-redeploy
For issues and questions:
- Check the README troubleshooting section
- Review error messages in the Render logs
- Ensure all files (
embedding.pkl,filenames.pkl) are included
Note: This is a fun project for educational purposes. Results may vary based on the quality and quantity of celebrity images in your database.