A machine learning project for classifying scoliosis from X-ray images.
Report Bug
·
View TensorBoard
·
Request Feature
- Table of Contents
- About the Project
- Getting Started
- Model
- AWS Fargate Deployment
- TensorBoard
- Contributing
- License
- Contact
This project aims to classify scoliosis from X-ray images using deep learning techniques. The model is trained on a dataset of X-ray images labeled as either "Normal" or "Scoliosis".
To get a local copy up and running, follow these steps.
- Python 3.11
- Docker
- AWS CLI
-
Clone the repo:
git clone https://github.com/AdamSkog/Scoliosis-Classification-Project.git
-
Install the required packages:
pip install -r requirements.txt
I chose ResNet50 as the pre-trained model for this project for several reasons:
-
Deep Architecture: ResNet50 is a deep convolutional neural network with 50 layers, which allows it to learn complex features from images effectively. This is particularly important for classifying X-ray images, where subtle differences can be crucial for accurate diagnosis.
-
Residual Connections: The residual connections in ResNet50 help mitigate the vanishing gradient problem, making it easier to train very deep networks. This is beneficial for achieving high accuracy in medical image classification tasks, such as detecting scoliosis from X-ray images.
-
Pre-trained Weights: ResNet50 comes with pre-trained weights on the ImageNet dataset, providing a strong starting point for transfer learning. Given that I only have access to a limited dataset of around 250 images, transfer learning is likely a better solution than building a CNN from scratch. The pre-trained model can leverage learned features from a large and varied dataset, which is crucial when working with small datasets.
-
Proven Performance: ResNet50 has been widely used and validated in various image classification tasks, including biomedical image processing. Its proven track record makes it a reliable choice for this project, ensuring that I can achieve high performance in classifying scoliosis from X-ray images.
-
Feature Extraction: The architecture is well-suited for extracting meaningful features from medical images, which is crucial for accurate classification in tasks like scoliosis detection.
-
Learning Experience: Simply put, using ResNet50 for transfer learning also provides me with valuable experience in applying transfer learning techniques. This is an important skill, as transfer learning is often more effective than training models from scratch, especially when dealing with limited data.
By leveraging ResNet50, I can take advantage of its robust architecture and pre-trained weights to achieve high performance in classifying scoliosis from X-ray images, while also gaining experience in transfer learning techniques.
The model achieved an accuracy of 95% on the test set, demonstrating its effectiveness in classifying scoliosis from X-ray images.
--Learn more about ResNet50 here--
The project is deployed using AWS Fargate. Below is the architecture diagram for the deployment.
+-------------------+ +-------------------+ +-------------------+
| | | | | |
| AWS IAM | | Amazon ECR | | AWS ECS |
| | | | | |
| - IAM Role | | - Docker Image | | - ECS Cluster |
| | | | | - Task Definition |
| | | | | - Fargate Service |
+-------------------+ +-------------------+ +-------------------+
| | |
| | |
| | |
v v v
+-------------------+ +-------------------+ +-------------------+
| | | | | |
| AWS VPC | | AWS Subnet | | Security Group |
| | | | | |
| - VPC | | - Public Subnet | | - Inbound Rule |
| - Internet Gateway| | | | (Port 6006) |
| | | | | |
+-------------------+ +-------------------+ +-------------------+
| | |
| | |
| | |
v v v
+--------------------------------------------------------------------------+
| |
| AWS Fargate |
| |
| - Runs ECS Task |
| - Uses Docker Image from ECR |
| - Uses IAM Role for permissions |
| - Runs in VPC with Public Subnet |
| - Accessible via Security Group allowing inbound traffic on Port 6006 |
| |
+--------------------------------------------------------------------------+
|
|
v
+-------------------+
| |
| TensorBoard |
| |
| - Accessible via |
| Public IP |
|(52.12.96.55:6006/)|
| |
+-------------------+
-
Serverless Architecture: AWS Fargate is a serverless compute engine, which means I don't have to manage the underlying infrastructure. This is particularly advantageous for this project because the TensorBoard will not be viewed frequently enough to justify the cost and maintenance of an EC2 instance.
-
Scalability: Fargate automatically scales the compute resources based on the workload. This ensures that the TensorBoard service can handle varying levels of traffic without manual intervention.
-
Cost-Effective: Since Fargate charges based on the resources used per task, it is more cost-effective for a project like this where the TensorBoard usage is sporadic.
-
Simplified Management: With Fargate, I don't need to worry about provisioning, configuring, or scaling clusters of virtual machines. This allows me to focus more on the development and improvement of the machine learning model rather than infrastructure management.
-
Integration with AWS Services: Fargate integrates seamlessly with other AWS services like Amazon ECR for container storage, AWS IAM for security, and Amazon VPC for networking. This mades it easier to set up a secure and efficient deployment pipeline.
-
Security: Fargate provides built-in security features such as task-level isolation and integration with AWS IAM roles, ensuring that my TensorBoard service runs in a secure environment.
You can monitor the training process using TensorBoard.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Adam Skoglund - @AdamSkog - adamskoglund2022@gmail.com