Skip to content

Commit

Permalink
Merge pull request #694 from adi271001/rsna-lumbar-spine-detection
Browse files Browse the repository at this point in the history
Rsna lumbar spine detection
  • Loading branch information
abhisheks008 authored Jul 6, 2024
2 parents 1163173 + ba480ff commit 2377021
Show file tree
Hide file tree
Showing 57 changed files with 374 additions and 0 deletions.
43 changes: 43 additions & 0 deletions RSNA Lumbar Spine Degenerative Classification/Dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# RSNA Lumbar Spine Degenerative Classification Dataset

## 🎯 Goal

The main goal of this dataset is to provide medical imaging data for the classification of degenerative changes in the lumbar spine. This dataset can be used to train machine learning models to predict spinal conditions.

## 🧵 Dataset

The dataset used for this project is sourced from the [RSNA 2024 Lumbar Spine Degenerative Classification competition on Kaggle](https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/data).

## 🧾 Description

This dataset contains medical imaging data of lumbar spines. The images are labeled to indicate the presence and severity of degenerative changes. The dataset includes a variety of features such as patient age, sex, and other relevant clinical information.

## 📚 Files Included

- **train_images/**: Directory containing training images.
- **train.csv**: CSV file containing labels and metadata for the training images.
- **test_images/**: Directory containing test images.
- **sample_submission.csv**: CSV file providing a sample submission format for the competition.

## 🔢 Features

- **Image ID**: Unique identifier for each image.
- **Patient Age**: Age of the patient.
- **Patient Sex**: Sex of the patient.
- **Degenerative Grade**: Severity of degenerative changes (e.g., none, mild, moderate, severe).

## 🔍 Usage

The dataset can be used for:
- Training machine learning models to classify degenerative changes in lumbar spine images.
- Evaluating the performance of different models in predicting spinal conditions.
- Conducting research on medical image analysis and spinal health.

## 📢 Notes

- Ensure proper preprocessing of the images before feeding them into machine learning models.
- Follow the competition guidelines for the correct usage of the dataset in the Kaggle competition.
- Use the sample submission file to format your predictions for submission.



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions RSNA Lumbar Spine Degenerative Classification/Models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# RSNA Lumbar Spine Analysis - Models

## Notebook Link: https://drive.google.com/file/d/1wsa5uKNBNp7CXOlpi1PC8gG0-H7aaMJO/view?usp=sharing (i am not able to upload the notebook as it is 46 mb and allowed size in github is 25 mb)

## 🚀 Models Implemented

1. **Random Forest**: Selected for its ability to handle large datasets and provide feature importance.
2. **XGBoost**: Chosen for its high performance and scalability.
3. **Logistic Regression**: A basic model to establish a performance baseline.
4. **Gradient Boosting**: Implemented for its accuracy in classification tasks.
5. **AdaBoost**: Chosen for its ability to improve the performance of weak classifiers.
6. **CatBoost**: Selected for its efficiency with categorical data.
7. **LightGBM**: Chosen for its fast training speed and low memory usage.

## 📚 Libraries Needed

- pandas
- numpy
- matplotlib
- seaborn
- scikit-learn
- xgboost
- catboost
- lightgbm

## 📈 Performance of the Models based on the Accuracy Scores

- **Random Forest**: 65%
- **XGBoost**: 75%
- **Logistic Regression**: 76%
- **Gradient Boosting**: 76%
- **AdaBoost**: 76%
- **CatBoost**: 76%
- **LightGBM**: 76%
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___67_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___75_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___83_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___91_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___99_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___107_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___115_0.png?raw=true)
- ![Randome Forest](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___119_0.png?raw=true)

## 📢 Conclusion

The best performing models were Logistic Regression, Gradient Boosting, AdaBoost, CatBoost, and LightGBM, each achieving an accuracy of 76%. XGBoost was a close second with 75% accuracy.

✒️ Your Signature
#### Aditya D

#### Github: https://www.github.com/adi271001

#### LinkedIn: https://www.linkedin.com/in/aditya-d-23453a179/

#### Topmate: https://topmate.io/aditya_d/

#### Twitter: https://x.com/ADITYAD29257528
84 changes: 84 additions & 0 deletions RSNA Lumbar Spine Degenerative Classification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# RSNA Lumbar Spine Analysis

<p style="font-family: 'Amiri', serif; font-size: 3rem; color: black; text-align: center; margin: 0; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); background-color: cyan; padding: 20px; border-radius: 20px; border: 7px solid #2ca02c; width: 95%;">RSNA Lumbar Spine Analysis</p>

## 🎯 Goal

The main goal of this project is to analyze lumbar spine data to predict spinal conditions using various machine learning models. The purpose is to identify the most effective model for accurate predictions.

## 🧵 Dataset

The dataset used for this project can be accessed [here](https://www.kaggle.com/competitions/rsna-2024-lumbar-spine-degenerative-classification/data).

## 🧾 Description

This project involves the analysis of lumbar spine data, utilizing machine learning models to predict spinal conditions. The project includes data preprocessing, model training, evaluation, and comparison of multiple algorithms to determine the most accurate model.

## 🧮 What I had done!

1. **Data Collection**: Acquired the lumbar spine dataset from RSNA.
2. **Data Preprocessing**: Cleaned and prepared the data for analysis.
3. **Exploratory Data Analysis (EDA)**: Visualized the data to understand the distribution and relationships between variables.
4. **Model Training**: Implemented various machine learning models.
5. **Model Evaluation**: Evaluated the performance of each model using accuracy scores.
6. **Model Comparison**: Compared the models to identify the best performer.
7. **Visualization**: Plotted confusion matrices for model predictions.

## 🚀 Models Implemented

1. **Random Forest**: Selected for its ability to handle large datasets and provide feature importance.
2. **XGBoost**: Chosen for its high performance and scalability.
3. **Logistic Regression**: A basic model to establish a performance baseline.
4. **Gradient Boosting**: Implemented for its accuracy in classification tasks.
5. **AdaBoost**: Chosen for its ability to improve the performance of weak classifiers.
6. **CatBoost**: Selected for its efficiency with categorical data.
7. **LightGBM**: Chosen for its fast training speed and low memory usage.

## 📚 Libraries Needed

- pandas
- numpy
- matplotlib
- seaborn
- scikit-learn
- xgboost
- catboost
- lightgbm

## 📊 Exploratory Data Analysis Results

![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___12_1.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___13_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___15_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___19_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___45_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___48_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___49_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___50_0.png?raw=true)
![EDA Image 1](https://github.com/adi271001/ML-Crate/blob/rsna-lumbar-spine-detection/RSNA%20Lumbar%20Spine%20Degenerative%20Classification/Images/__results___51_0.png?raw=true)


## 📈 Performance of the Models based on the Accuracy Scores

- **Random Forest**: 65%
- **XGBoost**: 75%
- **Logistic Regression**: 76%
- **Gradient Boosting**: 76%
- **AdaBoost**: 76%
- **CatBoost**: 76%
- **LightGBM**: 76%

## 📢 Conclusion

The project successfully implemented and evaluated various machine learning models on the lumbar spine dataset. The best performing models were Logistic Regression, Gradient Boosting, AdaBoost, CatBoost, and LightGBM, each achieving an accuracy of 76%. Among these, XGBoost was a close second with 75% accuracy.

✒️ Your Signature
#### Aditya D

#### Github: https://www.github.com/adi271001

#### LinkedIn: https://www.linkedin.com/in/aditya-d-23453a179/

#### Topmate: https://topmate.io/aditya_d/

#### Twitter: https://x.com/ADITYAD29257528
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pandas==2.0.3
numpy==1.25.0
matplotlib==3.7.2
seaborn==0.12.2
scikit-learn==1.3.0
xgboost==1.7.6
catboost==1.2
lightgbm==4.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
row_id,normal_mild,moderate,severe
44036939_left_neural_foraminal_narrowing_l1_l2,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_neural_foraminal_narrowing_l2_l3,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_neural_foraminal_narrowing_l3_l4,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_neural_foraminal_narrowing_l4_l5,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_neural_foraminal_narrowing_l5_s1,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_subarticular_stenosis_l1_l2,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_subarticular_stenosis_l2_l3,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_subarticular_stenosis_l3_l4,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_subarticular_stenosis_l4_l5,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_left_subarticular_stenosis_l5_s1,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_neural_foraminal_narrowing_l1_l2,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_neural_foraminal_narrowing_l2_l3,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_neural_foraminal_narrowing_l3_l4,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_neural_foraminal_narrowing_l4_l5,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_neural_foraminal_narrowing_l5_s1,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_subarticular_stenosis_l1_l2,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_subarticular_stenosis_l2_l3,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_subarticular_stenosis_l3_l4,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_subarticular_stenosis_l4_l5,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_right_subarticular_stenosis_l5_s1,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_spinal_canal_stenosis_l1_l2,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_spinal_canal_stenosis_l2_l3,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_spinal_canal_stenosis_l3_l4,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_spinal_canal_stenosis_l4_l5,0.11321856526864094,0.3722893641117231,0.5144920706196361
44036939_spinal_canal_stenosis_l5_s1,0.11321856526864094,0.3722893641117231,0.5144920706196361
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
row_id,normal_mild,moderate,severe
44036939_left_neural_foraminal_narrowing_l1_l2,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_neural_foraminal_narrowing_l2_l3,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_neural_foraminal_narrowing_l3_l4,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_neural_foraminal_narrowing_l4_l5,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_neural_foraminal_narrowing_l5_s1,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_subarticular_stenosis_l1_l2,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_subarticular_stenosis_l2_l3,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_subarticular_stenosis_l3_l4,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_subarticular_stenosis_l4_l5,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_left_subarticular_stenosis_l5_s1,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_neural_foraminal_narrowing_l1_l2,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_neural_foraminal_narrowing_l2_l3,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_neural_foraminal_narrowing_l3_l4,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_neural_foraminal_narrowing_l4_l5,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_neural_foraminal_narrowing_l5_s1,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_subarticular_stenosis_l1_l2,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_subarticular_stenosis_l2_l3,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_subarticular_stenosis_l3_l4,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_subarticular_stenosis_l4_l5,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_right_subarticular_stenosis_l5_s1,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_spinal_canal_stenosis_l1_l2,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_spinal_canal_stenosis_l2_l3,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_spinal_canal_stenosis_l3_l4,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_spinal_canal_stenosis_l4_l5,0.3158980071790004,0.32453311006496394,0.3595688827560357
44036939_spinal_canal_stenosis_l5_s1,0.3158980071790004,0.32453311006496394,0.3595688827560357
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
row_id,normal_mild,moderate,severe
44036939_left_neural_foraminal_narrowing_l1_l2,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_neural_foraminal_narrowing_l2_l3,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_neural_foraminal_narrowing_l3_l4,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_neural_foraminal_narrowing_l4_l5,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_neural_foraminal_narrowing_l5_s1,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_subarticular_stenosis_l1_l2,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_subarticular_stenosis_l2_l3,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_subarticular_stenosis_l3_l4,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_subarticular_stenosis_l4_l5,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_left_subarticular_stenosis_l5_s1,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_neural_foraminal_narrowing_l1_l2,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_neural_foraminal_narrowing_l2_l3,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_neural_foraminal_narrowing_l3_l4,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_neural_foraminal_narrowing_l4_l5,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_neural_foraminal_narrowing_l5_s1,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_subarticular_stenosis_l1_l2,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_subarticular_stenosis_l2_l3,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_subarticular_stenosis_l3_l4,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_subarticular_stenosis_l4_l5,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_right_subarticular_stenosis_l5_s1,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_spinal_canal_stenosis_l1_l2,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_spinal_canal_stenosis_l2_l3,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_spinal_canal_stenosis_l3_l4,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_spinal_canal_stenosis_l4_l5,0.3040997527636134,0.35368222116915127,0.3422180260672354
44036939_spinal_canal_stenosis_l5_s1,0.3040997527636134,0.35368222116915127,0.3422180260672354
Loading

0 comments on commit 2377021

Please sign in to comment.