Skip to content

TusharNegi6986/HashNode_HackGen

Repository files navigation

Smart Attendance & Notes MVP

A Django-based web application for automated attendance tracking using face recognition technology, along with notes management system.

Features

  • Multi-role Authentication: Students, Faculty, and Admin roles
  • Face Recognition: Automated attendance marking using live camera
  • Manual Attendance: Traditional checkbox-based attendance marking
  • Notes Management: Faculty can upload notes, students can download
  • Dashboard: Role-based dashboards with attendance analytics
  • Responsive Design: Bootstrap 5 with mobile-first approach

Tech Stack

  • Backend: Django 4.2 + Django REST Framework
  • Frontend: Django Templates + Bootstrap 5 + Vanilla JavaScript
  • Face Recognition: face_recognition (dlib) + OpenCV + NumPy
  • Database: SQLite (development) / PostgreSQL (production ready)
  • Storage: Django Media for uploaded files

Installation

Prerequisites

  • Python 3.8+
  • pip
  • Virtual environment (recommended)

Note for Windows users: The face_recognition library requires Visual Studio Build Tools or Visual Studio Community with C++ development tools.

Setup Steps

  1. Clone the repository ```bash git clone cd smart-attendance-mvp ```

  2. Create and activate virtual environment ```bash python -m venv venv

    On Windows

    venv\Scripts\activate

    On macOS/Linux

    source venv/bin/activate ```

  3. Install dependencies ```bash pip install -r requirements.txt ```

  4. Set up environment variables (optional) Create a .env file in the project root: ``` SECRET_KEY=your-secret-key-here DEBUG=True ```

  5. Run database migrations ```bash python manage.py makemigrations python manage.py migrate ```

  6. Create superuser ```bash python manage.py createsuperuser ```

  7. Load demo data (optional) ```bash python manage.py seed_demo ```

  8. Run the development server ```bash python manage.py runserver ```

  9. Access the application

Usage

For Students

  1. Sign up with role "Student" and provide roll number
  2. Upload face images in Profile section for face recognition
  3. View attendance statistics on dashboard
  4. Download notes uploaded by faculty

For Faculty

  1. Sign up with role "Faculty"
  2. Create attendance sessions
  3. Mark attendance manually or use live camera recognition
  4. Upload notes for students
  5. View attendance reports

For Admins

  1. Manage users, subjects, and view system-wide analytics
  2. Post announcements
  3. Generate attendance reports

Face Recognition Setup

  1. Upload Face Images: Students must upload clear face photos in their profile
  2. Camera Permissions: Allow camera access when using live recognition
  3. Lighting: Ensure good lighting for better recognition accuracy
  4. Distance: Maintain 2-3 feet distance from camera for optimal results

API Endpoints

  • POST /api/upload-face/ - Upload face image for recognition
  • POST /api/recognize/ - Process camera frame for face recognition
  • POST /api/mark-manual/ - Manual attendance marking
  • GET /api/attendance/student/<id>/ - Get student attendance data

Configuration

Face Recognition Settings

In config/settings.py:

  • FACE_RECOGNITION_THRESHOLD = 0.45 - Recognition confidence threshold
  • FACE_RECOGNITION_TOLERANCE = 0.6 - Face matching tolerance

Production Deployment

  1. Set DEBUG = False
  2. Configure PostgreSQL database
  3. Set up proper media file serving (AWS S3, etc.)
  4. Use HTTPS for camera access
  5. Configure proper CORS settings

Troubleshooting

Common Issues

  1. Face recognition library installation fails

    • Install Visual Studio Build Tools (Windows)
    • Install cmake: pip install cmake
  2. Camera not working

    • Check browser permissions
    • Ensure HTTPS in production
    • Try different browsers
  3. No face detected

    • Ensure good lighting
    • Face should be clearly visible
    • Try different angles
  4. Poor recognition accuracy

    • Upload multiple face images
    • Adjust FACE_RECOGNITION_THRESHOLD in settings
    • Ensure consistent lighting conditions

Development

Project Structure

``` smart-attendance-mvp/ ├── config/ # Django settings ├── users/ # User management app ├── attendance/ # Core attendance app ├── templates/ # HTML templates ├── static/ # CSS, JS, images ├── media/ # Uploaded files ├── scripts/ # Database scripts └── requirements.txt ```

Adding New Features

  1. Create new Django apps for major features
  2. Follow the existing code structure
  3. Add appropriate tests
  4. Update documentation

License

This project is created for educational and hackathon purposes.

Support

For issues and questions, please check the troubleshooting section or create an issue in the repository.

About

Hackathon project for HackGen

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors