Inspiration
I was inspired by the crisis faced by doctors, especially in resource-limited hospitals, where timely diagnosis of diseases like pneumonia can be a matter of life and death. I wondered whether AI could be trained to recognize patterns in medical images, as a radiologist does, and contribute to faster and more accurate diagnoses. The idea that I could use my passion for coding to make a difference in the world through healthcare encouraged me to build X-Ray Mind.
What it does
X-Ray Mind classifies chest X-ray images into NORMAL and PNEUMONIA classes. I trained a CNN model using a publicly available dataset, randomly flipped and rotated images for class distribution balancing, and also visualized model performance in the form of accuracy scores as well as bar graphs of class distribution. The final model attains 90%+ accuracy and generalizes well on unseen test data.
How I built it
I started off by downloading the chest X-ray dataset from Kaggle via KaggleHub. I established image size and class, created a function to preprocess images—grayscale conversion, resizing, normalization—and labeling. For class imbalance handling, I used ImageDataGenerator for augmenting the minority "NORMAL" images. After preprocessing the dataset, I developed several CNN architectures and discovered that a model consisting of three convolutional layers, pooling, dropout, and dense layers gave me the best accuracy. I utilized Google Colab for training the model with GPU acceleration to achieve results faster and visualized class distribution and augmented samples.
Challenges I ran into
Firstly, my model was overfitting and not providing good output on test data. I even faced a lot of slowdown because of lack of computational resources. To eliminate this, I used dropout layers to prevent overfitting and switched to a GPU runtime in Google Colab for faster speed. Class imbalance was also a problem—there were significantly fewer NORMAL cases than PNEUMONIA—so I used image augmentation to balance the dataset and improve accuracy.
Accomplishments that I'm proud of
I'm proud that I developed a CNN model from scratch that can identify chest X-rays with 90%+ accuracy. Augmenting the dataset to balance the data and visualizing the impact using graphs really made me feel like I was bringing data science and medicine together in one place. Additionally, having the capability to alter GPU runtimes and accelerate models taught me to work around real-world limits on machine learning projects.
What I learned
I learned how to preprocess image data, apply augmentation to fix class imbalance, and compare the performance of CNNs in a real-world dataset. I also became familiar with TensorFlow and how the model architecture impacts the performance. Most importantly, I got to experience how machine learning can be used not just in tech, but to save lives.
What's next for Heart X-ray Analyzer
In the future, I would like to extend X-Ray Mind to identify other respiratory diseases, such as COVID-19 and tuberculosis. I'm also researching how to deploy the model in a web application or mobile interface so frontline healthcare workers can just upload X-rays and receive predictions. Having AI become more accessible in medicine is my ultimate aspiration.
Log in or sign up for Devpost to join the conversation.