PashuSwasthya
Offline-First Multilingual Mobile App for Cattle Breed & Disease Diagnosis
1. THE PROBLEM
Rural cattle farmers face severe economic losses due to delayed veterinary diagnosis for cattle diseases in remote zero-connectivity zones.
2. TECHNICAL APPROACH & DECISIONS
1On-Device Quantized TFLite Inference
Trained MobileNetV3 CNN in TensorFlow, then applied INT8 post-training quantization to export a 14MB TFLite model running 100% on-device.
Cloud-hosted Inference API
Cloud APIs fail in internet-dead zones. INT8 quantization reduced model size from 65MB to 14MB with sub-50ms inference latency.
CORE ARCHITECTURAL LOGIC
On-device INT8 quantized MobileNetV3 TFLite inference loop with sub-50ms latency.
| 1 | Future<DiagnosisResult> runOnDeviceInference(File imageFile) async { |
| 2 | final inputBytes = await preprocessImage(imageFile, targetSize: 224); |
| 3 | final interpreter = await Interpreter.fromAsset('models/mobilenet_v3_quant.tflite'); |
| 4 | |
| 5 | var outputBuffer = List<int>.filled(numClasses, 0).reshape([1, numClasses]); |
| 6 | final stopwatch = Stopwatch()..start(); |
| 7 | |
| 8 | interpreter.run(inputBytes, outputBuffer); |
| 9 | stopwatch.stop(); // Guaranteed < 50ms latency on mobile CPUs |
| 10 | |
| 11 | final topPrediction = parseTFLiteOutputs(outputBuffer); |
| 12 | return DiagnosisResult(disease: topPrediction.label, latencyMs: stopwatch.elapsedMilliseconds); |
| 13 | } |
3. TRADE-OFFS & HONEST REFLECTION
Quantizing to INT8 dropped precision by 2.8% on rare edge cases, but enabled instant offline inference without device overheating.
4. CONCRETE OUTCOME & METRICS
Shipped a 100% offline veterinary diagnostic tool operating with sub-50ms inference latency and localized regional voice output.