Ultra-lightweight Deep Learning Framework for Raspberry Pi
Project description
LowMind - Ultra-Lightweight Deep Learning Framework for Low-End Devices
Deep Learning on Raspberry Pi and Low-End Devices Made Possible
"Democratizing Deep Learning for Resource-Constrained Environments"
🚀 Overview
LowMind is an ultra-optimized deep learning framework specifically designed for low-end devices like Raspberry Pi, embedded systems, and resource-constrained environments. Built from scratch by a solo developer in India, this framework prioritizes memory efficiency and computational optimization over feature bloat.
🎯 Key Philosophy
"Simplicity with Power" - Enabling deep learning capabilities on devices where traditional frameworks fail due to memory and computational constraints.
✨ Features
🧠 Memory Optimization
- Ultra-Low Memory Footprint: Conservative memory management with 64MB default limit
- Lazy Gradient Allocation: Gradients allocated only when required
- Intelligent Memory Manager: LRU-based tensor cleanup and aggressive garbage collection
- Chunked Operations: Large matrix operations processed in memory-friendly chunks
⚡ Performance Enhancements
- Raspberry Pi Optimized: Specialized for ARM architecture and limited resources
- Efficient Tensor Operations: Optimized forward and backward passes
- Minimal Dependencies: Pure NumPy implementation, no heavy dependencies
- Real-time Monitoring: Comprehensive system health monitoring
🔧 Technical Capabilities
- Automatic Differentiation: Custom backward pass implementation
- Neural Network Layers: Linear, Conv2d, Dropout, Activation functions
- Loss Functions: Cross-entropy, MSE with memory-efficient implementations
- Optimizers: SGD with momentum and weight decay support
🛠 Installation
Prerequisites
# Required packages
pip install numpy psutil
# For Raspberry Pi
sudo apt update
sudo apt install python3-pip python3-numpy python3-psutil
Installation Steps
# Clone the repository
git clone https://github.com/dhavalgamet/lowmind.git
cd lowmind
📖 Quick Example
import lowmind as lm
import numpy as np
# Create a simple neural network
class SimpleNN(lm.Module):
def __init__(self):
super().__init__()
self.fc1 = lm.Linear(784, 128)
self.fc2 = lm.Linear(128, 10)
def forward(self, x):
x = self.fc1(x).relu()
x = self.fc2(x)
return x
# Initialize model and data
model = SimpleNN()
x = lm.Tensor(np.random.randn(32, 784))
y = lm.Tensor(np.random.randint(0, 10, (32,)))
# Forward pass
output = model(x)
loss = lm.cross_entropy_loss(output, y)
# Backward pass
loss.backward()
print(f"Loss: {loss.item()}")
🏗 Architecture
Core Components
1. Memory Manager
# Advanced memory management for Raspberry Pi
memory_manager = MemoryManager(max_memory_mb=64)
Features:
- LRU-based tensor eviction
- Aggressive memory cleanup
- Real-time memory monitoring
- System health scoring
2. Tensor Operations
- Element-wise operations with gradient tracking
- Matrix multiplication with chunking support
- Broadcasting with memory efficiency
- Lazy gradient initialization
3. Neural Network Modules
- Linear: Fully connected layers
- Conv2d: 2D convolutional layers (memory-optimized)
- Dropout: Regularization with training/eval modes
- Activation Functions: ReLU, Sigmoid, Tanh
📊 Performance Metrics
Memory Efficiency
| Operation | LowMind Memory Usage | Typical Framework Usage |
|---|---|---|
| Tensor Creation | ~1-5MB | ~10-50MB |
| Backward Pass | Minimal overhead | Significant overhead |
| Model Training | 64MB limit | Often 500MB+ |
Raspberry Pi Compatibility
- ✅ Runs on Raspberry Pi Zero
- ✅ Compatible with all RPi models
- ✅ Minimal CPU temperature impact
- ✅ Real-time system monitoring
🔍 Advanced Usage
Memory Monitoring
from lowmind import memory_manager, RaspberryPiAdvancedMonitor
# Monitor system health
monitor = RaspberryPiAdvancedMonitor()
stats = monitor.get_system_stats()
print(f"CPU Temp: {stats['cpu_temp']}°C")
print(f"Memory Usage: {stats['allocated_mb']:.1f}MB")
# Get detailed memory info
mem_info = memory_manager.get_memory_info()
Custom Layer Development
class CustomLayer(lm.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.weights = lm.Tensor(
np.random.randn(output_size, input_size) * 0.01,
requires_grad=True,
name="custom_weights"
)
def forward(self, x):
return x @ self.weights.T
🎯 Use Cases
Ideal For:
- 🎓 Educational Projects: Learn DL fundamentals without powerful hardware
- 🔬 Research Prototyping: Quick experimentation on low-end devices
- 📱 Edge AI Applications: Deploy models on resource-constrained devices
- 🏭 IoT and Embedded Systems: On-device training and inference
Not Recommended For:
- Large-scale production systems
- Big data processing
- High-performance computing clusters
🤝 Contributing
As a solo developer project, LowMind welcomes:
- Bug reports and fixes
- Performance optimizations
- Documentation improvements
- Raspberry Pi-specific enhancements
Current Development Focus:
- Memory optimization
- Computational efficiency
- Raspberry Pi compatibility
- Educational value
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Developer: Dhaval Gameti (Solo Developer from India)
Special Thanks To:
- Raspberry Pi Foundation for making affordable computing accessible
- Open source community for inspiration and learning resources
- Educators and students who test and provide feedback
🔮 Future Roadmap
- Quantization support for further memory reduction
- More optimizer implementations (Adam, RMSprop)
- Additional layer types (LSTM, GRU)
- Model export/import functionality
- Distributed training support for multiple Pis
📞 Support
For issues, questions, or contributions:
- Check existing GitHub issues
- Create a new issue with detailed description
- Provide system specifications and error logs
Built with ❤️ in India by Dhaval Gameti
Empowering education and innovation in resource-constrained environments
⚠️ Important Note
This framework is specifically designed for educational purposes and low-resource environments. It represents what a dedicated solo developer can achieve with focus on optimization and accessibility rather than feature completeness.
Remember: The goal is learning and enabling AI on affordable hardware, not competing with established frameworks like PyTorch or TensorFlow.
Star this repository if you find it helpful for your educational journey in deep learning! ⭐
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lowmind-1.8.1.tar.gz.
File metadata
- Download URL: lowmind-1.8.1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff734158f8918080e647d9a5e5e056d65b0432c34d938812a07979ea1535c2bc
|
|
| MD5 |
305d26beeb96945975a0525230bf35aa
|
|
| BLAKE2b-256 |
9c15b8699a529d0cd8d60dd2cba7de509a8108f52a1c9622a52f17b3cab76d02
|
File details
Details for the file lowmind-1.8.1-py3-none-any.whl.
File metadata
- Download URL: lowmind-1.8.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd199e03846492440cfa657ec482d8ed9d3d85d79dc7ad35d7bd9ebb141e7c04
|
|
| MD5 |
0ac24c86cb8539eb8ca81dc8b845b478
|
|
| BLAKE2b-256 |
58e72e9888162e845afd1c83aab9eba5dec793bbb88f813d5906038a0cb2e276
|