Blood Cell Classification Using Deep Learning
Blood cell classification plays a vital role in diagnosing various medical conditions and diseases. This project focuses on developing a robust and efficient deep learning model to automate the classification of blood cells into distinct categories. Using a comprehensive dataset of blood cell images, we preprocess these images to ensure they are suitable for training. We then construct a convolutional neural network (CNN) using the powerful Keras and TensorFlow libraries. The primary goal of this project is to assist medical professionals by automating the blood cell classification process, thereby reducing the time and effort required for manual classification and increasing diagnostic accuracy. This project demonstrates the potential of AI in enhancing medical diagnostics, making the process more efficient and reliable.
Explanation All Code
STEP 1:
You can mount your Google Drive in a Google Colab notebook with this piece of code. This creates it simple to see files saved in Google Drive in the Colab setting so that data can be changed, analyzed, and models can be trained.
Importing Libraries
We import essential libraries for data processing, model building, evaluation, and visualization.
Data collection and preparation:
We utilized the Blood Cell Dataset for Deep Learning Classification. We collected a blood cell dataset consisting of 1800 images. After augmenting the images, the total dataset increased to 3000 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
Processing Training Data
Plotting Class Distributions
Processing Validation Data
Plotting Validation Data Distribution
Step 3:
Preparing Data for Model
Visualizing Random Training Images
Step 4:
Blood Cell Classification Using CNN, EfficientNetB4 and Vgg16 Model
- CNN (Convolutional Neural Network): This model is designed to recognize patterns in images, making it a strong choice for image classification tasks like detecting skin cancer.
- EfficientNetB4: This advanced model is known for its efficiency and accuracy. It balances performance and resource usage, making it ideal for complex image classification tasks.
- VGG16: This model is renowned for its simplicity and depth. It uses 16 layers to extract features from images, making it highly effective for detailed image analysis needed in skin cancer detection.
By using these models, my project aims to accurately detect skin cancer from medical images, leveraging the strengths of each model to improve overall performance.
Building a Basic CNN Model
Training the Basic CNN Model
Plotting Training History
Evaluating Model Performance
Evaluating the Model
Plotting Confusion Matrix and Classification Report
Step 5:
Efficientnet_b4
Training the EfficientNetB4
Plotting Training History
Evaluating Model Performance
Evaluating the Model
We load the best model and evaluate it on the test data. There is the EfficientNetB4 Accuracy of 99.83%.
Saving the EfficientNet Model
Plotting Confusion Matrix and Classification Report
Step 6:
Building a Vgg16 model
We define and compile a vgg16 model.
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 vgg16 Accuracy of 93.17%.
Plotting Confusion Matrix and Classification Report
Step 6:
Prediction
Load the Model efficientnet_b4