This repository contains projects focused on detecting pneumonia and Covid-19 using chest X-ray images. The projects utilize deep learning techniques to classify images and detect anomalies effectively.
The main goal of these projects is to develop machine learning models that can accurately detect pneumonia and Covid-19 from chest X-ray images. The models are trained on datasets of pediatric chest X-ray images and are evaluated for their diagnostic accuracy.
The datasets used in these projects contain X-ray images categorized into pneumonia, normal, and Covid-19 cases, organized in train
, test
, and val
folders. The datasets are sourced from reputable medical centers and are publicly available for research purposes.
- Pneumonia Dataset:
- Source: Kaggle Dataset
- Additional Data: Mendeley Data
- Covid-19 Dataset:
- Source: Cell Full Text
To run the notebooks and reproduce the results, follow these steps:
-
Clone the repository:
git clone https://github.com/nirtuttnauer/chest-xray-detection.git cd chest-xray-detection
-
Create a virtual environment and install the required packages:
python3 -m venv env source env/bin/activate pip install -r requirements.txt
-
Download the datasets and place them in the appropriate directory:
mkdir data # Move the downloaded datasets into the data directory
To run the analysis, open the Jupyter notebooks and execute the cells in order:
train.ipynb
: This notebook contains the training process for the pneumonia and Covid-19 detection models.test.ipynb
: This notebook contains the testing and evaluation process for the trained models.
- Data Preprocessing: Quality control screening, image resizing, and normalization.
- Model Training: Using convolutional neural networks (CNN) to train the model on the X-ray images.
- Evaluation: Assessing the model's performance using accuracy, precision, recall, and F1-score metrics.
- Data Splitting: Dividing the dataset into training, validation, and test sets.
- Data Augmentation: Applying techniques such as rotations, horizontal flipping, and zooming to improve generalization.
- Model Architecture: Implementing binary and multiclass classification models using CNNs and transfer learning with VGG16.
- Anomaly Detection: Utilizing autoencoders for unsupervised learning to detect anomalies in chest X-ray images.
- Embedding and KNN: Extracting embeddings from the multi-class model and using k-Nearest Neighbors for classification.
The trained model achieves a high accuracy in detecting pneumonia from chest X-ray images. Detailed results and visualizations can be found in the test.ipynb
notebook.
The models for Covid-19 detection showed significant performance, with binary classification achieving over 89% accuracy and multi-class classification reaching 82% accuracy. Anomaly detection and KNN classification further enhanced the robustness of the system.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.
Let me know if you need any additional sections or modifications to this README.