{"id":24158081,"url":"https://github.com/aneeshpatne/facerecognitionattendencesystem","last_synced_at":"2025-08-12T00:40:21.723Z","repository":{"id":194821045,"uuid":"549538579","full_name":"aneeshpatne/FaceRecognitionAttendenceSystem","owner":"aneeshpatne","description":"Automated Face Recognition Attendance System using ML classifiers for real-time tracking through webcam with CSV logging capabilities.","archived":false,"fork":false,"pushed_at":"2024-11-22T10:49:47.000Z","size":73723,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T14:19:30.720Z","etag":null,"topics":["attendance","facerecognition","haar-cascade-classifier","ml","naive-bayes-classifier"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aneeshpatne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-10-11T10:41:22.000Z","updated_at":"2024-11-22T11:19:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d6b92da-8997-4054-9ac8-e303052c1516","html_url":"https://github.com/aneeshpatne/FaceRecognitionAttendenceSystem","commit_stats":null,"previous_names":["aneeshpatne/facerecognitionattendencesystem"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshpatne%2FFaceRecognitionAttendenceSystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshpatne%2FFaceRecognitionAttendenceSystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshpatne%2FFaceRecognitionAttendenceSystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshpatne%2FFaceRecognitionAttendenceSystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aneeshpatne","download_url":"https://codeload.github.com/aneeshpatne/FaceRecognitionAttendenceSystem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241446188,"owners_count":19964133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attendance","facerecognition","haar-cascade-classifier","ml","naive-bayes-classifier"],"created_at":"2025-01-12T14:19:39.547Z","updated_at":"2025-08-12T00:40:21.688Z","avatar_url":"https://github.com/aneeshpatne.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎯 Face Recognition Attendance System\n\n[![Python](https://img.shields.io/badge/Python-3.7+-blue.svg)](https://www.python.org/)\n[![OpenCV](https://img.shields.io/badge/OpenCV-4.x-green.svg)](https://opencv.org/)\n[![scikit-learn](https://img.shields.io/badge/scikit--learn-latest-orange.svg)](https://scikit-learn.org/)\n\nA sophisticated real-time attendance management system powered by advanced facial recognition technology. This system leverages multiple machine learning algorithms to provide accurate face detection and recognition with comprehensive attendance tracking capabilities.\n\n## ✨ Key Features\n\n### 🔍 Advanced Face Recognition\n\n- **Real-time face detection** using OpenCV and webcam integration\n- **High-accuracy face recognition** with face_recognition library\n- **Multi-algorithm support** with performance comparison\n- **Unknown face detection** with confidence thresholds\n\n### 🤖 Machine Learning Models\n\n- **K-Nearest Neighbors (KNN)** - Primary classifier with distance weighting\n- **Support Vector Machine (SVM)** - Linear kernel with probability estimation\n- **Random Forest** - Ensemble method for robust predictions\n- **Naive Bayes** - Gaussian implementation for baseline comparison\n\n### 📊 Attendance Management\n\n- **Entry/Exit tracking** with timestamp logging\n- **CSV-based records** for easy data analysis\n- **Date and time stamping** with automatic formatting\n- **User confirmation system** to prevent false entries\n- **Duplicate prevention** and validation checks\n\n### 🎛️ User Interface\n\n- **Interactive webcam display** with real-time face detection boxes\n- **Visual feedback** with name labels and confidence indicators\n- **Console-based controls** for entry/exit selection\n- **Error handling** and user-friendly prompts\n\n## 🏗️ Project Architecture\n\n```\nFaceRecognitionAttendanceSystem/\n├── 📁 classifier/                  # Trained model storage\n│   └── trained_knn_model.clf      # Serialized KNN model\n├── 📁 train_image/                 # Training dataset\n│   ├── person1/                    # Individual person folders\n│   ├── person2/                    # Multiple images per person\n│   └── ...                         # Organized by name\n├── 📄 FaceRecogKnn.py             # Main recognition engine\n├── 📄 Train_main.py               # Model training pipeline\n├── 📄 attendance.csv              # Attendance records\n└── 📄 README.md                   # Documentation\n```\n\n## 🚀 Quick Start\n\n### Prerequisites\n\nEnsure you have Python 3.7+ installed, then install the required dependencies:\n\n```bash\npip install opencv-python\npip install face-recognition\npip install scikit-learn\npip install pandas\npip install numpy\npip install matplotlib\n```\n\n### Installation \u0026 Setup\n\n1. **Clone or download** this repository to your local machine\n\n2. **Prepare training data:**\n\n   ```bash\n   # Create individual folders for each person\n   mkdir train_image/john_doe\n   mkdir train_image/jane_smith\n\n   # Add 5-10 clear face images per person\n   # Images should be well-lit with clear facial features\n   ```\n\n3. **Train the models:**\n\n   ```bash\n   python Train_main.py\n   ```\n\n   This will:\n\n   - Process all training images\n   - Extract facial encodings\n   - Train multiple ML models\n   - Display accuracy metrics\n   - Save the best performing model\n\n4. **Run the attendance system:**\n   ```bash\n   python FaceRecogKnn.py\n   ```\n\n## 🔧 Detailed Usage\n\n### Training New Users\n\n1. Create a folder named with the person's full name (e.g., `john_doe`)\n2. Add 5-10 high-quality face images:\n   - Well-lit environment\n   - Clear facial features\n   - Different angles and expressions\n   - Consistent lighting conditions\n3. Run the training script to update models\n\n### Recording Attendance\n\n1. Launch the recognition system\n2. Position yourself in front of the webcam\n3. Wait for face detection and recognition\n4. Select option:\n   - `1` for Entry time\n   - `2` for Exit time\n5. Confirm the detected identity\n6. Attendance is automatically logged\n\n### Monitoring Performance\n\nThe system provides real-time feedback:\n\n- **Green box**: Successfully recognized face\n- **Red text**: Person's name with confidence\n- **Console output**: Recognition status and options\n\n## 📈 Model Performance\n\nThe system trains and evaluates four different algorithms:\n\n| Algorithm         | Typical Accuracy | Strengths                                         |\n| ----------------- | ---------------- | ------------------------------------------------- |\n| **KNN**           | 85-95%           | Fast prediction, good with small datasets         |\n| **SVM**           | 80-90%           | Robust to outliers, works well in high dimensions |\n| **Random Forest** | 75-85%           | Handles overfitting, provides feature importance  |\n| **Naive Bayes**   | 70-80%           | Fast training, good baseline performance          |\n\n### Performance Optimization Tips\n\n- **Image Quality**: Use high-resolution, well-lit images\n- **Dataset Size**: Minimum 5 images per person, ideally 10+\n- **Consistency**: Maintain similar lighting and camera conditions\n- **Threshold Tuning**: Adjust recognition threshold based on accuracy needs\n\n## 📊 Attendance Data Format\n\nThe system generates structured attendance records:\n\n```csv\nName,Date,Time,Entry/Exit\njohn_doe,27/6/2025,09:15:32,Entry\njane_smith,27/6/2025,09:16:45,Entry\njohn_doe,27/6/2025,17:30:15,Exit\njane_smith,27/6/2025,17:32:08,Exit\n```\n\n### Data Fields\n\n- **Name**: Recognized person identifier\n- **Date**: DD/MM/YYYY format\n- **Time**: HH:MM:SS format (24-hour)\n- **Entry/Exit**: Attendance type\n\n## 🛠️ Technical Implementation\n\n### Core Components\n\n#### Face Detection Pipeline\n\n```python\n# Frame processing workflow\nframe → resize → color_convert → face_locations → face_encodings → prediction\n```\n\n#### Recognition Algorithm\n\n- Uses dlib's face recognition model\n- Generates 128-dimensional face encodings\n- Applies distance-based matching with KNN\n- Implements confidence thresholds for unknown faces\n\n#### Training Process\n\n- Automatically processes training images\n- Extracts facial features using face_recognition\n- Splits data into train/test sets (80/20)\n- Trains multiple classifiers simultaneously\n- Evaluates and compares model performance\n\n## 🔧 Configuration Options\n\n### Recognition Threshold\n\nAdjust in `FaceRecogKnn.py`:\n\n```python\nthreshold = 0.6  # Lower = more strict, Higher = more lenient\n```\n\n### Model Parameters\n\nCustomize in `Train_main.py`:\n\n```python\nn_neighbors = 2        # KNN neighbors\ntest_size = 0.2       # Train/test split ratio\nmax_depth = 2         # Random Forest depth\n```\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n**No face detected:**\n\n- Ensure good lighting\n- Position face clearly in camera view\n- Check camera permissions\n\n**Low accuracy:**\n\n- Add more training images\n- Improve image quality\n- Retrain the model\n\n**Recognition errors:**\n\n- Adjust threshold values\n- Add more diverse training data\n- Check for similar-looking individuals\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your improvements\n4. Test thoroughly\n5. Submit a pull request\n\n## 📄 License\n\nThis project is open-source and available under the MIT License.\n\n## 🙏 Acknowledgments\n\n- **face_recognition** library by Adam Geitgey\n- **OpenCV** for computer vision capabilities\n- **scikit-learn** for machine learning algorithms\n- **dlib** for facial landmark detection\n\n---\n\n_Built with ❤️ for efficient attendance management_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshpatne%2Ffacerecognitionattendencesystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faneeshpatne%2Ffacerecognitionattendencesystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshpatne%2Ffacerecognitionattendencesystem/lists"}