COVID-19 DETECTION USING CNN
by Robotics club of CEG in Circuits > Computers
338 Views, 1 Favorites, 0 Comments
COVID-19 DETECTION USING CNN
Coronavirus 2019 (COVID-19) has widely spread all over the world since the beginning of 2020. We all know the effects on our general lives caused by this. Due to the rapid increase in the number of new and suspected COVID-19 cases, there may be a role for artificial intelligence (AI) approaches for the detection or characterization of COVID-19 on imaging. This project is an attempt to create a model that predicts if a Lung CT Scan Image of a person is infected with CoVID or not and gets better at prediction with time as it has provisions to learn upon data that is verified by doctors. This can also be a platform to contribute dataset for the data science community. The reason we chose this project is as it is really relevant to the current situation of CoVID19.
WHY CT SCAN?
CT provides a clear and expeditious window into this process, and deep learning of large CT data could provide automated and quantification of COVID-19 disease.
TECHNOLOGIES USED:
1. Application using PHP, HTML, MySQL.
2. Custom made API in Python flask.
- Prediction
- Training
3. Tensorflow Library
DEEP LEARNING :
Recent advances in machine learning, especially concerning deep learning, are helping to identify, classify, and quantify patterns in medical images. At the core of these advances is the ability to exploit hierarchical feature representations learned solely from data, instead of features designed by hand according to domain-specific knowledge. Deep learning is rapidly becoming the state of the art, leading to enhanced performance in various medical applications. So, we created an AI model that could predict whether a person is affected by covid or not with the help of their CT scans
Data Preparation
For creating the deep learning model we used a publicly available SARS-CoV-2 CT scan dataset, which contains 1252 CT scans that are positive for SARS-CoV-2 infection (COVID-19) and 1230 CT scans for patients non-infected by SARS-CoV-2, 2482 CT scans in total. These data have been collected from real patients in hospitals from Sao Paulo, Brazil.
- Read all the covid positive and negative images with their labels.
- Resize all the images to 224*244*3
- Shuffle the data. It helps the training converge fast and also prevents any bias during the training.
- Split the data into a train and test set. This procedure is used to test the performance of the model.
Model Training
After the data preparation is completed we have to train the model. In this project, we created a custom convolutional neural network but the results were not up to the mark. So we did transfer-learning using pre-trained models like ResNet, EfficientNet, VGG16 and based on the results we decided that VGG16 is the final model for the product.
RESULTS
Saving the Model
Imagine you trained a model for thousands of epochs for days or weeks or even hours, and got pretty good weights for your model meaning that your model is performing a lot well, and then you lose all the weights when you close your program / Jupiter / colab notebook. So, this can be avoided by saving the model and this step can save you a ton of time and resources with just some extra lines of code.
WEBSITE INTEGRATION
On this website we have two views, one is the hospital view and the other one is the patient view. We also have a predict button that allows users to just upload the scan and get the results without giving in any details.
1. Hospital Login
- In the hospital login section, it will be necessary to provide a Hospital ID to identify which hospital is logging in
- After Logging in you will land at the ADD PATIENT page, Where you can insert the CT scan Image of the patient along with their details
- After predicting the covid result using the patients CT scan you will get a preview of the image and the prediction result will be auto-filled
- After submitting the details of the patient along with the prediction results, you can view this in the NOT VERIFIED section in Patient details
- The work of updating the final result is done by the doctor, if the doctor clicks on particular patient details they can view the prediction result along with the CT scan of the patient where they can update the final result
- After Updating the final result if Positive the data of the patient will be displayed in the Positive section, if negative the details of the patient will be displayed in the negative section
- After the final Updation by the doctor, the CT scan of the patient will be moved to the train Images folder where the images will be finally trained for better accuracy of the model
2. Prediction
Upon entering the website we have a provision for uploading the CT scan to predict whether a person has covid-19 or not.
After choosing the image, on clicking the upload button the result gets displayed. The images are sent to our prediction API and the result is shown. These images are stored in our dataset collection for future use.
Prediction Interface
Patient Login
The next part is the patient view. Once the patient logins, he can see his details along with RT PCR results, Model prediction and doctor's prediction along with remarks. These details are fed into the site by the hospital staff.
API
1. Prediction API
- To be able to access both the servers we should first install the cross-origin extension in our browser.
- The prediction.py file will be running in the background and once we upload a CT scan the image will be predicted using our model. Then it will be stored in a folder for future use.
- After the prediction is done this will return a JSON file consisting of the name of the image, prediction percentage and the final result. (0 - negative and 1 - positive)
- This result will be auto-filled and the preview of the image will be shown in the - add patient section once the image of the ct scan is uploaded as well as in the Prediction Part where anyone can predict
2. Retrain API
- Once the doctor verifies the result the result will act as the label to our collected images(which the hospital staff uploaded) which act as a new set of data.
- In due course, this dataset will grow in size which can be used to train the existing model which would make it more accurate and reliable. The model improves itself using these datasets.
- Once a specific count is reached we can click the train button which sends these datasets to the train.py API.
How Will It Be Useful in the Fight Against Covid?
- We took this project because it is the need of the hour since there is a tremendous rise in infections during the second wave, This project can help the doctors to classify the CT scans to covid or not covid saving doctors time and also predicting a large number of the dataset in a short period where the doctor only has to update the final result.
- Human error could be possible and could be minimised using the model and doctor’s results can add to our existing dataset which further improves the model’s accuracy.