{"id":19701442,"url":"https://github.com/Sadegh-Khedry/Pneumonia-Detection-Using-CNN","last_synced_at":"2026-04-12T13:08:50.771Z","repository":{"id":245787617,"uuid":"819231863","full_name":"sadegh15khedry/Pneumonia-Detection-Using-CNN","owner":"sadegh15khedry","description":"Classifying chest X-ray images into two categories: Pneumonia or Normal using a Convolutional Neural Network (CNN).","archived":false,"fork":false,"pushed_at":"2024-08-11T05:48:13.000Z","size":488,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T10:58:17.322Z","etag":null,"topics":["cnn","convolutional-neural-networks","cv2","deep-learning","harris-corners","joblib","jupyter-notebook","keras","kmeans-clustering","matplotlib","numpy","orb","pandas","python","seaborn","shutil","sifit","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sadegh15khedry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-24T05:27:08.000Z","updated_at":"2024-08-11T05:48:16.000Z","dependencies_parsed_at":"2024-06-24T06:38:09.738Z","dependency_job_id":"73497573-6d1f-487c-a699-8a6fd8b812a0","html_url":"https://github.com/sadegh15khedry/Pneumonia-Detection-Using-CNN","commit_stats":null,"previous_names":["sadegh15khedry/pneumonia-detection-using-cnn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadegh15khedry%2FPneumonia-Detection-Using-CNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadegh15khedry%2FPneumonia-Detection-Using-CNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadegh15khedry%2FPneumonia-Detection-Using-CNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sadegh15khedry%2FPneumonia-Detection-Using-CNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sadegh15khedry","download_url":"https://codeload.github.com/sadegh15khedry/Pneumonia-Detection-Using-CNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241014935,"owners_count":19894326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn","convolutional-neural-networks","cv2","deep-learning","harris-corners","joblib","jupyter-notebook","keras","kmeans-clustering","matplotlib","numpy","orb","pandas","python","seaborn","shutil","sifit","tensorflow"],"created_at":"2024-11-11T21:08:54.416Z","updated_at":"2026-04-12T13:08:50.705Z","avatar_url":"https://github.com/sadegh15khedry.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pneumonia Detection using CNN\n\nThis repository contains code for training and evaluating a convolutional neural network (CNN) model to detect pneumonia from chest X-ray images. we trained the model using blow mentioned dataset and were able to reach 90% accuracy.\n\n## Overview\n\nPneumonia is a lung infection that causes inflammation in the air sacs, or alveoli, of one or both lungs. The infection can be caused by bacteria, viruses, or fungi.\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Installation](#installation)\n3. [Folder Structure](#folder-structure)\n4. [Training](#training)\n5. [Test Results](#test-results)\n6. [Further Improvements](#further-improvements)\n7. [Contributing](#contributing)\n9. [License](#license)\n\n## Installation\n\nTo set up the environment for running this project, follow these steps:\n\n### Step 1: Dataset\nGet the dataset of the project form the link ( https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia ).\n\n### Step 2: Clone the Repository\n\nClone the repository to your local machine using Git:\n```bash\ngit clone https://github.com/your_username/your_repository.git\ncd Pneumonia-Detection-Using-CNN\n```\n\n### Step 3: Create and Activate a Conda Environment (Optional but Recommended)\n\nIf you prefer using Conda for managing environments, you can create a new Conda environment:\n```bash\nconda create --name pneumonia-env python=3.8\nconda activate pneumonia-env\n```\n\n### Step 4: Install Dependencies\n\nInstall the required packages using `pip` and the `requirements.txt` file provided:\n```bash\npip install -r requirements.txt\n```\n\nThis command will install all the necessary dependencies, including TensorFlow and other libraries required for the project.\n\n### Step 5: Run the Project\n\nYou're now ready to run the project. Depending on your setup and the structure of the project, you may run different scripts or notebooks for data preprocessing, model training, evaluation, etc.\n\n### Optional: GPU Support\n\nIf you have a CUDA-enabled GPU, you can install TensorFlow GPU for faster computations:\n```bash\npip install cuda==11.2.2 cudnn==8.1.0\npip install tensorflow-gpu==2.5.0\n```\n\nMake sure you have CUDA and cuDNN installed as per TensorFlow's requirements.\n\n### Step 6: Explore the Project\n\nExplore the project files and directories to understand the structure and functionality:\n\n- `data_preprocessing.ipynb`: Notebook for data preprocessing.\n- `model_training.ipynb`: Notebook for training the CNN model.\n- `model_evaluation.ipynb`: Notebook for evaluating model performance.\n- `data_exploration.py`: Python script for exploring the dataset.\n- `model_deployment.ipynb`: Notebook for deploying the trained model.\n\n\n## Folder Structure\n\nThe project folder structure is organized as follows:\n```\nPneumonia-Detection-Using-CNN/\n│\n├── data/\n│   ├── train/\n│   ├── test/\n│   └── val/\n├── models/\n│   └── cnn_model.h5\n├── notebooks/\n│   └── pneumonia_detection.ipynb\n├── src/\n│   ├── data_loader.py\n│   ├── model.py\n│   └── train.py\n├── results/\n│   ├── accuracy.png\n│   └── loss.png\n├── README.md\n└── environment.yml\n```\n### docs\nContains project documentation.\n\n### results\nStores experimental results and trained models.\n\n### src\nContains source code for the pneumonia detection model.\n\n### notebooks\nIncludes Jupyter notebooks used for experimentation and analysis.\n\n## Results\n\nDetailed results and performance metrics are stored in the `results/` directory.\n\n\n\n## Training\n\n### Model Training Details\n\nThe CNN model was trained to detect pneumonia from chest X-ray images. The training process involved optimizing the model to achieve high accuracy on both training and validation datasets. for generalization of our model, data augmentation was added and helped reducing the difrence of train and validation accuracy from 8 to near 0.\n\n\n\n### Performance Metrics\n\nDuring training, the model reached 92% accuracy on both the training and validation datasets, demonstrating its ability to generalize well to unseen data. \n\n![Screenshot 2024-07-02 082713](https://github.com/sadegh15khedry/Pneumonia-Detection-Using-CNN/assets/90490848/adc989e2-bacf-4940-b4a0-2b9ae7e26151)\n\n\n## Test Results\n\nAfter training and evaluating the pneumonia detection model using chest X-ray images, the following test results were obtained:\n```\n             precision    recall  f1-score   support\n\n      Normal       0.25      0.22      0.24       237\n   Pneumonia       0.72      0.75      0.74       640\n\n    accuracy                           0.61       877\n   macro avg       0.49      0.49      0.49       877\nweighted avg       0.59      0.61      0.60       877\n```\n\n- Test accuracy: 0.90\n- Test_loss: 0.30 \n- Precision: 0.59\n- Recall: 0.60\n- F1: 0.60\n\n![cm](https://github.com/sadegh15khedry/Pneumonia-Detection-Using-CNN/assets/90490848/25c3a822-f907-4fdf-b5c8-20abdf44f206)\n\nThese results indicate the performance metrics achieved by the model on the test dataset, demonstrating its effectiveness in detecting pneumonia from X-ray images.\n\n## Further Improvements\n- Implement transfer learning with pre-trained models.\n- Explore ensemble methods for improved performance.\n- Optimize hyperparameters for better precision and recall.\n\n\n\n\n## Contributing\n\nIf you wish to contribute to the project or modify it for your own use, feel free to fork the repository and create pull requests with your changes.\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSadegh-Khedry%2FPneumonia-Detection-Using-CNN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSadegh-Khedry%2FPneumonia-Detection-Using-CNN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSadegh-Khedry%2FPneumonia-Detection-Using-CNN/lists"}