CropDamageClf

CropDamageClf is a machine learning model designed to classify crop damage using images. This project is part of the “Eyes on the Ground” initiative, a collaboration between ACRE Africa, the Kenya Agricultural & Livestock Research Organization (KALRO), the International Food Policy Research Institute (IFPRI), and the Lacuna Fund, aimed at developing a Picture Based Insurance framework for smallholder farmers.

Table of Contents

  1. Overview
  2. Features
  3. Dataset
  4. Methodology
  5. Installation
  6. Usage
  7. Evaluation
  8. Compute Restrictions
  9. Technologies Used
  10. Contributing
  11. License
  12. Contact
  13. Acknowledgments

Overview

The CropDamageClf project aims to help farmers across Africa manage agricultural risk by using image data to settle insurance claims and carry out loss assessment. ACRE Africa reviews smartphone pictures of insured crops sent by farmers to verify crop damage and provide agricultural advisories. These advisories depend on whether a crop is damaged and the cause of that damage, such as weather, pests, diseases, or man-made factors.

Features

Dataset

The project uses a collection of smartphone images of crops categorized into the following damage types:

The dataset is divided into training (train directory) and test (test directory) sets. The training set includes labeled images, while the test set contains images without labels for evaluation.

Methodology

The project follows a structured approach to classify crop damage accurately:

  1. Data Ingestion: Collect and organize the images.
  2. Data Transformation: Preprocess the images, including resizing, normalization, and augmentation.
  3. Data Validation: Ensure the quality and consistency of the data.
  4. Model Training: Train the model using the preprocessed dataset.
  5. Model Evaluation: Evaluate the model using metrics like accuracy and Log Loss.

Installation

Follow these steps to set up the project on your local machine:

  1. Clone the Repository:
     git clone https://github.com/yash-raj202134/CropDamageClf.git
    
  2. Install Dependencies:
    • Create and activate a virtual environment:
        python -m venv cropdamageclf
        source cropdamageclf/bin/activate  # On Windows, use `cropdamageclf\Scripts\activate`
      
    • Install the required packages:
        pip install -r requirements.txt
      
  3. Prepare Data:
    • Ensure the dataset is available in the specified directory.
    • Follow the instructions in the project documentation to format and preprocess the dataset.

Usage

To use the CropDamageClf project, follow these steps:

  1. Run the Preprocessing Script:
     python preprocess_data.py
    
  2. Train the Model:
     python train_model.py
    
  3. Evaluate the Model:
     python evaluate_model.py
    
  4. Classify New Images:
     python classify_image.py --image_path path/to/image/file
    

Evaluation

The evaluation metric for this project is Log Loss. Your submission should look like:

ID DR G ND WD Other
ID_YMXCDK 0.73 0.19 0.01 0.67 0.92
ID_B3HJ3N 0.03 0.45 0.99 0.46 0.20

The values should be between 0 and 1. Do not set thresholds or round your probabilities to improve your place on the leaderboard. This ensures the client receives the best solution and can set thresholds according to their needs.

Compute Restrictions

The model should be lightweight and able to train and run inference within reasonable time constraints:

Technologies Used

Contributing

We welcome contributions from the community! If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch with your changes.
  3. Make a pull request to the main branch.

For major changes, please open an issue first to discuss what you would like to change.

License

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

Contact

Feel free to reach out with any questions or feedback:

Acknowledgments


Happy Coding!