Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignore the data
./data
./data/*
./original_data
./original_data/*
122 changes: 71 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,71 @@
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)

# Image Processing and Computer Vision

## Introduction

The field of computer vision is revolutionizing the way machines interact with the visual world. Through this project, students will engage with fundamental techniques in image classification, applying machine learning models to real-world datasets. This will provide hands-on experience in both developing and deploying classifiers that can discern between different categories of objects in images.

## Project Overview

This project is divided into several phases, each designed to deepen your understanding and skills in computer vision:

1. **Dataset Selection**: Choose one of the provided datasets for image classification. Each dataset has unique characteristics and challenges:
- [Recycling](https://drive.google.com/file/d/1WhDq3xo2T-a8BAbx0ByoF8K1zvrHE5f2/view?usp=sharing): The dataset consists of images for machine learning classification, divided into two categories: recyclable and household waste. It aims to facilitate the development of models that can automate the sorting of these waste types, enhancing recycling processes.
- [Bone Fractures](https://drive.google.com/file/d/1WeuxOenviI1_ElW5ISED4MhvR_YFYdmB/view?usp=drive_link): The dataset includes multi-region X-ray images focused on diagnosing bone fractures.
- [Parking Lot Detection](https://drive.google.com/file/d/1Wehry7yNRMY5PELWkY6ysW_oQP44Xvzf/view?usp=sharing): The dataset is designed for developing and testing parking lot vehicle detection algorithms.

2. **Exploratory Data Analysis (EDA)**: Analyze the dataset to understand its structure, features, and the challenges it presents. Document your findings and initial thoughts on how to approach the classification problem.

3. **Model Development**:
- Preprocess the images to get them ready for training.
- Select and apply a machine learning algorithm to build a classifier. You can use frameworks like TensorFlow, Keras, or PyTorch.
- Train your model and optimize its parameters to achieve the best performance.

4. **Evaluation**:
- Validate your model using appropriate metrics (accuracy, precision, recall, F1-score, etc.).
- Discuss the performance of your model and any potential biases or limitations.

5. **Deployment (Optional choices)**:
- Deploy your model as a simple web application or a script that can take an image input and output a classification.
- You can use streamlit + Flask for this, for example
- Run your model on SageMaker

## Resources

- TensorFlow: [https://www.tensorflow.org/](https://www.tensorflow.org/)
- PyTorch: [https://pytorch.org/](https://pytorch.org/)
- Scikit-Learn for preprocessing tools: [https://scikit-learn.org/](https://scikit-learn.org/)

## Deliverables

1. **Python Code:** Provide well-documented Python code that conducts the analysis.
2. **Report**: Submit a detailed report documenting your EDA findings, model development process, evaluation metrics, and conclusions about the model's performance.
3. **Presentation**: Prepare a short presentation that overviews your project, from the dataset analysis to the final model evaluation. Include visual aids such as charts, model diagrams, and example predictions.

## Bonus

- Implement data augmentation techniques to improve your model's robustness.
- Compare the performance of at least three different models or architectures.
- Provide an interactive demo of your model during the presentation.

# 🦴 Fractured, Or Not-Fractured — That Is The Question
### An Image Processing and Computer Vision Project | Ironhack Data Science Bootcamp

## 📌 Introduction
Computer vision is a powerful application of deep learning that enables machines to interpret and understand visual data. In this project, I applied a computer vision approach to classify bone X-ray images into two categories: **fractured** and **non-fractured**. These X-rays come from various body parts, offering a diverse dataset for training and evaluation. The primary objective was to utilize a modern deep learning model to automate fracture detection, a task with significant potential in medical diagnostics.

## 🎯 Project Goals
- ✅ Preprocess the dataset by splitting it into **training**, **validation**, and **test** sets.
- ✅ Apply **data augmentation** techniques (e.g., image flipping and rotation) to increase model generalizability.
- ✅ Use a **pre-trained state-of-the-art model** (Transfer Learning) for efficient and accurate classification.
- ✅ Evaluate model performance using **accuracy metrics** and **confusion matrix**.
- ✅ Prepare a clear and concise **presentation** for stakeholders.

## 📂 Data Source
- **Bone Fracture X-ray Dataset**
📎 [Download here](https://drive.google.com/file/d/1WeuxOenviI1_ElW5ISED4MhvR_YFYdmB/view?usp=drive_link)
This dataset consists of X-ray images from various regions of the body, labeled as fractured or non-fractured.

## ⚙️ Methodology
1. **Data Cleaning**:
- Removed corrupted or unreadable images using `TensorFlow` utilities.

2. **Model Architecture**:
- Used `MobileNetV2` (a lightweight, efficient CNN model) as the backbone for classification.
- Applied transfer learning by fine-tuning only the top layers to adapt to our specific classification task.

3. **Training Setup**:
- Trained for **30 epochs** with early stopping based on validation loss.
- Saved the best performing model as `best_model.keras`.

4. **Evaluation**:
- Assessed model performance using **accuracy**, **loss curves**, and a **confusion matrix**.

## 💡 Key Insights
- `MobileNetV2` achieved a high classification **accuracy of 96%**.
- The model showed **minimal Type I and Type II errors**, making it highly reliable.
- Transfer learning significantly improved efficiency and performance, even with a moderately sized dataset.

## 🧾 Project Structure
```bash
fracture-classifier/
├── data/ # Download and keep your data here
├── code/ # Jupyter Notebooks for EDA, training and evaluation, best model (.keras) is here
├── presentation/ # Presentation to the stakeholder
├── README.md # Project documentation (this file)
├── task.md # Task given in the project
└── requirements.txt # Python dependencies
```

## 🚀 Getting Started
1. Clone the repository
```bash
git clone https://github.com/abhishek-chattopadhyay/project-4-cv.git
cd project-4-cv
```
2. Create a virtual environment and install dependencies:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```
3. Download the data from the link and put it into the data folder.
4. Run the `main.ipynb`

## 📝 Extra Notes
- This project was developed as part of the Ironhack Data Science Bootcamp.
- Future enhancements could include:
- Trying other models like EfficientNet, ResNet, or ensemble techniques.
- Expanding the dataset to include more fracture types.
- Deploying the model via a simple web app for demo purposes.
Binary file added code/best_model.keras
Binary file not shown.
Loading