File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Generated binary assets
2+ app /
3+ __pycache__ /
Original file line number Diff line number Diff line change 1+ # DroneDetectAndroid
12
3+ This repo hosts Android-side utilities for drone rotor detection.
4+ Binary assets (TensorFlow Lite model and icons) are stored in base64 to
5+ keep the repo lean for air-gapped deployments.
6+
7+ ## Bootstrap
8+
9+ After cloning, restore the binary assets:
10+
11+ ``` bash
12+ python3 scripts/bootstrap_assets.py
13+ ```
14+
15+ This will recreate the ` rotor_v1.tflite ` model and the required PNG
16+ drawables under ` app/src/main/... ` .
Original file line number Diff line number Diff line change 1+ # Usage
2+
3+ 1 . Clone the repository.
4+ 2 . Restore binary assets:
5+
6+ ``` bash
7+ python3 scripts/bootstrap_assets.py
8+ ```
9+ 3 . Open the Android project in Android Studio or your preferred build
10+ system. The script will have populated ` app/src/main/assets ` and
11+ ` app/src/main/res/drawable ` .
Original file line number Diff line number Diff line change 1+ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC
Original file line number Diff line number Diff line change 1+ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYPgPAAEDAQAIicLsAAAAAElFTkSuQmCC
Original file line number Diff line number Diff line change 1+ cm90b3IgbW9kZWwgcGxhY2Vob2xkZXI=
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ """Decode base64-encoded assets into their binary forms.
3+
4+ Designed for air-gapped setups: keeps repository text-only and restores
5+ binary assets locally. Currently handles rotor model and PNG icons.
6+ """
7+ import base64
8+ from pathlib import Path
9+
10+ ROOT = Path (__file__ ).resolve ().parent .parent
11+ ASSET_SRC = ROOT / 'assets'
12+ MODEL_DST = ROOT / 'app' / 'src' / 'main' / 'assets'
13+ DRAWABLE_DST = ROOT / 'app' / 'src' / 'main' / 'res' / 'drawable'
14+
15+
16+ def decode_file (src : Path , dst : Path ) -> None :
17+ data = base64 .b64decode (src .read_text ())
18+ dst .parent .mkdir (parents = True , exist_ok = True )
19+ dst .write_bytes (data )
20+ print (f"decoded { src } -> { dst } " )
21+
22+
23+ def main () -> None :
24+ # Model
25+ model_b64 = ASSET_SRC / 'rotor_v1.tflite.b64'
26+ if model_b64 .exists ():
27+ decode_file (model_b64 , MODEL_DST / 'rotor_v1.tflite' )
28+ # PNG assets
29+ for b64_file in ASSET_SRC .glob ('*.png.b64' ):
30+ out_name = b64_file .name [:- 4 ] # strip .b64
31+ decode_file (b64_file , DRAWABLE_DST / out_name )
32+
33+
34+ if __name__ == '__main__' :
35+ main ()
You can’t perform that action at this time.
0 commit comments