Skip to main content

Ultra-lightweight deep learning framework for Raspberry Pi and embedded systems

Project description

LowMind - Ultra-Lightweight Deep Learning Framework for Low-End Devices

Deep Learning on Raspberry Pi and Low-End Devices Made Possible

Python Version License Framework Platform

"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:

  1. Check existing GitHub issues
  2. Create a new issue with detailed description
  3. 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lowmind-2.1.0-py3-none-any.whl (55.0 kB view details)

Uploaded Python 3

File details

Details for the file lowmind-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: lowmind-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 55.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lowmind-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60d6a048038c84766224cba30d0874354a3cc18278d6b8e23c0b0c0370e876c4
MD5 b578077ec2c84a0f1eed03038d6ef487
BLAKE2b-256 eb75033551ea5ae3a630d32e9262deb30a449b49e53c9d4ce78ef980c4811065

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page