The data is from Kaggle
There are two category in kaggle's data sets : Normal and Pneumonia
The data is split into a set of 3 folders : train, val and test
-
The train folder totally have 5216 jpg files (Normal:1341,PNEUMONIA:3875)
-
The val folder totally have 16 jpg files (Normal:8,PNEUMONIA:8)
-
The test folder totally have 624 jpg files (Normal:234,PNEUMONIA:390)
Remark! Data sets for Normal & Pneumonia are imbalanced (about 1:3)
ImageDataGenerator(
rotation_range=10,
width_shift_range=0.2,
height_shift_range=0.2,
rescale=1./255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest')
If you are not getting the app just like the below picture, then change the streamlit theme
Deployed this project on AWS
Here I used Xception
This is a generic code if you want you can use any other model. All you have to do is replace Xception with your desired model name and last_conv_layer_name with that model's last convolution layer
IMAGE_SIZE=[224,224]
base_model=Xception(input_shape=IMAGE_SIZE + [3],weights='imagenet',include_top=False)
last_conv_layer_name = "block14_sepconv2_act"
for layer in base_model.layers[:-8]:
layer.trainable=False
new_model = base_model.output
new_model = GlobalAveragePooling2D()(new_model)
new_model = Dense(2,activation='softmax')(new_model)
model=Model(base_model.input,new_model)
- batch size = 64
- optimizer = adam
- loss = categorical_cross_entropy
- epochs = 30
- steps per epoch = 32
Clone the project
git clone https://github.com/xx-CRAZINESS-xx/Pneumonia-Detection.git
Go to the project directory
cd Pneumonia-Detection
Install dependencies
pip install -r requirements.txt
Start the server
streamlit run app.py