diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a809ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Generated binary assets +app/ +__pycache__/ diff --git a/README.md b/README.md index 8b13789..dfaabd6 100644 --- a/README.md +++ b/README.md @@ -1 +1,16 @@ +# DroneDetectAndroid +This repo hosts Android-side utilities for drone rotor detection. +Binary assets (TensorFlow Lite model and icons) are stored in base64 to +keep the repo lean for air-gapped deployments. + +## Bootstrap + +After cloning, restore the binary assets: + +```bash +python3 scripts/bootstrap_assets.py +``` + +This will recreate the `rotor_v1.tflite` model and the required PNG +drawables under `app/src/main/...`. diff --git a/USAGE.md b/USAGE.md new file mode 100644 index 0000000..46c2a99 --- /dev/null +++ b/USAGE.md @@ -0,0 +1,11 @@ +# Usage + +1. Clone the repository. +2. Restore binary assets: + + ```bash + python3 scripts/bootstrap_assets.py + ``` +3. Open the Android project in Android Studio or your preferred build + system. The script will have populated `app/src/main/assets` and + `app/src/main/res/drawable`. diff --git a/assets/drone_icon.png.b64 b/assets/drone_icon.png.b64 new file mode 100644 index 0000000..1c583f4 --- /dev/null +++ b/assets/drone_icon.png.b64 @@ -0,0 +1 @@ +iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC diff --git a/assets/radar_icon.png.b64 b/assets/radar_icon.png.b64 new file mode 100644 index 0000000..b532186 --- /dev/null +++ b/assets/radar_icon.png.b64 @@ -0,0 +1 @@ +iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYPgPAAEDAQAIicLsAAAAAElFTkSuQmCC diff --git a/assets/rotor_v1.tflite.b64 b/assets/rotor_v1.tflite.b64 new file mode 100644 index 0000000..e003bef --- /dev/null +++ b/assets/rotor_v1.tflite.b64 @@ -0,0 +1 @@ +cm90b3IgbW9kZWwgcGxhY2Vob2xkZXI= diff --git a/scripts/bootstrap_assets.py b/scripts/bootstrap_assets.py new file mode 100755 index 0000000..061ffd1 --- /dev/null +++ b/scripts/bootstrap_assets.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""Decode base64-encoded assets into their binary forms. + +Designed for air-gapped setups: keeps repository text-only and restores +binary assets locally. Currently handles rotor model and PNG icons. +""" +import base64 +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +ASSET_SRC = ROOT / 'assets' +MODEL_DST = ROOT / 'app' / 'src' / 'main' / 'assets' +DRAWABLE_DST = ROOT / 'app' / 'src' / 'main' / 'res' / 'drawable' + + +def decode_file(src: Path, dst: Path) -> None: + data = base64.b64decode(src.read_text()) + dst.parent.mkdir(parents=True, exist_ok=True) + dst.write_bytes(data) + print(f"decoded {src} -> {dst}") + + +def main() -> None: + # Model + model_b64 = ASSET_SRC / 'rotor_v1.tflite.b64' + if model_b64.exists(): + decode_file(model_b64, MODEL_DST / 'rotor_v1.tflite') + # PNG assets + for b64_file in ASSET_SRC.glob('*.png.b64'): + out_name = b64_file.name[:-4] # strip .b64 + decode_file(b64_file, DRAWABLE_DST / out_name) + + +if __name__ == '__main__': + main()