This repository contains the end-to-end pipeline for porting, verifying, and deploying Neural Network (NN) models from the nn-dataset to VR/Android devices using Unity and Barracuda.
- Python 3.8+
- Unity 2022.3+ (with Android Build Support & IL2CPP)
- Android Studio (for SDK/ADB)
- VR Headset (Meta Quest 2/3/Pro) in Developer Mode
For Linux/Mac:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pipFor Windows:
python3 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pipInstall the project dependencies and PyTorch (CUDA 12.6):
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu126This installs the core dataset and logic required to fetch/train models. Warning: This clears the local db folder.
rm -rf db
pip install --no-cache-dir git+https://github.com/ABrain-One/nn-dataset --upgrade --force --extra-index-url https://download.pytorch.org/whl/cu126If you need a fresh Android Studio installation:
chmod +x install-android-studio.sh
./install-android-studio.shThe main entry point is port.py. It handles:
- Fetching/Training: Gets the model from
nn-dataset. - Validation: Checks VR compatibility (Size, Ops).
- Import: Copies model to Unity project (
unity_nn). - Build: Auto-builds APK if missing.
- Deploy & Run: Pushes to connected Android/VR device and runs inference.
Single Model Run:
python port.py AirNetBatch Run (All Supported Models):
python port_all.pyport.py: Main orchestration script.unity_nn/: The Unity project (VR App).vr_processor.py: Handles ADB communication and stats collection.build_and_deploy.py: Handles Unity command-line building.