Skip to content

This project focuses on using Convolutional Neural Networks (CNN) and Transfer Learning techniques to classify cell images as either infected with malaria or uninfected.

License

Notifications You must be signed in to change notification settings

vinaypattanashetti/CNN-Transfer-learning-malaria-cell-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Malaria Cell Classification using CNN and Transfer Learning:

Overview

This project aims to classify cell images as either infected with Malaria or uninfected using Convolutional Neural Networks (CNN) and Transfer Learning techniques. The project utilizes the dataset provided by the National Institutes of Health (NIH) comprising thousands of cell images.

Table of Contents

Dataset

The dataset used in this project can be downloaded from the official NIH dataset repository or Kaggle. It contains cell images categorized into two classes:

  • Malaria Cell Classification Kaggle Dataset
    • Parasitized: Cells infected with Malaria parasites.
    • Uninfected: Healthy cells without any infection.

    The dataset is split into training, validation, and testing sets.

    Requirements

    • Python 3.8+
    • TensorFlow 2.5+
    • Keras
    • NumPy
    • Matplotlib
    • Scikit-learn
    • Pandas

    Installation

    1. Clone this repository:
      git clone https://github.com/yourusername/Malaria-Cell-Classification.git
      cd Malaria-Cell-Classification
      
    2. Create and activate a virtual environment (optional but recommended):
      python3 -m venv venv
      source venv/bin/activate  # On Windows use `venv\Scripts\activate`
      
    3. Install the required packages:
      pip install -r requirements.txt
      

    Usage

    1. Prepare the data:
      python src/data_loader.py
      
    2. Train the model:
      python src/train.py
      
    3. Evaluate the model:
      python src/evaluate.py
      

    Model Architecture

    We utilize a CNN model architecture with Transfer Learning. The pre-trained models such as VGG16, ResNet50, or InceptionV3 from the ImageNet dataset are used as the base model, and additional custom layers are added for fine-tuning on the Malaria cell dataset.

    Training

    Training scripts and Jupyter notebooks are provided for step-by-step guidance on training the model. The key steps include:

    1. Data preprocessing and augmentation.
    2. Loading the pre-trained model.
    3. Adding custom layers for classification.
    4. Compiling the model with appropriate loss functions and optimizers.
    5. Training the model with the training dataset and validating it with the validation set.

    Evaluation

    The evaluation script and notebooks provide detailed analysis of the model's performance on the test dataset. Key metrics include:

    • Accuracy
    • Precision
    • Recall
    • F1-score

    Additionally, confusion matrices and ROC curves are plotted for a comprehensive evaluation.

    Results

    Model Architecture

    • Convolutional Neural Network (CNN): A custom CNN model was designed and trained from scratch for the classification of malaria-infected and uninfected cells.
    • Transfer Learning: Pre-trained models such as VGG16, ResNet50, and InceptionV3 were fine-tuned on the malaria cell dataset to leverage learned features from large-scale datasets.

    Performance Metrics

    • Accuracy: The accuracy achieved by the custom CNN model and transfer learning models were compared. Typically, transfer learning models outperformed the custom CNN in terms of accuracy due to their ability to generalize better with pre-learned features.
    • Precision, Recall, F1-Score: These metrics were used to evaluate the classification performance more comprehensively. Transfer learning models generally showed higher precision, recall, and F1-score.

    Training and Validation Loss

    • The custom CNN model showed higher training and validation loss compared to the transfer learning models, indicating potential overfitting or underfitting.
    • Transfer learning models had lower training and validation losses, suggesting better generalization.

    Confusion Matrix

    • The confusion matrix indicated that transfer learning models had fewer false positives and false negatives compared to the custom CNN model.

    Conclusion

    Effectiveness of Transfer Learning

    • Transfer learning significantly improved the performance of malaria cell classification. Pre-trained models like Mobilenet and VGG! achieved higher accuracy and better overall performance metrics compared to a custom CNN trained from scratch.

    Generalization

    • Transfer learning models demonstrated superior generalization abilities. They were more effective in correctly identifying both infected and uninfected cells, as evidenced by higher precision, recall, and F1-scores.

    Model Choice

    • Among the transfer learning models, ResNet50 and InceptionV3 were particularly effective, showing the highest accuracy and best performance in handling the classification task.

    Recommendations

    • For practical applications, transfer learning with models like Mobilenet or VGG19 is recommended for malaria cell classification due to their robust performance and ability to generalize well across different datasets.
    • Further improvements can be achieved by fine-tuning these models and possibly combining them with ensemble techniques to enhance classification performance.

    Acknowledgements

    • National Institutes of Health (NIH) for providing the dataset.
    • TensorFlow and Keras for the deep learning frameworks.

    References

    About

    This project focuses on using Convolutional Neural Networks (CNN) and Transfer Learning techniques to classify cell images as either infected with malaria or uninfected.

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published