Detection of Lung Infection

DESCRIPTION :


•Artificial Intelligence has evolved a lot and is currently able to solve problems that are very complex and require human specialization.
•One such area is healthcare. A lot of research happens every day to use deep learning for the betterment of humanity, and one such is healthcare.


Objective:


•To build a model using a convolutional neural network that can classify lung infection in a person using medical imagery.


Dataset Description:


•The dataset contains three different classes, including healthy, type 1 disease, and type 2 disease.


Following operations should be performed during model development:


•Import the necessary libraries like Keras and Tensorflow
•Plot the sample images for all the classes



•Build a data augmentation for train data to create new data with translation, rescale and flip, and rotation transformations. Rescale the image at 48x48.
•Build a data augmentation for test data to create new data and rescale the image at 48x48.
•Read images directly from the train folder and test folder using the appropriate function.
•Sequential model accuracy is 93% and F1 score for healthy dataset is 92%, Type 1 disease is 96% and Type 2 disease is 93%.


Training and Validation Accuracy and Loss


Confusion Matrix


Sequential Model Output:


Sequential Output


•Transfer learning using DenseNet121 model:


•Prepare data for the pre-trained mobile net model, with color mode as RGB
•Create an instance of a mobile net pre-trained model
•Add dense layer, dropout layer, batch normalization layer on the pre-trained model
•Create a final output layer with a SoftMax activation function
•Change the batch size activation function and optimize as rmsprop and observe if the accuracy increases
•Take the loss function as categorical cross-entropy
•Use early stopping with the patience of two epoch and call back function for preventing overfitting
•Try with ten numbers epoch
•Train the model using a generator and test the accuracy of the test data at every epoch
•DenseNet121 accuracy is 81% and F1 score for healthy dataset is 67%, Type 1 disease is 96% and Type 2 disease is 75%.


Training and Validation Accuracy


Training and Validation Loss


Confusion Matrix


DenseNet121 Model Output:


DenseNet121 Output


•Transfer Learning using Mobile Net:


•Prepare the dataset for the transfer learning algorithm using Densenet121 with the image size as 224x224x3
•Freeze the top layers of the pre-trained model
•Add a dense layer at the end of the pre-trained model followed by a dropout layer and try various combinations to get an accuracy
•Add the final output layer with a SoftMax activation function
•Take loss function as categorical cross-entropy
•Take Adam as an optimizer
•Use early stopping to prevent overfitting
•Try with 15 number of epoch and batch size with seven, also try various values to see the impact on results
•Train the model using the generator and test the accuracy of the test data at every epoch
•Mobile Net model accuracy is 89% and F1 score is healthy dataset is 86%, Type 1 disease is 96% and Type 2 disease is 84%.


Training and Validation Accuracy


Training and Validation Loss


Confusion Matrix


Mobile Net Model Output:


Mobile Net Output


•Compare to all three model Sequential model accuracy was better.



Get in Touch

Logo 1 Logo 2 Logo 3