Cervical Cancer Detection Using Deep Learning
Cervical cancer is a significant health concern affecting women worldwide. Early detection is crucial for effective treatment and improved survival rates. This project aims to develop an automated system for cervical cancer detection using deep learning models. By leveraging convolutional neural networks (CNNs), we can classify cervical cell images into various categories, helping healthcare professionals make faster and more accurate diagnoses. The project involves using advanced models such as EfficientNet and basic CNNs to analyze the data, train the models, and evaluate their performance.
Explanation All Code
Step 1:
Mounting Google Drive
We mount Google Drive to access our dataset stored in the cloud.
Importing Libraries
We import essential libraries for data processing, model building, evaluation, and visualization.
Data collection and preparation:
We utilized the cervical cancer dataset for Deep learning classification. We collected a cervical cancer dataset consisting of 5000 images. After augmenting the images, the total dataset increased to 7000 images. Next, divide the dataset into 80% for training and 20% for validation.
Load Datasets
We set the paths for training and validation datasets stored in Google Drive.
Listing Categories
We list the categories (labels) in the training dataset directory.
Step 2:
Data Processing
We define a function to read and resize images, storing them with their respective labels. We also count the number of images per class.
We process the training data and print the total number of training samples.
Plotting Class Distributions
We plot the distribution of classes in the training dataset.
Processing Validation Data
We process the validation data and print the total number of validation samples.
Plotting Validation Data Distribution
We plot the distribution of classes in the validation dataset.
Step 3:
Preparing Data for Model
We convert image data and labels to numpy arrays and normalize the images.
Visualizing Random Training Images
We display random images from the training dataset for visualization.
Step 4:
Cervical Cancer Detection Using CNN, EfficientNetB0, and Sequential Model
- Basic CNN (Convolutional Neural Network): This model is designed to recognize patterns in images, making it a strong choice for image classification tasks like detecting cervical cancer cells.
- EfficientNetB0: This is a state-of-the-art model known for its efficiency and accuracy. It balances between performance and resource usage, making it ideal for complex image classification tasks.
- Sequential Model: This model allows for simple building and training of neural networks layer by layer, providing flexibility in designing a custom architecture for cervical cancer detection.
By using these models, my project aims to accurately classify cervical cancer from medical images, leveraging the strengths of each model to improve overall performance.
Building a Basic CNN Model
We define and compile a basic CNN model.
Training the Basic CNN Model
We train the model and save the best weights.
Plotting Training History
We plot the accuracy and loss curves of the model.
Evaluating the Model
We load the best model and evaluate it on the test data. There is the accuracy of 89.50%.
Plotting Confusion Matrix and Classification Report
Step 5:
Using EfficientNetB0
Building a EfficientNetB0
We define and compile a EfficientNetB0 model.
We train the model and save the best weights.
We save the EfficientNet model architecture and weights.
Plotting Training History
We plot the accuracy and loss curves of the model.
Evaluating the Model
We plot the confusion matrix and print the classification report.
Step 6:
Building a Sequential ModelWe define and compile a Sequential Model.
Training the Sequential Model
We train the model and save the best weights.
We plot the accuracy and loss curves of the model.
We load the best model and evaluate it on the test data. There is Sequential Model Accuracy: 91.29%
Plotting Confusion Matrix and Classification Report
We plot the confusion matrix and print the classification report.
Step 7:
Prediction
Conclusion
In conclusion, our project highlights the potential of deep learning in enhancing cervical cancer detection. By employing models like EfficientNet and basic CNN architectures, we achieved promising results in classifying cervical cell images. These automated systems can significantly support healthcare professionals in early diagnosis, leading to better patient outcomes. Future improvements could include expanding the dataset, refining the models, and developing a user-friendly application for clinical use, further bridging the gap between technology and healthcare.