Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,99 +1,19 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
-
## Requirements
|
| 13 |
-
|
| 14 |
-
- Python 3.7.x
|
| 15 |
-
- Tensorflow 2.4.1+
|
| 16 |
-
- Keras 2.4.3+
|
| 17 |
-
- scikit-learn 0.24.1+
|
| 18 |
-
- matplotlib 3.3.3+
|
| 19 |
-
- texttable 1.6.3+
|
| 20 |
-
- gradio 1.5.3+
|
| 21 |
-
|
| 22 |
-
## Dataset
|
| 23 |
-
|
| 24 |
-
You can download the dataset from [kaggle](https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia/). Use the underlying download link to download the dataset.
|
| 25 |
-
|
| 26 |
-
### Instructions to follow
|
| 27 |
-
|
| 28 |
-
* Extract the archive
|
| 29 |
-
* You will find several directories in it
|
| 30 |
-
* Copy the `chest-xray` directory contents (`train`, `test` and `val` subdirectories) to the `data` folder
|
| 31 |
-
|
| 32 |
-
The number of images belonging to both classes (`Normal` and `Pneumonia`) in the `train`, `test` and `val` datasets are -
|
| 33 |
-
|
| 34 |
-
<img width="326" alt="Screenshot 2021-02-07 at 16 40 00" src="https://user-images.githubusercontent.com/76659596/107151515-4083f280-6963-11eb-84c7-f2a23cc24134.png">
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
## Installation
|
| 38 |
-
|
| 39 |
-
* Clone the repository
|
| 40 |
-
|
| 41 |
-
`git clone https://github.com/baishalidutta/Pneumonia-Detection.git`
|
| 42 |
-
|
| 43 |
-
* Install the required libraries
|
| 44 |
-
|
| 45 |
-
`pip3 install -r requirements.txt`
|
| 46 |
-
|
| 47 |
-
## Usage
|
| 48 |
-
|
| 49 |
-
Enter into the `source` directory to execute the following source codes.
|
| 50 |
-
|
| 51 |
-
* To generate the model on your own, run
|
| 52 |
-
|
| 53 |
-
`python3 cnn_training_model.py`
|
| 54 |
-
|
| 55 |
-
* To evaluate any dataset using the pre-trained model (in the `model` directory), run
|
| 56 |
-
|
| 57 |
-
`python3 cnn_model_evaluation.py`
|
| 58 |
-
|
| 59 |
-
Note that, for evaluation, `cnn_model_evaluation.py` will use all the images contained inside both `test` and `val` subdirectories (inside `data` directory).
|
| 60 |
-
|
| 61 |
-
Alternatively, you can find the whole analysis in the notebook inside the `notebook` directory. To open the notebook, use either `jupyter notebook` or `google colab` or any other IDE that supports notebook feature such as `PyCharm Professional`.
|
| 62 |
-
|
| 63 |
-
## Evaluation
|
| 64 |
-
|
| 65 |
-
Our model is trained with 96% accuracy on the training dataset. The model's accuracy on the `test` and `val` datasets are 91% and 88% respectively. In both cases, the `f1-score` and `ROC_AUC Score` are relatively high, as shown below.
|
| 66 |
-
|
| 67 |
-
### On Test Dataset (624 images, 234 `Normal` and 390 `Pneumonia`)
|
| 68 |
-
|
| 69 |
-
<p align="center">
|
| 70 |
-
<img width="960" alt="Screenshot 2021-02-07 at 17 07 23" src="https://user-images.githubusercontent.com/76659596/107152321-93f83f80-6967-11eb-95b4-0bfb3ccae6d7.png">
|
| 71 |
-
</p>
|
| 72 |
-
|
| 73 |
-
### On Validation Dataset (16 images, 8 `Normal` and 8 `Pneumonia`)
|
| 74 |
-
|
| 75 |
-
<p align="center">
|
| 76 |
-
<img width="960" alt="Screenshot 2021-02-07 at 17 10 07" src="https://user-images.githubusercontent.com/76659596/107152360-ba1ddf80-6967-11eb-90cb-dfaeca31f275.png">
|
| 77 |
-
</p>
|
| 78 |
-
|
| 79 |
-
## Web Application
|
| 80 |
-
|
| 81 |
-
To run the web application locally, go to the `webapp` directory and execute:
|
| 82 |
-
|
| 83 |
-
`python3 web_app.py`
|
| 84 |
-
|
| 85 |
-
This will start a local server that you can access in your browser. You can either upload/drag a new X-ray image or select any test X-ray images from the examples below.
|
| 86 |
-
|
| 87 |
-
You can, alternatively, try out the hosted web application [here](https://gradio.app/g/baishalidutta/Pneumonia-Detection).
|
| 88 |
-
|
| 89 |
-
## Developer
|
| 90 |
-
|
| 91 |
-
Baishali Dutta (<a href='mailto:[email protected]'>[email protected]</a>)
|
| 92 |
-
|
| 93 |
-
## Contribution [](https://github.com/baishalidutta/Pneumonia-Detection/issues)
|
| 94 |
-
|
| 95 |
-
If you would like to contribute and improve the model further, check out the [Contribution Guide](https://github.com/baishalidutta/Pneumonia-Detection/blob/main/CONTRIBUTING.md)
|
| 96 |
-
|
| 97 |
-
## License [](https://www.apache.org/licenses/LICENSE-2.0)
|
| 98 |
-
|
| 99 |
-
This project is licensed under Apache License Version 2.0
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: {{title}}
|
| 3 |
+
emoji: {{emoji}}
|
| 4 |
+
colorFrom: {{colorFrom}}
|
| 5 |
+
colorTo: {{colorTo}}
|
| 6 |
+
sdk: {{sdk}}
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
|
| 11 |
+
# Configuration
|
| 12 |
|
| 13 |
+
`title`: Pneumonia Detection
|
| 14 |
|
| 15 |
+
`sdk`: gradio
|
| 16 |
|
| 17 |
+
`app_file`: app.py
|
| 18 |
|
| 19 |
+
`pinned`: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|