STEM at Mass Academy is taught by Dr. Crowthers and guides us through the process of a year-long research based project. The class is based around an independent STEM project and explores different aspects of engineering and research, such as analyzing research papers and learning about the design process for an engineering project.
The objective of this project was to create an image classification algorithm able to automatically detect strokes and classify them as either ischemic or hemorrhagic. Several neural network models were trained and tested and the optimal model was selected.
Strokes are often difficult to detect and classify quickly and require the presence of a doctor for the diagnostic process. As a result, many strokes are detected too late to administer effective treatment, leaving patients with long term disabilities. There are two main types of strokes: hemorrhagic and ischemic strokes. The goal of this project was to create a machine learning algorithm to automatically detect strokes and classify them as either ischemic or hemorrhagic using CT images. Datasets containing prelabeled brain CT scans of stroke patients as well as scans of healthy patients were collected. These images were used to create training and testing data as well as multiple image classification models. The optimal model was then determined using testing and validation accuracy as well as different measurements of loss. Using the testing data, the model was found to be highly effective with an accuracy of 89.6% and a loss value of 0.223 calculated using sparse categorical cross entropy. The model was able to run efficiently, with an average processing time of 26 milliseconds per 32 image slices. The model could be used with the current process by a physician, speeding up diagnosis times and allowing patients earlier access to the treatment they need. Future additions to the model would be the inclusion of other brain diseases and expanding to other types of scans, such as MRI scans or microwave imaging. Future testing includes testing on more datasets and testing during the real-time diagnostic process.
Current stroke detection methods require too much time for the and classification process, delaying treatment and increasing the chance of developing lasting effects
The objective of this project was to create a machine learning model to automatically detect and classify strokes using CT images in order to aid with the diagnostic process
Strokes are the second leading cause of death and the leading cause of long-term disability, often causing patients limited mobility if not treated immediately (About Stroke, 2021). Strokes occur when the blood supply to the brain is either interrupted or blocked completely. The two main types of strokes are ischemic (also known as acute strokes) and hemorrhagic strokes. Hemorrhagic strokes occur when a blood vessel in the brain ruptures, resulting in excess blood scattered throughout the brain (Ireland & Bialkowski, 2011). Ischemic strokes are more common, making up about 80% of all stroke cases, and occur when the blood flow to the brain is blocked, typically the result of a blood clot (About Stroke, 2021). In both cases, the stroke causes the death of upwards of two million brain cells every minute after it begins (Timeline of a Stroke, 2017), making it essential for the patient to receive treatment as early as possible. However, since the treatment of a stroke varies depending on whether it is ischemic or hemorrhagic, the treatment process cannot begin until after the diagnosis and classification of the stroke.
Current methods of stroke detection rely on medical imaging, whether that be with Computed Tomography (CT) scans or Medical Resonance Imaging (MRI), and an interpretation of the scans by a physician. Of these two, CT scans are used more often due to its cheaper cost and greater accessibility (Health Images, 2021). CT scans use X-rays from various angles around the patient to generate several cross-sectional images (slices) of the patient (CT scans, 2020). These slices contain information about the patient, such as the parameters of their bones and arteries, and are able to capture the presence of a stroke (Chawla et al., 2009). On such images, hemorrhagic strokes appear as bright white, or hyper dense, spots, while ischemic strokes appear as dark grey, or hypo dense, spots, with its contrast relative to the surroundings depending on the time since the stroke onset.
Datasets containing CT images and scans of ischemic and hemorrhagic strokes, as well as of healthy scans, were collected and used to create training, testing, and validation datasets. The images were processed, which was done by normalizing and equalizing the images. Using the normal and hemorrhagic images, several prototype models were developed and tested. All images were then used to create and test later models, which were designed based off the of the architecture of the prototypes. The models were evaluated to find accuracy and loss using sparse categorical cross entropy. The parameters and layers of the models were configured until the optimal model was created.
The architecture of the final model
ROC curves and AUC values for the first and final models
The loss values of the model during training, as calculated using sparse categorical cross entropy
The confusion matrix of the model during testing; 0 corresponds to healthy, 1 to hemorrhagic, and 2 to ischemic
The goal of the project to design a machine learning model capable of classifying CT scans as either healthy or containing hemorrhagic or ischemic strokes was achieved, with the final model able to classify the CT images with an 89.6% accuracy. The final model was also able to determine the probability of each class and output the probability that a normal scan contained an abnormality, even if it was not a stroke. The class predicted with the highest accuracy was of the ischemic strokes, as 40 of the 42 images were correctly identified and none of the images in the other classes were mislabeled as an ischemic stroke. The class with the highest error was of the hemorrhagic strokes, the most common of which occurring when a hemorrhagic stroke was mislabeled as a healthy scan, which occurred in 13 of the 73 images. While only one healthy scan was mislabeled as containing a stroke, the most common error was a stroke being labeled as healthy, which occurred in 15 of the 16 mislabeled cases.
A potential confounding variable was the origin of the images, as the images for the different classes were from different centers, possibly resulting in differing factors such as the contrast and brightness of the images. To address this issue, the images were all equalized before they were used. The most difficult part of the project was processing the images, primarily a result of having to work with different file formats and normalize every image. The adjusting of models was also difficult, as the models had to fitted over the correct number of epochs with different parameters in order to determine the optimal model.
McNemar’s test was chosen to determine statistical significance with a critical value of 0.05. McNemar’s test was chosen due to the dichotomous nature of the outputs, as they could either be correct or incorrect, and the paired values. The test comparing the first and final model yielded a chi-square value of 15.21 and a p-value of 0.0001. This value was well below the critical value threshold and demonstrated that the final model was a significant improvement over the first model.
The objective of the project was to develop an image classification model able to aid in the stroke diagnostic process by automatically detecting and classifying strokes as either ischemic or hemorrhagic, which was ultimately successful. The model was created following the collection of data and image processing and involved repeated testing and configuration to determine the optimal model. This project and the final model demonstrated the viability of the use of neural networks in stroke detection and classification and present the possibility of neural network usage in other medical fields as well.
About Stroke. (2021, August 02). Retrieved from https://www.cdc.gov/stroke/about.htm
Chan, T. (2007). Computer aided detection of small acute intracranial hemorrhage on computer tomography of brain. Computerized Medical Imaging and Graphics, 31(4-5), 285-298. doi:10.1016/j.compmedimag.2007.02.010
Chawla, M., Sharma, S., Sivaswamy, J., & Kishore, L. (2009). A method for automatic detection and classification of stroke from brain CT images. 2009 Annual International Conference of the IEEE Engineering in Medicine and Biology Society. doi:10.1109/iembs.2009.5335289
Chilamkurthy, S., Ghosh, R., Tanamala, S., Biviji, M., Campeau, N. G., Venugopal, V. K., Mahajan, V., Rao, P., & Warier, P. (2018, March 13). CQ500 [Dataset]. Qure.ai. http://headctstudy.qure.ai/dataset
CT scan. (2020, February 28). Retrieved from https://www.mayoclinic.org/tests-procedures/ct-scan/about/pac-20393675 #:~:text=A computerized tomography (CT) scan
Harris, C.R., Millman, K.J., van der Walt, S.J. et al. Array programming with NumPy. Nature 585, 357–362 (2020). DOI: 10.1038/s41586-020-2649-2
Health Images. (2021, August 30). MRI vs. CT Scan. https://www.healthimages.com/mri-vs-ct-scan
IBM Cloud Education. (n.d.). What are Neural Networks? Retrieved from https://www.ibm.com/cloud/learn/neural-networks
Ireland, D., & Bialkowski, M. E. (2011). Microwave Head Imaging for Stroke Detection. Progress In Electromagnetics Research M, 21, 163-175. doi:10.2528/pierm11082907
Kanellopoulos, I., & Wilkinson, G. G. (1997). Strategies and best practice for neural network image classification. International Journal of Remote Sensing, 18(4), 711-725.
Kistler et al. The virtual skeleton database: an open access repository for biomedical research and collaboration. JMIR, 2013 http://doi.org//10.2196/jmir.2930
Li, Q., Cai, W., Wang, X., Zhou, Y., Feng, D. D., & Chen, M. (2014). Medical image classification with convolutional neural network. 2014 13th International Conference on Control Automation Robotics & Vision (ICARCV). https://doi.org/10.1109/icarcv.2014.7064414
Oskar Maier et al. ISLES 2015 - A public evaluation benchmark for ischemic stroke lesion segmentation from multispectral MRI Medical Image Analysis, Available online 21 July 2016, ISSN 1361-8415 http://dx.doi.org/10.1016/j.media.2016.07.009.
Rahman, A. (2021, June 18). Brain Stroke CT Image Dataset (Version 1) [Dataset]. Afridi Rahman. https://www.kaggle.com/afridirahman/brain-stroke-ct-image-dataset
Saha, S. (2021, December 7). A Comprehensive Guide to Convolutional Neural Networks — the ELI5 way. Medium. https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3bd2b1164a53
Soofi, A., & Awan, A. (2017). Classification Techniques in Machine Learning: Applications and Issues. Journal of Basic & Applied Sciences, 13, 459-465. doi:10.6000/1927-5129.2017.13.76
Timeline of a Stroke. (2017, November 21). WebMD. https://www.webmd.com/stroke/stroke-symptoms-timeline