help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
face-recognition
/
images
RSK World
face-recognition
Face Recognition Dataset - Face Recognition + Face Verification + Biometric Authentication + Computer Vision
images
  • README.md1.9 KB
train_model.py
train_model.py
Raw Download
Find: Go to:
"""
Main Training Script for Face Recognition Model

This script trains a face recognition model on the dataset.

Project Information:
- Project ID: 22
- Title: Face Recognition Dataset
- Category: Image Data
- Technologies: PNG, JPG, NumPy, OpenCV, Face Recognition
- Difficulty: Intermediate

Contact Information:
RSK World
Founder: Molla Samser
Designer & Tester: Rima Khatun
Email: help@rskworld.in
Phone: +91 93305 39277
Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
Website: https://rskworld.in/
Year: 2026
"""

import os
import sys
import config
from scripts.recognize_faces import FaceRecognizer
from scripts.load_dataset import FaceDatasetLoader


def main():
    """Main training function."""
    print("=" * 60)
    print("Face Recognition Model Training")
    print("=" * 60)
    print(f"Project: Face Recognition Dataset (ID: 22)")
    print(f"RSK World - https://rskworld.in/")
    print("=" * 60)
    print()
    
    # Check if training directory exists
    if not os.path.exists(config.TRAIN_DIR):
        print(f"Error: Training directory not found: {config.TRAIN_DIR}")
        print("Please ensure the dataset is properly organized.")
        print("\nExpected structure:")
        print("  data/train/person_name/image.jpg")
        sys.exit(1)
    
    # Load dataset statistics
    print("Loading dataset...")
    loader = FaceDatasetLoader(config.TRAIN_DIR)
    stats = loader.get_statistics()
    
    print("\nDataset Statistics:")
    print(f"  Total images: {stats['total_images']}")
    print(f"  Total identities: {stats['total_identities']}")
    print(f"  Average images per person: {stats['average_images_per_person']:.2f}")
    print()
    
    # Initialize recognizer
    recognizer = FaceRecognizer(tolerance=config.TOLERANCE)
    
    # Train the model
    print("Starting training...")
    recognizer.train(config.TRAIN_DIR, save_model=config.SAVE_MODEL)
    
    print("\n" + "=" * 60)
    print("Training completed successfully!")
    print(f"Model saved to: {recognizer.model_path}")
    print("=" * 60)


if __name__ == "__main__":
    main()

76 lines•2.1 KB
python
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer