A robust framework for deploying AI models on mobile devices with hardware acceleration support for MediaTek and Qualcomm platforms.
- Hardware acceleration support for:
- MediaTek APU (via NeuroPilot SDK)
- Qualcomm Hexagon DSP (via Snapdragon Neural Processing SDK)
- Fallback to ARM CPU and GPU
- Multiple model format support:
- TensorFlow Lite
- PyTorch Mobile
- ONNX Runtime
- Efficient memory and power management
- Android HAL integration
- Security features with Android Keystore
- Android SDK 21+ (Android 5.0 or higher)
- Android NDK r21+
- CMake 3.18.1+
- Hardware-specific SDKs:
- MediaTek NeuroPilot SDK
- Qualcomm Neural Processing SDK
mobile-ai/
├── app/
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── com/
│ │ │ │ └── mobileai/
│ │ │ │ ├── core/
│ │ │ │ ├── hardware/
│ │ │ │ └── inference/
│ │ │ └─�� cpp/
│ │ │ ├── hardware/
│ │ │ ├── inference/
│ │ │ └── core/
│ │ └── test/
│ └── build.gradle
├── libs/
├── docs/
├── examples/
└── benchmarks/- Clone the repository:
git clone https://github.com/yourusername/mobile-ai.git- Install dependencies:
- Download and install Android Studio
- Install the Android NDK and CMake through Android Studio's SDK Manager
- Download the required hardware-specific SDKs from MediaTek and Qualcomm
- Build the project:
./gradlew build// Initialize hardware manager
val hardwareManager = HardwareManager()
hardwareManager.initialize()
// Create model manager
val modelManager = ModelManager(hardwareManager)
// Load and run model
modelManager.loadModel("model.tflite", ModelFormat.TFLITE)
val input = floatArrayOf(/* your input data */)
val output = modelManager.runInference(input)// Check available accelerators
val accelerators = hardwareManager.getAvailableAccelerators()
println("Available accelerators: $accelerators")
// Set preferred accelerator
hardwareManager.setPreferredAccelerator(HardwareManager.ACCELERATOR_MTK)-
Model Optimization:
- Use quantization to reduce model size
- Apply pruning to remove unnecessary weights
- Convert to hardware-specific formats when possible
-
Hardware Acceleration:
- Prioritize hardware accelerators over CPU
- Use batch processing when appropriate
- Implement proper power management
-
Memory Management:
- Implement model caching
- Use memory-mapped files for large models
- Release resources when not in use
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- MediaTek for NeuroPilot SDK
- Qualcomm for Neural Processing SDK
- TensorFlow, PyTorch, and ONNX Runtime teams