Skip to content

U-net for plant images segmentation to detect the disease, and calculate the severity percentage.

License

Notifications You must be signed in to change notification settings

FouadHellal/U-net-for-plant-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

UNet Coffee Segmentation

This repository contains the code for training and evaluating a UNet model for coffee leaf rust segmentation. The model is trained using the COFFEE dataset and can be used to segment coffee leaf rust from images, and many other datasets.

Dataset Description

The COFFEE dataset is organized into three main directories: train, val, and test. Each directory contains subdirectories for images and masks. The images are in JPG format, and their corresponding masks are in PNG format. The masks are binary images where the regions of interest are represented as white (pixel value 255) and the background as black (pixel value 0). the dimensions used are 224*224px.

Usage

Prerequisites

  • Python 3.x
  • TensorFlow
  • scikit-image
  • matplotlib

Installation

  1. Clone the repository:

    git clone https://github.com/username/U-net-for-plant-segmentation.git
    
  2. Navigate to the repository directory:

    cd unet-coffee-segmentation
    
  3. Install Dependencies

    pip install -r requirements.txt
    

Training the Model

To train the UNet model, run the train.py script: python train.py

This script will load the COFFEE dataset, train the model, and save the trained model weights to a file named modelunetcoffee.h5. image

Evaluating the Model

To evaluate the trained model on the test dataset, run the evaluate.py script:

python evaluate.py

This script will load the trained model, evaluate its performance on the test dataset, and print the test loss and accuracy.

Examples of some masks :

Coffee dataset :

image

image

Plant village (tomato) dataset :

image

image

Making Predictions

To make predictions using the trained model, you can use the predict.py script:

python predict.py --image_path /path/to/image.jpg

Replace /path/to/image.jpg with the path to the image for which you want to generate a segmentation mask.

License

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

Feel free to reach out to me if you have any questions or suggestions!

About

U-net for plant images segmentation to detect the disease, and calculate the severity percentage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages