Ich präsentiere eine Web App, in der Bilder hochgeladen werden können, um Politiker zu erkennen. Das Maschinenlernmodell identifiziert Politiker wie Trump, Macron, Scholz, Putin und Jinping . Es zeigt die Wahrscheinlichkeit, dass diese Politiker auf den Bildern sind. Ich erkläre den Prozess von der Datenvorbereitung bis zum Modelltraining und zeige, wie die App funktioniert. Es wird auch die Implementierung der Gesichtserkennung und die Darstellung der Ergebnisse erklärt. Am Ende exportiere ich das Modell und die Daten für die weitere Verwendung in der Benutzeroberfläche. more info: https://mappp.de/data-and-tech/

GitHub Link

Face Classification Project

Overview

This project aims to classify the faces of famous politicians using machine learning algorithms and deploy the model via a Python Flask app.

Project Structure

  • requirements.txt: List of required packages.
  • notebook: Jupyter notebook for data cleaning, face detection, feature extraction, and model training.
  • server.py: Flask server setup.
  • util.py: Utility functions for image processing and model prediction.
  • UI: Frontend code using HTML, CSS, and JavaScript.

Requirements

plaintext

PyWavelets==0.5.2
opencv-python==4.5.1.48
seaborn==0.8.1

Steps to Run the Project

  1. Data Cleaning:
    • Clean the dataset to remove any irrelevant or duplicate entries.
  2. Face Detection:
    • Use OpenCV to crop all the faces in the images.
  3. Feature Extraction:
    • Convert cropped faces into Wavelets for detailed feature detection.
  4. Model Training:
    • Use GridSearch to try different ML algorithms and hyperparameters.
    • Choose SVM algorithm and save the trained model as a pickle file.
  5. Setting up Flask App:
    • Create a Flask application to serve the model and classify images.
    • Define image classification endpoint in server.py.
  6. Utility Functions:
    • Write functions for image classification, loading the model, and other utility tasks in util.py.
  7. Frontend:
    • Develop a user interface with HTML, CSS, and JavaScript.
    • Display images of possible politicians and show classification results.

Running the Flask App

  1. Ensure you have all the required packages installed.
  2. Run the Flask app using:bash
    python server.py
  3. Access the app in your browser at http://127.0.0.1:5000.

Notes

  • The model is trained to identify faces of famous politicians.
  • The frontend allows users to upload an image, which is then classified by the model.

thanks to: codebasics – YouTube for the guidance during the project