# Pneumonia Detection AI ð¤
<img src="https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue"/> <img src="https://img.shields.io/badge/Jupyter-F37626.svg?&style=for-the-badge&logo=Jupyter&logoColor=white"/> <img src="https://img.shields.io/badge/TensorFlow-FF6F00?style=for-the-badge&logo=tensorflow&logoColor=white"/> <img src="https://img.shields.io/badge/Keras-FF0000?style=for-the-badge&logo=keras&logoColor=white"/> <img src="https://img.shields.io/badge/OpenCV-27338e?style=for-the-badge&logo=OpenCV&logoColor=white"/>
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CodeQL](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/codeql.yml)
[![Dependency Review](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/dependency-review.yml)\
[![Python Test [main]](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app.yml)
[![Python Test [Beta-b]](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app_Beta-b.yml/badge.svg?branch=Beta-b)](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app_Beta-b.yml)\
[![Python Test [Alpha-b]](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app_Alpha-b.yml/badge.svg?branch=Alpha-b)](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/actions/workflows/python-app_Alpha-b.yml)
### This project uses a deep learning model built with the TensorFlow Library to detect pneumonia in X-ray images. The model architecture is based on the EfficientNetB7 model, which has achieved an accuracy of approximately 97.12% (97.11538%) on our test data. This high accuracy rate is one of the strengths of our AI model.
> [!IMPORTANT]
> The code that had achieved the highest acc is `backup/V6/Model_T&T.ipynb`.\
> And the codes with the light and super light models are `backup/V7/Model_T&T.ipynb`, `backup/V8/Model_T&T.ipynb`.
## Usage
> [!TIP]
> If you just want the model go to the Github Releases.
> [!NOTE]
> This model was built using the [EfficientNet ](https://github.com/qubvel/efficientnet) library,
> which is a collection of state-of-the-art models for image classification. To use the model,
> you need to install the library and import it as follows:
> ```python
> import efficientnet.tfkeras
> ```
> Or clone the project and use `Utils.FixedDropout`:
> ```python
> from Utils.FixedDropout import FixedDropout
> from keras.models import load_model
>
> # Load the model
> model = load_model('PAI_model_T.h5', custom_objects={'FixedDropout': FixedDropout})
> ```
The project includes a Command Line Interface (CLI) and a (GUI) Graphical User Interface for easy use of the model. The CLI, which is based on the [Python CLI template](https://github.com/Aydinhamedi/Python-CLI-template) from the same author, provides a user-friendly, colorful interface that allows you to interact with the model. you can fined the CLI in
```
Interface\CLI
```
Additionally, a Graphical User Interface (GUI) is available. you can fined the GUI in
```
Interface\GUI
```
### Example Image of the CLI (V0.8.9.3) ⤵
![Example](doc/Other/CLI_V0.8.9.3.png)
### Example Image of the GUI (V0.8.9.6) ⤵
![Example](doc/Other/GUI_V0.8.9.6.png)
## Release
> ### Newest release ð
> #### [Go to newest release](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/releases/latest)
## Training System Specifications
- **Graphics Card (GPU)**: RTX 3090
- **Memory (RAM)**: 64GB
- **Operating System (OS)**: Windows 11 Pro
- **Processor (CPU)**: Intel Core i7-12700KF
## Model
The model is a Convolutional Neural Network (CNN) trained on a dataset of 23681 X-ray images. The dataset is a combination of the following:
- Chest X-ray Pneumonia dataset from Kaggle
- Covid19-Pneumonia-Normal Chest X-Ray Images from Mendeley
- RSNA dataset
This combined dataset provides a comprehensive set of images for training the model.\
### Model list:
| Model | Base Model | Params | acc | Status |
|----------|-----------------|--------|--------|--------|
| V6 | efficientnet-b7 | 65.4M | 97.12% | â
|
| V7 light | efficientnet-b4 | 29.7M | 97.12% | â
|
| V8 Super light | efficientnet-b0 | 4.8M | 96.47% | â
|
## Training Methods
### The AI model supports two distinct training approaches:
- rev1: A straightforward method using Keras fit function for basic training.
- rev2: An enhanced training strategy incorporating data augmentation and subset training for improved accuracy and generalization.
### rev2 Training Simplified:
- Memory Optimization: Begins with clearing system memory to ensure efficient resource utilization.
- Hyperparameter Setup: Configures essential training parameters such as epoch count and batch size.
- Data Enrichment: Utilizes data augmentation techniques to introduce variability in the training dataset.
- Focused Training: Implements training on data subsets to reduce overfitting and streamline the learning process.
- Adaptive Learning Rate: Applies a dynamic learning rate schedule to fine-tune the training progression.
- Training Supervision: Uses callbacks for monitoring training, saving the best model, and enabling early stopping.
- Progressive Learning: Trains the model iteratively on subsets, evaluating and adjusting after each epoch.
- Data Standardization: Normalizes image inputs to facilitate model training.
- Robustness Enhancement: Introduces random noise to training images to strengthen model robustness against unseen data.
- While rev1 is suitable for quick and simple model training, rev2 is tailored for those seeking a more sophisticated and potentially more effective training regimen.
## Repository Structure
Please note that due to the large size of some files and folders, they are not available directly in the repository. However, they can be found in the [Releases](https://github.com/Aydinhamedi/Pneumonia-Detection-Ai/releases) page of the repository. This includes the model weights and the database, which are crucial for the functioning of the AI model.
## Contribution
Any contributions to improve the project are welcome. You can submit a pull request or open an issue on GitHub. Please make sure to test your changes thoroughly before submitting. We appreciate your help in making this project better.
## WARNING
> [!CAUTION]
The model provided in this project should not be used for medical diagnosis without further validation. While the model has shown high accuracy in detecting pneumonia from X-ray images, it is not a substitute for professional medical advice. Please consult with a healthcare professional for medical advice.
## Other
> [!NOTE]
> Please note that this code uses my:
> - Python-CLI-template
> - for more info go to https://github.com/Aydinhamedi/Python-CLI-template.
> - Python-color-print-V2
> - for more info go to https://github.com/Aydinhamedi/Python-color-print-V2.
> - Python-color-print
> - for more info go to https://github.com/Aydinhamedi/Python-color-print.
## Results
> [!WARNING]
> Results were achieved using Rev2 training method and Rev1.2 model and
> with `backup/V6/Model_T&T.ipynb` code.
<!-- #### N/A -->
### Acc:
![img_](doc/V6/D1.png)
### Grad cam:
| Model | Grad-cam Ex |
|----------|----------|
| V6 | ![img_](doc/V6+/D1.png)![img_](doc/V6+/D2.png)![img_](doc/V6+/D3.png)|
| V7 light | ð§Noneð§|
| V8 super light | ð§Noneð§|
### Other:
![img_](doc/V6/D4.png)
<!--
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
肺炎检测AI项目是一个基于深度学习技术项目,旨在利用计算机视觉和医学图像分析技术来辅助医生在早期诊断肺炎。该项目提供了一个完整的端到端解决方案,包括数据预处理、模型训练和部署等环节。 该项目的主要特点包括: 数据集:采用了大规模的医学影像数据集,包括正常胸部X光片和肺炎患者的X光片,以便进行模型训练和评估。 模型架构:采用了深度卷积神经网络(CNN)作为主要模型架构,通过对影像进行特征学习和提取,实现高效的肺炎检测。 性能评估:通过准确率、召回率等指标对模型性能进行评估,并进行了交叉验证等实验,验证模型的鲁棒性和泛化能力。 应用部署:提供了模型的部署方案,可以在医疗机构等实际场景中应用,帮助医生进行肺炎诊断和治疗决策。 通过该项目,我们可以更快速、准确地进行肺炎的早期诊断,提高患者的治疗效果和生存率,具有重要的临床应用意义。
资源推荐
资源详情
资源评论
收起资源包目录
肺炎检测AI:基于深度学习的医学影像分析项目 (200个子文件)
TRAIN_LOG_ANSI.ans 426KB
TRAIN_LOG_ANSI.ans 344KB
CLI.cmd 5KB
GUI.cmd 3KB
Create_requirements.cmd 443B
Cache_clear.cmd 177B
Update_Code.cmd 81B
Create_tensorboard_i.cmd 73B
model_history_CSV.csv 46KB
model_history_CSV.csv 46KB
.gitignore 2KB
model_history.pkl.gz 7KB
model_history.pkl.gz 7KB
Model_T&T.ipynb 6.39MB
Model_T&T.ipynb 6.39MB
Model_T&T.ipynb 5.54MB
Model_T&T.ipynb 5.06MB
BETA_E_Model_T&T.ipynb 5.06MB
Model_T&T.ipynb 5.06MB
Model_T&T.ipynb 4.35MB
Model_T&T.ipynb 3.89MB
Model_T&T.ipynb 3.54MB
Model_T&T.ipynb 2.88MB
Model_T&T_BETA.ipynb 2.72MB
Model_TT.ipynb 763KB
Model_TT.ipynb 280KB
NORMAL2-IM-1440-0001.jpeg 518KB
NORMAL2-IM-1440-0001.jpeg 518KB
NORMAL2-IM-1440-0001.jpeg 518KB
NORMAL2-IM-1442-0001.jpeg 464KB
NORMAL2-IM-1442-0001.jpeg 464KB
NORMAL2-IM-1442-0001.jpeg 464KB
NORMAL2-IM-1430-0001.jpeg 257KB
NORMAL2-IM-1430-0001.jpeg 257KB
NORMAL2-IM-1430-0001.jpeg 257KB
NORMAL2-IM-1427-0001.jpeg 247KB
NORMAL2-IM-1427-0001.jpeg 247KB
NORMAL2-IM-1427-0001.jpeg 247KB
NORMAL2-IM-1431-0001.jpeg 245KB
NORMAL2-IM-1431-0001.jpeg 245KB
NORMAL2-IM-1431-0001.jpeg 245KB
NORMAL2-IM-1436-0001.jpeg 243KB
NORMAL2-IM-1436-0001.jpeg 243KB
NORMAL2-IM-1436-0001.jpeg 243KB
NORMAL2-IM-1437-0001.jpeg 209KB
NORMAL2-IM-1437-0001.jpeg 209KB
NORMAL2-IM-1437-0001.jpeg 209KB
NORMAL2-IM-1438-0001.jpeg 167KB
NORMAL2-IM-1438-0001.jpeg 167KB
NORMAL2-IM-1438-0001.jpeg 167KB
person1954_bacteria_4886.jpeg 117KB
person1954_bacteria_4886.jpeg 117KB
person1954_bacteria_4886.jpeg 117KB
person1949_bacteria_4880.jpeg 97KB
person1949_bacteria_4880.jpeg 97KB
person1949_bacteria_4880.jpeg 97KB
person1952_bacteria_4883.jpeg 86KB
person1952_bacteria_4883.jpeg 86KB
person1952_bacteria_4883.jpeg 86KB
person1950_bacteria_4881.jpeg 85KB
person1950_bacteria_4881.jpeg 85KB
person1950_bacteria_4881.jpeg 85KB
person1947_bacteria_4876.jpeg 61KB
person1947_bacteria_4876.jpeg 61KB
person1947_bacteria_4876.jpeg 61KB
person1946_bacteria_4874.jpeg 60KB
person1946_bacteria_4874.jpeg 60KB
person1946_bacteria_4874.jpeg 60KB
person1946_bacteria_4875.jpeg 58KB
person1946_bacteria_4875.jpeg 58KB
person1946_bacteria_4875.jpeg 58KB
person1951_bacteria_4882.jpeg 48KB
person1951_bacteria_4882.jpeg 48KB
person1951_bacteria_4882.jpeg 48KB
model_info.json 4KB
LICENSE 1KB
LICENSE 1KB
EPO_src_Gzip_compressed .md 19KB
1_README.md 9KB
1_README.md 9KB
1_README.md 9KB
README.md 8KB
CODE_OF_CONDUCT.md 5KB
2_README.md 5KB
2_README.md 5KB
2_README.md 5KB
README_OLD.md 4KB
3_README.md 2KB
3_README.md 2KB
3_README.md 2KB
README.md 954B
README.md 954B
README.md 954B
SECURITY.md 682B
README.md 283B
README.md 165B
image_SUB_generator.pkl 947B
GUI_V0.8.9.4.png 1.27MB
GUI_V0.8.9.6.png 1.15MB
CLI_V0.8.9.3.png 907KB
共 200 条
- 1
- 2
资源评论
- 2301_778386482024-04-07这个资源值得下载,资源内容详细全面,与描述一致,受益匪浅。
Meta.Qing
- 粉丝: 2w+
- 资源: 121
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功