Skip to content

Repository files navigation

🌿 Crop Disease Classification in Uganda

📘 Project Overview

This project focuses on classifying crop diseases using images from Uganda. It applies advanced techniques in computer vision and deep learning to create a robust image classification model. The project is part of the AI curriculum from WorldQuant University, and it demonstrates how to build, optimize, and deploy convolutional neural networks (CNNs) using PyTorch.

By the end of this project, you will be able to:

  • Explore and preprocess image datasets.
  • Build CNNs to classify crop diseases.
  • Use transfer learning for improved performance.
  • Apply callbacks to optimize training.
  • Evaluate models using cross-validation.
  • Understand the socio-environmental impact of data use in AI.

🚀 Project Name

Crop Disease Classification in Uganda

📌 Description

This project builds and optimizes a convolutional neural network to classify crop disease images from Uganda into five categories using transfer learning and training optimization techniques.

🎯 Motivation / Problem Solved

In Uganda and many other developing regions, crop diseases significantly impact agricultural productivity and food security. Automating crop disease detection can help farmers take early action, reduce losses, and increase yields. This project addresses the problem using AI and machine learning.

✨ Features

  • Visualize and explore a real-world dataset
  • Build custom CNNs for multiclass classification
  • Apply transfer learning using pre-trained models (ResNet)
  • Implement advanced training callbacks
  • Evaluate performance using k-fold cross-validation
  • Raise awareness about AI’s environmental and ethical impact

🛠️ Tech Stack

  • Programming Language: Python
  • Deep Learning Framework: PyTorch
  • Tools & Libraries: torchvision, numpy, matplotlib, sklearn

📚 Lessons

🔧 Lesson 1: Fix My Code

Summary: Investigated common errors in PyTorch's nn.Sequential models.

Topics Covered:

  • Incorrect layer sizing
  • Layer duplication
  • Missing flattening step

New Terms:

  • Sequential Model: A model where layers flow one after another.
  • Flatten: Converts multi-dimensional input to a 1D vector.

🖼️ Lesson 2: Explore Datasets

Summary: Explored and analyzed crop disease image datasets.

Topics Covered:

  • Data normalization
  • Class balancing

New Terms:

  • Unbalanced classes: Unequal number of samples per class.
  • Undersampling: Reducing data in overrepresented classes to balance the dataset.

🧠 Lesson 3: Multiclass Classification

Summary: Built and trained a CNN to classify images into five categories.

Topics Covered:

  • Grayscale to RGB conversion
  • Image resizing and normalization
  • Model training and overfitting detection

New Terms:

  • Overfitting: When a model performs well on training data but poorly on unseen data.
  • Learning Curve: Graph showing model performance over training epochs.

🔄 Lesson 4: Transfer Learning

Summary: Used a pre-trained model (ResNet) for faster and more accurate classification.

Topics Covered:

  • Loading and altering pre-trained models
  • Training specific layers only
  • k-fold cross-validation

New Terms:

  • Pre-trained model: A model already trained on a large dataset.
  • Transfer learning: Reusing a model on a new but similar task.
  • k-fold Cross-validation: Splitting data into k parts to train and validate the model k times.

🛠️ Lesson 5: Callbacks

Summary: Implemented callbacks to control model behavior during training.

Topics Covered:

  • Early stopping
  • Checkpointing
  • Learning rate scheduling

New Terms:

  • Callback: Functions executed at specific stages of training.
  • Checkpointing: Saving the best model weights.
  • Early Stopping: Halting training when validation performance stops improving.

🌍 Lesson 6: Data Pollution & Power

Summary: Reviewed the socio-political and environmental implications of data usage in AI based on the white paper from the Sustainable AI Lab, University of Bonn.

Key Concepts:

  • Data Pollution: Harm caused by the production and storage of digital data.
  • Global Power Dynamics: Influence of governments and corporations on AI ethics.

Reference: Hasselbalch, G. (2022). Data Pollution & Power – White Paper for a Global Sustainable Agenda on AI, The Sustainable AI Lab, Bonn University.


⚖️ License

This project is licensed under the MIT License. See the LICENSE file for details.

🤝 Acknowledgments

This project is part of the AI curriculum provided by WorldQuant University.

📬 Contact

Stephen Kinuthia
📧 Email: kinuthiastephen94@gmail.com
🌐 GitHub: github.com/stephenkinuthia-cell

Feel free to connect for feedback, questions, or collaboration opportunities!

About

This project builds and optimizes a convolutional neural network to classify crop disease images from Uganda into five categories using transfer learning and training optimization techniques.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages