# LungVision: X-ray Imagery Classification for On-Edge Diagnosis Applications
## 5 Conclusions  
In this work, we conducted a comparative study to examine the feasibility of using mobile phones for on-edge medical diagnosis. We focused on the technical aspect of the deployment by training different neural networks to classify nine respiratory system diseases using X-ray imagery. We achieved an F1-Score of around 98.58% using the EfficientNetB2 model, which beats the state-of-the-art in terms of performance and the classes taken into consideration on the X-ray lung diseases dataset. Later, we analyzed three different optimization techniques, namely, Floating Point 16 (FP16), Quantization-Aware Training (QAT), and integer quantization using representative data (INT). The influence of the three techniques was studied in terms of model size, performance, and inference time. We found  
Figure 6: The measured inference time across different models.  
Figure 7: The confusion matrix of the on-app deployed model, with five images randomly selected per class. The names of the classes are listed in the figure.  
that QAT quantization achieves the highest optimization average, with a 75.59% reduction in size and a maximum optimization of 77.82%. In terms of performance, we highlight that MobileNetV2 achieves the highest performance to size ratio using QAT, with an average loss of as little as 4.1% across all models. Then, we tested the models' inference time, and we highlighted that INT quantization rapidly outperforms other techniques, with an average inference time improvement of 1.3830 s. Finally, we illustrated the functionality of the proposed approach using a consumer-ready application, developed to match the constraints of a mobile phone running an Android operating system and in line with Google Play regulations.  
The size of a typical CNN employed in the current approach varies depending on the specific architecture used. In this study, six different CNN architectures were evaluated: a custom model (102.4 MB), MobileNetV2 (11.5 MB), NASNetMobile (23.9 MB), EfficientNetB2 (38.5 MB), EfficientNetB2V2 (42.4 MB), and DenseNet (33.7 MB). While models like MobileNetV2 are relatively small and suitable for deployment without further optimization, larger models such as EfficientNetB2 and custom models require size reduction. Utilizing TensorFlow Lite and quantization methods significantly reduce these model's size while maintaining performance, making them more suitable for deployment on standard smartphones. However, the quantization process, while effective in reducing model size and improving inference time, can lead to a slight decrease in model performance. This trade-off between size, speed, and accuracy requires careful consideration, especially in critical applications such as medical diagnosis. To measure the robustness to low-quality X-ray images, we conducted experiments by taking photos of existing X-ray images using the mobile phone camera. We noticed that the detection accuracy is lower in the case of low-quality/noisy images, which may require relying on image enhancements and noise cancellation before feeding the image to the model. This represents a future area of study that we believe is necessary for practical use and industrial deployment.  
Conceptualization, R.A., D.A.A. and T.S.; methodology, R.A., D.A.A. and T.S.; software, R.A. and D.A.A.; validation, R.A., D.A.A. and T.S.; formal analysis, R.A. and D.A.A.; investigation, R.A. and D.A.A.; resources, R.A. and D.A.A.; data curation, R.A. and D.A.A.; writing--original draft preparation, R.A., D.A.A. and T.S.; writing--review and editing, R.A., D.A.A. and T.S.; supervision, T.S.; project administration, T.S.; All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
The data used in this research are publicly available and cited where relevant. Other supporting material is available upon request.  
The authors declare no conflicts of interest.