File size: 2,851 Bytes
f4af316
 
 
 
 
 
 
 
 
d751972
 
 
 
 
 
 
 
 
 
 
af31ce0
 
 
 
 
 
 
 
 
 
 
 
d751972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39a7cae
d751972
 
 
 
9b5ad59
d751972
 
 
 
39a7cae
d751972
 
 
60ac5e1
d751972
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
tags:
- image-classification
metrics:
- accuracy
license: mit
---


# Grapevine Disease Classification Model

## Overview

This model is designed to classify grapevine leaves as either "healthy" or affected by [Esca](https://ipm.ucanr.edu/agriculture/grape/esca-black-measles/#gsc.tab=0) disease. For this model, healthy is defined as not having signs of Esca, meaning signs of blight, rot, and other infections will be classified as healthy/non-Esca. Esca is a serious fungal disease that affects grapevines, causing significant damage to vineyards. Early detection of Esca can help in managing and controlling its spread, ensuring healthier vineyards and better grape yields.

## Model Details

- **Model Architecture**: Convolutional Neural Network (CNN)
- **Input**: Images of grape leaves
- **Output**: Binary classification indicating whether the leaf is healthy or affected by Esca
- **focal_loss function**: 
```
def focal_loss(gamma=2., alpha=0.25):
    def focal_loss_fixed(y_true, y_pred):
        y_true = tf.cast(y_true, tf.float32)
        y_pred = tf.clip_by_value(y_pred, tf.keras.backend.epsilon(), 1 - tf.keras.backend.epsilon())
        alpha_t = y_true * alpha + (tf.ones_like(y_true) - y_true) * (1 - alpha)
        p_t = y_true * y_pred + (tf.ones_like(y_true) - y_true) * (tf.ones_like(y_true) - y_pred)
        focal_loss_value = -alpha_t * tf.math.pow((tf.ones_like(y_true) - p_t), gamma) * tf.math.log(p_t)
        return tf.reduce_mean(focal_loss_value)
    return focal_loss_fixed
```

## Dataset

The model was trained on a dataset of grapevine leaves collected from various vineyards. The dataset includes:

- **Healthy Leaves**: Images of grapevine leaves that are not affected by Esca disease but may contain other diseases.
- **Esca-Affected Leaves**: Images of grapevine leaves showing symptoms of Esca disease, such as discoloration, brown spots, and unusual texture.

### Data Source

The dataset used to train this model is sourced from the [Grapevine Disease Dataset](https://www.kaggle.com/datasets/rm1000/grape-disease-dataset-original?resource=download) available under the CC0 Public Domain Dedication.

## Model Performance

### Evaluation Metrics

The model was evaluated using standard classification metrics, including precision, recall, and F1-score, for both classes (healthy and Esca-affected).

### Performance

          precision    recall  f1-score   support

    esca       0.79      0.97      0.87       480
    healthy    0.99      0.90      0.94      1325



- Accuracy: 0.92
- Image AUC: 0.989

### License

The data used to train this model is licensed under the CC0 Public Domain Dedication. The model itself is licensed under the MIT License.

### Acknowledgements

Special thanks to the contributors of the Grapevine Disease Dataset for providing the data used in training this model.