Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated binary assets
app/
__pycache__/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/...`.
11 changes: 11 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
@@ -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`.
1 change: 1 addition & 0 deletions assets/drone_icon.png.b64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC
1 change: 1 addition & 0 deletions assets/radar_icon.png.b64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYPgPAAEDAQAIicLsAAAAAElFTkSuQmCC
1 change: 1 addition & 0 deletions assets/rotor_v1.tflite.b64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cm90b3IgbW9kZWwgcGxhY2Vob2xkZXI=
35 changes: 35 additions & 0 deletions scripts/bootstrap_assets.py
Original file line number Diff line number Diff line change
@@ -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()
Loading