Skip to content

JordanMicahBennett/SMART-CT-SCAN_BASED-COVID19_VIRUS_DETECTOR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Alt Text Note: The animation above represents a Drag&Drop version, separate from the instance discussed on this page. The Drag&Drop version version does the same thing as the non-Drag&Drop version, with the exception of the Drag&Drop feature. The Drag&Drop version is available here.

SMART-XRAY (+CT) -SCAN_BASED-COVID19_VIRUS_DETECTOR

The aim was 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, and as such artificial neural networks were used to develop systems in line with the initial aim.

This project began on January 29, 2020, here: SMART-CORONA_VIRUS_DETECTOR. This Xray-scan version (also the first known global attempt/publication of image analysis/Artificial Intelligence based nCov/Covid19 diagnosis code) 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.

An optimal path is reasonably that the (~70% accurate) CDC standard polymerase method, and the (~75% to ~90% accurate) Artificial Intelligence based Xray method are used in concert.

65th Annual Health Research Conference (Submission)

Alt Text

Above is a snippet of my (March 30, 2020) paper submission to the 65th Annual Health Research Conference, organized by the Government of Jamaica and Caribbean Public Health Agency, based on my February 9, 2020 Covid19 Artificial Intelligence diagnostic model.

65th Annual Health Research Conference: http://conference.carpha.org/

See also my more detailed manuscript on research gate.

NON-COVID19 PNEUMONIA AND COVID19 PNEUMONIA DETECTION

Based on suggestions by Andrei Marinescu, Jordan has updated this system such that it does both non-covid19 pneumonia detection and covid19 pneumonia detection, using separate convolutional neural network models, via two different droplist options seen below:

Alt Text

This seeks to increase the robustness of the predictions made by the system.

On the task of Covid19 detection, so far, with the very limited data available, Sensitivity/Specificity/Accuracy are ~85%/~70%/~77% respectively, as seen in this screenshot, (where the model has been trained on a covid19 dataset I organized).

For the task of non-Covid19 pneumonia detection, the new code base has: Sensitivity/Specificity/Accuracy of ~89%/~88%/~89% respectively, as seen in this screenshot.

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. Covid-19 positive xray scans are taken from various covid19 papers, such as this scan of this recent covid-19 paper.

  5. 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 code base.
  2. Download the saved weights: "best_weights.hdf5" from the output section of the base code repository on kaggle (easy to become a member using gmail etc), rename the .h5 file to "best_weights_kaggle_user_pneumonia2_0.hdf5" then ensure both the code and weights are in same place.
  3. Download the 2 gigabytes training/test data from kaggle.
  4. Download this x ray covid19 dataset that I've collated/organized from Dr. Cohen's collation. Ensure the extracted "xray_dataset_covid19" folder is in the same directory as the python files in this repository.
  5. 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 (5), 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: Alt Text

  • Notice the log with the results of the neural network's prediction in the text area below the image: Alt Text

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"

  3. +21 axial lung images, +11 lateral view lung images, and about +118 coronal view lung images, re Covid19 positive cases, collated by Dr. Joseph Cohen.

    • Train with caution, i.e. it is reasonable to select one type of view format, for pretrained model, training process, and inference/testing cycle.

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 occurred at that time.

TRAINING ON NEW COVID19 DATA

The "renderConfusionMetrics" instance in Section D (bottom of "covid19_ai_diagnoser_optimal_model_architecture.py" file) can facilitate training of new covid19 images placed in xray_dataset_covid19/train... and or xray_dataset_covid19/test....

This is done by simply placing your images in the directories above, then changing the "False" parameter to "True", and running the "covid19_ai_diagnoser_optimal_model_architecture.py" file.

  • If the last .hdf5 weights parameter is changed, the model_covid19PneumoniaDetector.load_weights parameter will also require change in the same "Section D" only.
renderConfusionMetrics ( model_covid19PneumoniaDetector, test_data_d, test_labels_d, False, train_gen_d, test_gen_d, batch_size, 25, 'covid19_neural_network_weights_jordan.hdf5' )

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.

  5. A separate instance of the Smart Covid19 Detector, that includes Drag and drop functionality, has been produced.

Alt Text

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages