File size: 2,895 Bytes
3f5fa7c
16067a2
0794a52
3f5fa7c
 
0794a52
7bd8d37
3f5fa7c
16067a2
 
3f5fa7c
 
74b21f4
3f5fa7c
74b21f4
3f5fa7c
74b21f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
title: GrapeVineClassification
emoji: πŸ‡
colorFrom: red
colorTo: red
sdk: streamlit
app_file: src/streamlit_app.py
pinned: false
short_description: Custom CNN model for grapevine leaf disease classification.
license: mit
---

# πŸ‡ Grapevine Leaf Disease Classifier (CNN – No Transfer Learning)

This web app demonstrates a **Convolutional Neural Network (CNN) model trained from scratch (without Transfer Learning)** to classify grapevine leaf images into one of the following four disease categories:

- **Black Rot**
- **Esca (Black Measles)**
- **Leaf Blight (Isariopsis Leaf Spot)**
- **Healthy**

The model was developed using **TensorFlow/Keras** and deployed via **Streamlit**. It processes images and predicts the most likely disease with a probability score.

---

## πŸš€ How to Use

1. Upload a grapevine leaf image (`.jpg`, `.jpeg`, `.png`)
2. Click **"Predict Disease"**
3. The app will display:
   - ➀ Predicted disease class  
   - πŸ“Š Confidence score  
   - πŸ“ˆ Full probability distribution across all classes

---

## 🧠 Model Details

| **Attribute**       | **Value** |
|--------------------|-----------|
| Model Type         | CNN (no Transfer Learning) |
| Input Image Size   | 160 Γ— 160 pixels |
| Loss Function      | `categorical_crossentropy` |
| Optimizer          | Adam |
| Metrics            | Accuracy, Precision, Recall |
| Framework          | TensorFlow / Keras |
| Deployment         | Streamlit with Docker (HuggingFace Spaces) |
| Classes            | 4 total |

---

## πŸ“‚ File Structure

β”œβ”€β”€ src/
β”‚ └── app.py # Streamlit application
β”œβ”€β”€ cnn_model.keras # Final saved model
β”œβ”€β”€ grape_training_history.pkl# Training history
β”œβ”€β”€ README.md # Project documentation
└── requirements.txt # Python dependencies

yaml
Code kopieren

---

## πŸ› οΈ Technologies Used

- **Python**
- **TensorFlow / Keras**
- **NumPy, PIL**
- **Streamlit**
- **Docker (for deployment on HuggingFace)**

---

## πŸ“Š Example Output

Predicted Disease: Esca (Black Measles)
Confidence: 47.54%
Probability per Class:

Black Rot β†’ 17.49%

Esca (Black Measles) β†’ 47.54%

Leaf Blight β†’ 17.49%

Healthy β†’ 17.49%

yaml
Code kopieren

---

## πŸ‘€ Author

Developed by **Enes Yamac (EnYa32)**  
as part of a Deep Learning project involving custom CNNs and Transfer Learning architectures for agricultural image classification.

---

## πŸ“Œ License

This project is released under the **MIT License**.

---

## πŸ’‘ Notes

- This version uses a **pure CNN trained from scratch**, without any pre-trained ImageNet models.
- A second version using **Transfer Learning (ResNet50)** is available as a separate Space.

---

## πŸ”— Related Projects

πŸ”Ή *Upcoming*: **Grapevine Disease Classifier – Transfer Learning (ResNet50)**

---

✨ *Thank you for visiting this Space!*  
Feel free to test the app and provide feedback.