This project aims to detect pneumonia in chest X-ray images using Convolutional Neural Networks (CNN). It includes a Jupyter notebook for model training and evaluation and a Flask web application for real-time inference on user-uploaded images.
- Python 3.x
- TensorFlow
- pandas
- NumPy
- Matplotlib
- scikit-learn
- Flask
- Streamlit
-
Clone the repository:
git clone https://github.com/Alikhizar142/pneumonia-detection.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Load the dataset: Ensure you have downloaded and placed the dataset appropriately. You can modify the paths in the code if necessary.
-
Execute the notebook: Run the provided Jupyter notebook
pneumonia_detection.ipynb
to go through the data preprocessing, model building, training, and evaluation steps. -
Adjust parameters: You can tweak the model architecture, data augmentation techniques, and hyperparameters to improve performance.
-
Evaluate the model: After training, evaluate the model's performance on the test set and analyze the results.
-
Run the Flask application:
python flask_app.py
-
Visit
http://localhost:5000
in your web browser to use the Flask web application.
-
Run the Streamlit application:
streamlit run app.py
-
Open your web browser and visit the URL displayed in the terminal to access the Streamlit web application.
The Flask web application allows users to upload chest X-ray images and receive real-time predictions on whether pneumonia is detected.
/
: Home page with an upload form to submit images for prediction./about
: About page providing information about the project.
The trained model (my_model3.h5
) is loaded into the Flask application for inference. It uses a pre-trained VGG16 architecture fine-tuned for pneumonia detection.
This project is licensed under the MIT License.
- The dataset used in this project is sourced from Kaggle.
- We acknowledge the developers of TensorFlow, scikit-learn, Flask, and other open-source libraries used in this project.
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.