Skip to content

victor045/SMART-CT-SCAN_BASED-COVID19_VIRUS_DETECTOR

 
 

Repository files navigation

Jordan Micah Bennett, software engineer/creator of "RobotizeJa".

SMART-XRAY (+CT) -SCAN_BASED-COVID19_VIRUS_DETECTOR

The aim is to develop a quick way to detect the nCov 2019 (Coronavirus 2019/2020, also called disease: "Covid-19" stemming from virus: "SARS-CoV-2") strain, with the plan to use artificial neural networks or other machine learning model types.

This project began on January 29, 2020, here: SMART-CORONA_VIRUS_DETECTOR. This Xray-scan version began on Feb 9, 2020.

As this is the first known attempt, commencing on January 29 2020 aimed at collaborating to construct this type of program, please point to open source packages with similar goals. Please email jordanmicahbennett@gmail.com.

  • This can also reasonably allow for less experienced medical personnel to make preliminary diagnoses, expanding the diagnosis efforts overall. This effort may contribute towards virus-control progress, together with other ai based endeavours being developed across the globe, such as use of ai for vaccine development.

  • This convolutional neural network architecture can reasonably also be trained on CT-Scan image data (that many Covid19 papers seem to concern), separate from the Xray data (from the non-Covid19 Pneumonia Kaggle Process) upon which training occured.

Xray Scan Test Viability

Xray Test Result Time versus Dna Method (Comparison)

WORLD HEALTH ORGANIZATION (WHO) WARNING

Coronavirus: Whole world 'must take action', warns WHO
Update Jan 31, 2020/WHO declares the new coronavirus outbreak a Public Health Emergency of International Concern

WHY?

DEEP LEARNING CODE/TESTS + CODE DISCUSSION & CALL FOR CONTRIBUTION

Code

  1. Covid-19/Coronavirus2019/nCov share many similarities with pneumonia. In fact, the time course evolution of a specific strain of covid-19 pneumonia is studied here.

  2. There are already existent pneumonia deep learning platforms, including kaggle contents rife with deep learning kernels/solutions, pertaining to pneumonia detection.

  3. A pretrained neural network is chosen from google, pertaining to (2). Pretrained model usage is a way to avoid training on the 2 gigabytes of pneumonia/non-pneumonia training set.

    • I added a quick function "doOnlineInference" to the code. This is a convenient way to invoke diagnosis on input image.
  4. A covid-19 positive xray scan is taken from figure 1a of this recent covid-19 paper.

  5. Another covid-19 positive xray scan is taken from figure 1 of this covid-19 paper.

  6. The function from (3) was invoked on (4), and (4) was successfully detected as covid-19 positive, aka high confidence of pneumonia. The function from (3) was also invoked on (5), although that prediction had a very low confidence that the input was normal/non-pneumonia. All covid19 positive input images be it (4) or (5) induced prediction of high neural network confidence of the presence of covid19 pneumonia.

    • Deep learning based upscaling was applied to input image 5, which was of low resolution compared to the training data from kaggle.
    • Upscaling changed the results for input (5) where the model predicted even lower confidence of non-pneumonia i.e. closer to ground truth, but UPSCALING did not change the result for input (4) which was initially high/closer in resolution to the smallest res sample in the kaggle dataset.
    • This could be a good/preliminary sign that this tool could be used to actively detect novel coronavirus cases from Xray scans.
  7. Preliminary Conclusion

    • This will reasonably work on potential mild-covid-19 pneumonia patients, within ~0 to 4 days of infection, with "repeated pulmonary CTs", where positive findings of pneumonia associated abnormalities are discoverable.
    • This will likely work better for patients after ~5 days of infection of covid-19, as abnormalities become distributed across the lungs, where initial CT scans could better discover the Covid-19 markers.
    • See the paper's conclusion for the reasoning above.

Code setup (basic user interface)

  1. Download entire repository, which contains my version of the original code from another repository by John Chang.
  2. Download the saved weights from the original repository, and ensure both the code and weights are in same place.
  3. Download the 2 gigabytes training/test data from kaggle.
  4. Run doOnlineInference function from my version of the original code on any of the test data from the 2 gigabytes kaggle directory, or on the single positive covid-19 example seen in this repository, that was taken from figure 1a of this recent covid-19 paper.

Code setup (graphical user interface)

Update: February 18, 2020

  1. Except for item (4), follow all instructions from "Code setup (basic user interface)" section above.

  2. Run my user interface, which works with my version of the original code from this repository. One can either double click the covid19_ai_diagnoser_ui.py file, or open the file with IDLE, and run there.

  • After running, ui looks like this on first run: Alt Text

  • Select/Files > Load an image: Alt Text

  • Select an image that pertains to a suspected case, although in the Screenshot: Alt Text

  • Notice the log with the results of the neural network's prediction above the large blue arrow, and the image has been loaded for viewing right of small blue arrow: Alt Text

  • The model is ~92% accurate on the original task of pneumonia/non-pneumonia classification.

CT Scan Manual Diagnosis and Explosion in infection reports

CT Scan based diagnostic by human radiologists, have outpaced dna testing, and had lent to China's report of ~15,000 cases overnight, contributing to a total of ~60k+ cases.

DATA

  1. Images from recent covid-19 study: "Emerging Coronavirus 2019-nCoV Pneumonia"

  2. Images from recent covid-19 study: "Imaging Profile of the COVID-19 Infection: Radiologic Findings and Literature Review"

REAL TIME TRACKING OF NCOV 2019/2020

By extension, the tool by researchers at John Hopkins University below, is useful for real time tracking of nCov:

Alt Text

https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6

Note that despite the ~900+ infection-case number reported via China on January 24, by stark contrast, a medical scientific paper estimated that ~105,000+ infections actually occured at that time.

COVID-19 AI DATA/CALL ON THE MINISTRY OF HEALTH

I call on the Ministry of Health of Jamaica (as well as other countries) to utilize their administrative status to try to acquire more covid19 positive CT scan images (in federated format that excludes patient identity), from China etc, for improving pneumonia based ai systems, like the one that I had prepared since February 9, 2020, which I found to successfully detect covid19 presence in a small covid-19 positive Xray scan sample set found online so far, in a paper by Yuen et al etc.

  • Alternatively, the Chinese artificial intelligence algorithm/solution together with the data could be attained using the same administrative method.
  • In future scenarios, a "Division of Artificial Intelligence Based Health Development" or sector of artificial intelligence based research should reasonably exist in the Ministry of Health, that could enable Ai solutions to be rapidly researched/developed, to facilitate production of vaccines, and treatment, as seen in a recent example where MIT developed antibiotics based on Ai research/development.

My advice to Ministry of Health (February 17, 2020): https://drive.google.com/file/d/1BNXkKJPZuMx64XzwqFmQEpC5s9-C3tJH/view?usp=sharing

Update +March 5, 2020:

  1. Jordan added fix to original author's repository, to enable correct validation. John Chang had inadvertently misdefined some "test_dataGen.flow_from_director" function parameter as a training dataset input, instead of a test dataset input.

  2. Jordan updated his version of the original code, such that a compile issue is repaired, in order to facilitate accuracy evaluation of the saved/loaded (in 2 minutes on gtx 1060/i7 cpu) model without invocation of model-training function model.fit, which would take hours on the same machine.

  3. Based on Andrei's suggestions, Jordan replaced erroneously labelled CT labels, with X-Ray, that Jordan had initially mis-labelled. This correction is very important, and could influence model architecture later on.

  4. Code no longer runs on John Chang's base code. Jordan has written new diagnoser code, to accomodate a new code base.

    • For the task of pneumonia detection, the new code base has far higher sensitivity/recall (~89%), specificity (~88%) as seen in the new screenshot, compared to John Chang's code, which had: sensitivity/recall (~33%), specificity (~67%).

About

An image based CT attempt at coronavirus2019 (covid19) diagnosis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%