Rapid Ecosystem-Driven Deep Learning: On-Device Grain Type Classification and Authentication using iOS Swift and Core ML - Trianggoro Wiradinata (Bright Publisher, 2026)
The 2025 Indonesian rice scandal highlighted major shortfalls in food security and the pressing need for robust, data-based verification of authenticity. The goal of this work is to design a fast, lightweight, and fully offline rice grain classification and verification system that can run directly on consumer mobile hardware. The basic idea to overcome the technical bottleneck of deploying complex computer vision models on edge devices is to use macOS and Apple’s unified ecosystem as a rapid prototyping and deployment platform. The deliberate avoidance of fragmented and high-latency workflows such as external environments (e.g. TensorFlow or PyTorch) and intermediate formats (e.g. ONNX) is mentioned. The study contributes a streamlined pipeline that incorporates an Image Feature Print V1 feature extractor, natively trained with Create ML on a publicly available dataset of 75,000 balanced images of five rice varieties (Arborio, Basmati, Ipsala, Jasmine, and Karacadag), directly into a native iOS application built with SwiftUI. The novelty of this approach is the usage of native tools like VisionKit and Core ML, which enables the complete elimination of third-party bridging code that normally bloats the binary overhead. The results show excellent edge efficiency on an iPhone 15 with a median prediction rate of 2.75 ms, an initial load time of 0.54 ms and a compilation latency of 3.66 ms. Moreover, the results reveal that by employing aggressive data augmentations, including the addition of visual noise, blur, exposure adjustment, flipping and rotation to ensure robustness, and by deliberately not cropping to preserve absolute grain dimensions, the model achieved a remarkable overall accuracy of 97% with an ultra-compact deployment footprint of only 66 KB. These metrics demonstrate that a fast, fully offline and privacy-preserving verification system is well within reach with modern consumer hardware.