Using the model is very simple, do the following:
- Download the Trained-Model from releases
- Download Predicting notebook and put it in the same folder as Trained-Model
- Create a Python venv, install libraries
- change the image address with the address of your own image(Images must be in Dicom format)
The term “heart disease” refers to several types of heart conditions. The most common type of heart disease in the United States is coronary artery disease (CAD), which affects the blood flow to the heart. Decreased blood flow can cause a heart attack.
Source: CDC
Heart disease is the leading cause of death in the United States, the UK, and worldwide. It causes more than 73,000 and 600,000 deaths per year in the UK and the US, respectively1,2. Heart disease caused the death of about 1 in 6 men and 1 in 10 women.
Source: Nature Journal

Image Source: Wikipedia
Machine learning analyzes patient data to identify heart disease patterns. It assists in accurate diagnoses and predicts patient outcomes. Wearable devices can integrate these algorithms for real-time heart health monitoring.
The goal is to train a machine learning model that predicts a box around the heart in X-ray images.
Anomalies in the size or position of the heart can help us predict heart disease
Project consists of 3 sections:
- Preprocessing
- Dataset
- Model-Training
Separate normalize and separate our data into train-val, and also calculate mean and std of pixel arrays and save their labels for later.
Few images from training data:
Create a CardiacDataset class to extract bounding box coordinates and augment images with boxes together, if there was augmentation available, also normalize images with mean and std saved. We save this class as a cardiac_dataset.py script to import it in Model-Training later.
Example of image and box, both augmented in the same way:
Dataset used for this project: https://www.kaggle.com/c/rsna-pneumonia-detection-challenge
But labels are here: https://www.kaggle.com/datasets/vivekprajapati2048/rsnacardiacdetectionlabels
Loading datasets with corresponding paths to labels and actual data, defining data loader and then
creating CardiacDetectionModel, we used pretrained ResNet18 model with minor modification, using optim.Adam and MSELoss,
we also logged images for better visualization of how actually the training happens:


