This project focuses on building a deep learning model to classify bone fractures from X-ray images using a convolutional neural network (CNN). The dataset used contains multi-region X-ray images categorized into fractured and not_fractured.
- Source: Fracture Multi-Region X-Ray Data
- The dataset is structured into three splits:
dataset_bone_fracture/ βββ train/ β βββ fractured/ β βββ not_fractured/ βββ val/ β βββ fractured/ β βββ not_fractured/ βββ test/ βββ fractured/ βββ not_fractured/
Note: The dataset is large and is not included in this repository. Please download it from Kaggle and place the unzipped dataset_bone_fracture folder in the same directory as the notebook.
- Directory structure and file counts explored using a custom
explore_dataset()function. - Grid visualization of sample images from each class.
- File integrity checks to remove any corrupted images.
- Distribution plots showing image counts across train, val, and test splits.
- All images resized to
224x224. - Image data generators apply random transformations:
- Rotation, width/height shift, zoom, horizontal/vertical flip.
- Pixel values normalized to the
[0, 1]range.
- Sequential CNN with:
- Convolutional layers + MaxPooling
- Batch Normalization and Dropout
- Dense layers with ReLU and softmax activation
- Compiled with:
- Loss: Categorical Crossentropy
- Optimizer: Adam
- Metrics: Accuracy
- Trained using:
history = model.fit( train_data, validation_data=val_data, epochs=10, steps_per_epoch=len(train_data), validation_steps=len(val_data) )
- Visualizations:
- Accuracy and Loss vs. Epoch
- Confusion Matrix
- Classification Report
- Evaluation on the test set shows classification performance using precision, recall, and F1-score.
- The confusion matrix helps visualize the model's performance in classifying both
fracturedandnot_fracturedimages.
- Download the dataset from Kaggle.
- Unzip it and place the
dataset_bone_fracturefolder in the same directory as the notebook. - Install required packages:
pip install tensorflow matplotlib seaborn scikit-learn
- Run all cells in the notebook.