This repository contains the code and resources for detecting pneumonia from chest X-ray images using the InceptionV3 deep learning model. The project leverages PyTorch for model development and training.
Table of Contents
Pneumonia is a serious lung infection that can be life-threatening. Early detection is crucial for effective treatment. This project aims to automate the detection of pneumonia from chest X-ray images using a pre-trained deep learning model (InceptionV3), which has been fine-tuned for this specific task.
- Source: The dataset used in this project is the Chest X-Ray Images (Pneumonia) dataset, available on Kaggle.
- Structure: The dataset is organized into three directories:
train
,val
, andtest
, each containing subdirectories forNORMAL
andPNEUMONIA
images. - Size: The dataset comprises thousands of X-ray images labeled as either
NORMAL
orPNEUMONIA
.
- Architecture: InceptionV3, a convolutional neural network known for its deep architecture and efficient computation.
- Modifications: The final fully connected layer is modified to output two classes (normal and pneumonia).
- Training: The model is trained using the Adam optimizer and Cross-Entropy Loss, with data augmentation applied to improve generalization.
- Python 3.7 or higher
- PyTorch
- torchvision
- numpy
- pandas
- matplotlib
- seaborn
- scikit-image
- scikit-learn
-
Clone the repository:
git clone https://github.com/your-username/pneumonia-detection-using-inceptionv3.git cd pneumonia-detection-using-inceptionv3
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Download the dataset:
- Download the dataset from Kaggle and place it in the appropriate directory as specified in the notebook.
-
Train the model:
- Open the Jupyter notebook
pneumonia-detection-using-inceptionv3.ipynb
. - Run all cells to train the model on the provided dataset.
- Open the Jupyter notebook
-
Evaluate the model:
- The notebook includes code to evaluate the trained model on the test dataset and visualize the results.
-
Inference:
- Use the trained model to predict pneumonia in new chest X-ray images by modifying the inference section in the notebook.
- Accuracy: The model achieves a high accuracy on the test dataset, indicating its effectiveness in detecting pneumonia.
- Visualization: The notebook provides visualizations of predictions, including a comparison of actual and predicted labels.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements or new features.
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature-branch
) - Create a new pull request
This project is licensed under the MIT License. See the LICENSE
file for more details.