This project implements a machine learning solution for recognizing lowercase Greek letters using a custom Neural Network (MLP) with Histogram of Oriented Gradients (HOG) feature extraction. The backend provides an API for preprocessing images, extracting features, and predicting Greek letters with high accuracy.
The neural network is designed from scratch using NumPy and leverages computer vision techniques to preprocess and analyze handwritten Greek letter images. It offers a comprehensive pipeline from image processing to letter recognition.
- Description
- Table of Contents
- Features
- Technical Details
- Installation
- Usage
- Project Structure
- Neural Network Architecture
- API Endpoints
- Contributing
- Frontend Repository
- Custom Neural Network implementation from scratch
- HOG (Histogram of Oriented Gradients) feature extraction
- Image preprocessing pipeline
- FastAPI-based prediction endpoint
- Model training, evaluation, and persistence
- Interactive CLI for model management
- Confusion matrix visualization
- Confidence-based predictions
- Language: Python
- Machine Learning: Custom Neural Network (Multilayer Perceptron)
- Feature Extraction: HOG
- Image Processing: OpenCV
- Web Framework: FastAPI
- Visualization: Matplotlib, Seaborn
- Clone the repository:
git clone https://github.com/your-username/greek-letters-neural-network.git
cd greek-letters-neural-network
python -m venv venv
venv\Scripts\activate # On MacOS, use `source venv/bin/activate`
pip install -r requirements.txt
Running the Application
python greek_letter_recognition.py
-
Training Mode
- Load and preprocess images
- Extract HOG features
- Train neural network
- Evaluate model
- Save trained model
-
Testing Mode
- Load pre-trained model
- Test with individual images
-
Run API Server
- Start FastAPI server for predictions
ia1114_RNA_GreekLetters/
│
├── main.py # Main application script
├── greek_letters_model.pkl # Trained model (name by default once generated)
├── requirements.txt # Project dependencies
└── Greek_Letters/ # Training image dataset
├── alpha/
├── beta/
└── ...
- Input Layer: 3780 HOG features
- Hidden Layer: 392 neurons
- Output Layer: 24 classes (Greek letters)
- Activation Function: Hyperbolic Tangent (tanh)
- Output Activation: Softmax
- Training Algorithm: Backpropagation
- GET /: Health check
- POST /predict: Predict Greek letter from uploaded image .png
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
You can access the frontend repository here