Research Question: Can a 224KB neural network run face detection in real-time on a 2013 smartphone with no ML accelerator? Answer: Yes — 8.7 FPS on ARM Cortex-A9. And INT8 quantization is actually SLOWER than FP32 on this chip.
Key Finding: INT8 is 1.35x SLOWER than FP32 on ARM Cortex-A9.
BlazeFace running on ARM Cortex-A9 @ 1GHz — face detected at 92% confidence
Running BlazeFace on ARM Cortex-A9 @ 1GHz | 512MB RAM | Android 4.1.2
Deploys a 224KB face detection model (BlazeFace) on a 2013 Samsung phone and benchmarks INT8 vs FP32 quantization on real ARM hardware.
| Stage | Hardware | Time | FPS |
|---|---|---|---|
| Laptop | Intel CPU | 2.08ms | 479 |
| Phone (on-device) | ARM Cortex-A9 | 115ms | 8.7 |
Key Finding: INT8 is 1.35x SLOWER than FP32 on ARM Cortex-A9. Quantization saves memory but not speed on this chip.
- Python 3.10+
- Android phone with USB Debugging enabled
- Android NDK (for recompiling ARM binary)
- ADB installed
Install Python dependencies:
pip install -r requirements.txtpython src/facedetect.pyConnect your Android phone via USB, enable USB debugging, then:
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
python src/live_phone.pyFirst push the files to your phone:
adb push models/blazeface.tflite /sdcard/blazeface.tflite
adb push arm/inference_arm /data/local/tmp/inference_arm
adb push tflite_lib/libtensorflowlite_jni.so /data/local/tmp/libtensorflowlite_jni.so
adb shell chmod 777 /data/local/tmp/inference_arm
adb shell chmod 777 /data/local/tmp/libtensorflowlite_jni.soThen run inference ON the phone:
adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/inference_arm"Download TFLite 2.4.0 AAR and extract it, then:
armv7a-linux-androideabi21-clang -o arm/inference_arm arm/inference.c \
-I tflite_old/headers \
-L tflite_old/jni/armeabi-v7a \
-ltensorflowlite_jni -llog -lz -lm -ldl -landroid| Spec | Value |
|---|---|
| Device | Samsung GT-S7392 |
| CPU | ARM Cortex-A9 @ 1GHz |
| RAM | 512MB |
| Android | 4.1.2 API 16 |
| Architecture | armeabi-v7a |
Python · TensorFlow Lite 2.4.0 · OpenCV · ONNX · Android NDK 29 · C · ADB
