Introduction

In Wuhan city (Hubei, China) at the end of 2019, many pneumonia cases of obscure cause emerged (Lu et al. 2020). A few days later, the virus by which it is caused was identified and the International Committee on Taxonomy of Viruses (ICTV) named the virus “Severe Acute Respiratory Syndrome Coronavirus 2” (SARS-CoV-2) (Rabi et al. 2020). Coronaviruses are RNA virus of the Coronaviridae subfamily, and there are four main subgroups (α, β, γ, and δ) (Cui et al. 2019). There are only seven coronaviruses that can infect humans, and SARS-CoV-2 is the seventh.

Coronavirus disease (COVID-19) caused by SARS-CoV-2 is a highly contagious disease, and the World Health Organization (WHO) declared it a pandemic on 11 March 2020 (Andersen et al. 2020). Reverse transcription polymerase chain reaction (RT-PCR) is a widely used test to detect SARS-CoV-2. However, this test is costly, manual, complex, and consumes time. Other ways to detect COVID-19 are clinical symptoms examination, pathology tests, and radiography. In a meta-analysis, researchers found 87% sensitivity and 89% negative predictive value (NPV) in chest computed tomography (CT) compared to RT-PCR and for RT-PCR to get NPV up to 98%; the test should be repeated three times (Khatami et al. 2020). In COVID-19 diagnosis, radiological imaging tools like CT and chest radiograph (CXR) are vital for assessing the evolution of the disease. Those tools are also helpful in finding the stage (mild, moderate, and severe) of the disease. In the early stage of COVID-19, the majority of radiographic images have features like both lung involvement, multi-focal ground-glass opacities (mainly in lower lobes), and in the final stage pulmonary consolidation occurs (Salehi et al. 2020; Huang et al. 2020; Zhang et al. 2020a). In COVID-19 pneumonia, Monaco et al. (2020) preferred CXR as a first choice among medical imaging modalities, and in their research, they found substantial interobserver agreement in the CXR severity score.

In automatic diagnosis, machine learning-based solutions have gained popularity, and researchers are using them in many health problems (Waring et al. 2020). Advanced mobile phone technology enables the use of machine learning-based solutions in the mobile phone by which many tasks like face detection (Zhang et al. 2020b), object detection (Zainab 2018), and malware detection (Kim et al. 2019) can be done in the mobile phone. In this research, we developed a CNN model and an Android application to detect COVID-19 from X-ray images on Android mobile.

The contribution of this research is recapitulated below:

  1. 1.

    A novel application is introduced, chest X-ray image-based COVID-19 detection on Android mobile.

  2. 2.

    Developed a CNN model that can be deployed on Android mobile, works well on Android mobile, and gives very good accuracy.

  3. 3.

    Implemented the CNN model on Android mobile and developed an Android application to detect COVID-19.

  4. 4.

    A detailed experimental analysis is done in terms of accuracy, sensitivity, specificity, precision, and F1-score.

Related works

In the COVID-19 epidemic, many Artificial Intelligence (AI) techniques based on medical images (CT and CXR) have been developed to detect COVID-19. There exists both feature extraction-based (Chandra et al. 2021; Mohammed et al. 2020; Elaziz et al. 2020) and deep learning-based approaches to detect COVID-19 from an X-ray image. This review narrates the newly evolved deep learning techniques to detect COVID-19.

Jain et al. (2020) performed transfer learning, and for ResNet101 they got 98.93% accuracy, 98.66% specificity, 96.39% precision, and 98.15% F-1 score. Their dataset consists of 1215 images which include 250 COVID-19 images. Ucar and Korkmaz (2020) proposed COVIDiagnosis-Net and got 98.26% accuracy for three classes. Their dataset includes a total of 5949 CXR of which 76 images are of COVID-19. Ozturk et al. (2020) proposed a CNN model named DarkCovidNet and used a total of 1125 X-ray images which includes 125 COVID-19 images. In a fivefold cross-validation for binary classes, an average accuracy of 98.08% was obtained. El Asnaoui and Chawki (2020) performed transfer learning on seven pre-trained models, and they got the highest accuracy of 92.18% in Inception-ResNetV2 for three classes. Loey et al. (2020) used a transfer learning technique and three pre-trained models to detect COVID-19. They used 306 X-ray images which included 69 images of COVID-19 and got an accuracy of 85.20% on AlexNet for three classes. Apostolopoulos and Mpesiana (2020) used a transfer learning strategy and five pre-trained models to detect COVID-19. A total of 1427 X-ray images, including 224 images of COVID-19 and tenfold cross-validation, were used. For two classes, they got the highest accuracy of 96.78% in MobiNet V2. Khan et al. (2020) proposed a CNN model named CoroNet and used a total of 1300 X-ray images which include 290 images of COVID-19. For three classes, an accuracy of 95% was obtained. Abraham and Nair (2020) proposed multi-CNN, a combination of several pre-trained CNNs. They used a total of 950 X-ray images which included 453 images of COVID-19 and obtained 91.16% accuracy for binary classes. Makris et al. (2020) applied transfer learning on nine pre-trained CNN models and for three classes got the highest accuracy of 95.88% in VGG16. Heidari et al. (2020) used the transfer learning technique, and for VGG-16 they got 94.5% accuracy. In the above researches, the authors have developed their datasets from different sources, and data from Cohen et al. (2020) is common in all datasets. Civit-Masot et al. (2020) used the VGG16 based CNN model and got 86% accuracy for three classes. They used 396 X-ray images in total, including 132 of COVID-19. Mahmud et al. (2020) proposed a CNN model named CovXNet and used a total of 5856 X-ray images which includes 305 images of COVID-19. For binary classes, they got 97.4% accuracy. Goel et al. (2021) used 900 COVID-19 X-ray images and got 97.78% accuracy in their proposed CNN model named OptCoNet.

Research methodology

Because CNN models are self-learning, they can achieve high accuracy in image classification while also performing well in multiclass problems. In this paper, inspired by GoogleNet (Szegedy et al. 2015), a CNN model is developed. Though there are many COVID-19 patients, the public availability of X-ray images of COVID-19 positive patients is very small and sporadic. For this, data from multiple sources are used to develop the CNN model. To deploy the model in the Android mobile, the CNN model is converted to the TensorFlow Lite (TFLite) model. An Android application is developed to perform classification on Android mobile.

Database description

In this research, X-ray images from different sources are used to create one database. This database includes 592 COVID-19 positive X-ray images and 592 normal X-ray images of posterior-anterior (PA) view. Firstly, COVID-19 positive X-ray images hosted on GitHub shared by Cohen et al. (2020) were chosen. Secondly, COVID-19 positive X-ray images shared by a physician were chosen (Chest Imaging 2020). Thirdly, normal X-ray images shared by Kermany et al. (2018) were chosen. CXR images were resized to 300 × 300. There was no filter used during the resizing, and the aspect ratio was kept at 1:1. Our database includes two classes, and Fig. 1 shows the randomly selected images from class samples. In Fig. 1a, peripheral opacities exist in both lungs.

Fig. 1
figure 1

X-ray image: a COVID-19, b normal

Proposed CNN model

Deep learning is a robust scheme to unravel different recognition problems, and it focuses on learning excellent features automatically. Among various deep learning methods, CNN provides very outstanding results in different classification problems. In this research, a 150-layer CNN model is developed to classify, and it is shown in Fig. 2a. The image input dimension of this network is 300 × 300 × 3. The main reason for selecting this architecture is given below:

  • Multilevel convolution filters are applied to the same input, so it ensures multilevel feature extraction.

  • Before every convolution filter, 1 × 1 convolution is performed, where cross-channel correlation is performed, and it also ignores spatial dimension.

  • By performing 1 × 1 convolution before every convolution filter, it reduces computational cost largely.

  • Through the max-pooling operation, low-level features can be captured.

Fig. 2
figure 2

a Architecture of the proposed CNN model and b modified inception module used in the CNN model

Our proposed architecture differs from GoogleNet such that instead of several inception modules used in GoogleNet, we used four modified inception modules (shown in Fig. 2b) in our network. Every modified inception module consists of 3 × 3, 5 × 5, 7 × 7, 8 × 8, 21 × 21, 22 × 22, and 25 × 25 convolution filters, whereas in GoogleNet, only 3 × 3 and 5 × 5 convolution filters are used in the inception module. In our observation, we found that those seven filters have a good impact on performance and accuracy. The total number of parameters in this model is 9.7 million.

Android application development

We used MATLAB R2020a to train our proposed CNN model. The trained CNN model is converted to the TFLite model, and Fig. 3d illustrates this conversion process. Firstly, in MATLAB, directed acyclic graph (DAG) network is converted to the open neural network exchange (ONNX) model format. Then the ONNX model is converted to a frozen graph. After that, the freeze graph is converted to the TFLite model. By using the TFLite model, an Android application is developed to classify the X-ray images. This Android application requires a minimum of Android version 6 (API 23) to work. To develop this Android application, Android studio 3.4.2 and TFLite framework are used. To load and execute the CNN model on Android mobile, org.tensorflow.lite package is used. At first, the Android application loads the CXR image and then resizes the image to a 300 × 300 size. Then the image is passed through the TFLite model and finally gives classification results.

Fig. 3
figure 3

a,b,c Developed Android application and d TFLite model conversion

Figure 4(b) illustrates the steps for COVID-19 detection on Android mobile. At first, the user will complete a chest X-ray test in a hospital. Then after disinfecting the mobile, the user will take a picture of the X-ray film. Finally, COVID-19 can be detected using that image in the Android application. By this, the user will know the test result before the X-ray report and get some time to take the necessary steps. If a radiologist is unavailable or takes too much time to verify the X-ray film, the user can verify the X-ray film with this Android application.

Fig. 4
figure 4

a Confusion matrix and b steps for COVID-19 detection on Android mobile

A screenshot of the Android application is shown in Fig. 3a, b, and c. To use this Android application, firstly, the user will open an X-ray image with the OPEN PICTURE button, and after that, the user needs to press the CLASSIFY button (shown in Fig. 3a). For the first time, this application will request permission to access photos and media. Then by pressing the CLASSIFY NOW button, the probability of the two classes will be displayed (shown in Fig. 3b and c). Among the two classes which belong to higher probability, X-ray image will belong to that class. Figure 3b and c show the classification result for COVID-19 and normal X-ray image.

Experimental results

The experimental appraisement of our proposed model was done on MATLAB R2020a. For this, a computer having an AMD Ryzen 3700X processor, 32 GB RAM, and NVIDIA GTX 1060 6 GB Graphics Processing Unit (GPU) is used. Our proposed model was trained using Stochastic Gradient Descent (SGD) with momentum optimizer having 0.001 learning rate, 0.9 momentum, and 175 mini-batch sizes with 150 epochs. To evaluate the performance of the proposed model, fivefold cross-validation is employed. The confusion matrix for each fold is shown in Fig. 4a. To appraise the performances of the proposed model, accuracy, sensitivity, specificity, precision, and F1-score are used, and they are shown in Table 1.

Table 1 Performance matrices for each fold

Discussion

In this research, we proposed a CNN model and developed an Android application by using that CNN model to detect COVID-19 from X-ray images on Android mobile. We employed fivefold cross-validation and achieved 98.65% average accuracy. There exist many deep learning techniques to detect COVID-19 from X-ray images and a comparison between them and our proposed method is given in Table 2. Many researchers have employed transfer learning techniques, and from Table 2, the highest accuracy was obtained in ResNet101 for transfer learning. It has slightly higher accuracy than our proposed model, but in terms of specificity, precision, and F-1 score, it lags. Ucar and Korkmaz (2020); Ozturk et al. (2020); Khan et al. (2020); Abraham and Nair (2020); Mahmud et al. (2020); and Goel et al. (2021) have proposed their own CNN model, and among them, Ucar and Korkmaz (2020) got the highest accuracy of 98.26 which lags our one. The dataset used by Goel et al. (2021) includes the same two data sources which we used in this research. They got 97.78% accuracy, which lags our one.

Table 2 Comparison between the proposed method and existing methods

We have developed our proposed CNN model in such a way that it works well on Android mobile and compatible with the TFLite built-in operator library so that CNN model deployment on Android mobile is possible with a very good accuracy. In Table 2, only our proposed method is implemented in real-life scenarios like Android mobile, and it makes this research unique from others.

Conclusion

As COVID-19 is highly contagious, it is essential to detect every positive case very fast. This will significantly reduce viral transmission. Deep learning and mobile phones can play a vital role in this case. With the advancement in mobile phone technology, it has become possible to deploy pre-trained models on Android mobile for classification. For this, we focused on COVID-19 detection on Android mobile from X-ray images and implemented it on Android mobile. We obtained an average accuracy of 98.65%, a sensitivity of 98.49%, a specificity of 98.82%, a precision of 98.81, and an F1-score of 98.65% for our proposed CNN model. After deploying this model on Android mobile, our developed Android application successfully predicts COVID-19 and normal X-ray images. With our developed Android application, after taking pictures of X-ray film from a mobile phone camera, the user can verify their X-ray images on their Android mobile. The user must avoid self-diagnosis, and before starting diagnosis, the user must verify the X-ray film by a radiologist. We hope that the CNN model and Android application in our proposed research will be helpful for the diagnosis of COVID-19.

Our proposed work has some limitations. Firstly, our developed Android application will not work below Android version 6 (API 23), and due to this, the user’s old Android mobile will not be able to run it. Secondly, in this research, we used only X-ray images of PA view, and for this our proposed CNN model will not work on X-ray images in other views like lateral and anterior–posterior (AP). Thirdly, stages (mild, moderate, and severe) of pneumonia due to COVID-19 cannot be detected. Fourthly, we used a limited number of COVID-19 X-ray images due to the scarcity of COVID-19 CXR data. Our proposed CNN model works very well and gives very good accuracy within our dataset. By our developed Android application, we have also tested several X-ray images that are not included in our dataset, and it gives a satisfactory result. But its accuracy may change in mass level implementation, and for proper real-life implementation at a mass level, more COVID-19 CXR is needed. In the future, we will overcome those limitations by extending our work with more COVID-19 X-ray images in different views (PA/AP/lateral).