Metadata-Version: 2.4
Name: lowmind
Version: 1.8.1
Summary: Ultra-lightweight Deep Learning Framework for Raspberry Pi
Home-page: https://github.com/dhaval-gamet/lowmind
Author: VEDRA
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.19.0
Requires-Dist: psutil>=5.8.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

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

<div align="center">

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

[![Python Version](https://img.shields.io/badge/python-3.6%2B-blue)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![Framework](https://img.shields.io/badge/framework-lowmind-orange)](https://github.com/dhavalgameti/lowmind)
[![Platform](https://img.shields.io/badge/platform-raspberry%20pi-red)](https://www.raspberrypi.org/)

*"Democratizing Deep Learning for Resource-Constrained Environments"*

</div>

## 🚀 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
```bash
# Required packages
pip install numpy psutil

# For Raspberry Pi
sudo apt update
sudo apt install python3-pip python3-numpy python3-psutil
```

### Installation Steps
```bash
# Clone the repository
git clone https://github.com/dhavalgamet/lowmind.git
cd lowmind 
```

## 📖 Quick Example

```python
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
```python
# 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
```python
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
```python
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](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

---

<div align="center">

**Built with ❤️ in India by Dhaval Gameti**

*Empowering education and innovation in resource-constrained environments*

[🇮🇳](https://via.placeholder.com/20x13/FF9933/FFFFFF?text=+)
[🇮🇳](https://via.placeholder.com/20x13/FFFFFF/000000?text=+)
[🇮🇳](https://via.placeholder.com/20x13/138808/FFFFFF?text=+)

</div>

## ⚠️ 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!* ⭐
