File size: 2,129 Bytes
a773c0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96db011
 
 
3dba043
96db011
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a773c0b
 
 
 
 
 
 
 
96db011
 
 
 
 
a773c0b
cc1fad9
 
 
 
 
 
 
 
 
 
 
 
 
a773c0b
cc1fad9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
base_model: google/vit-base-patch16-224-in21k
tags:
- generated_from_trainer
datasets:
- beans
metrics:
- accuracy
model-index:
- name: vit-base-beans-demo-v5
  results:
  - task:
      name: Image Classification
      type: image-classification
    dataset:
      name: beans
      type: beans
      config: default
      split: validation
      args: default
    metrics:
    - name: Accuracy
      type: accuracy
      value: 1.0
---

# Fine-Tuned ViT for Beans Leaf Disease Classification

## Model Information
* **Model Name**: VIT_Beans_Leaf_Disease_Classifier
* **Base Model**: Google/ViT-base-patch16-224-in21k
* **Task**: Image Classification (Beans Leaf Disease Classification)
* **Dataset**: Beans leaf dataset with images of diseased and healthy leaves.

## Problem Statement
The goal of this model is to classify leaf images into three categories:
```
{
  "angular_leaf_spot": 0,
  "bean_rust": 1,
  "healthy": 2,
}
```

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6338c06c107c4835a05699f9/3qwVfVNQSt0KHe8t_OCrT.png)

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| 0.1495        | 1.54  | 100  | 0.0910          | 0.9774   |
| 0.0121        | 3.08  | 200  | 0.0155          | 1.0      |

## Framework versions
+ Transformers 4.33.2
+ Pytorch 2.0.1+cu118
+ Datasets 2.14.5
+ Tokenizers 0.13.3

## Get Started With The Model:
```
! pip -q  install datasets transformers[torch]
```

```python

from transformers import pipeline
from PIL import Image

# Use a pipeline as a high-level helper

pipe = pipeline("image-classification", model="ayoubkirouane/VIT_Beans_Leaf_Disease_Classifier")

# Load the image

image_path = "Your image_path "
image = Image.open(image_path)

# Run inference using the pipeline
result = pipe(image)

# The result contains the predicted label and the corresponding score
predicted_label = result[0]['label']
confidence_score = result[0]['score']

print(f"Predicted Label: {predicted_label}")
print(f"Confidence Score: {confidence_score}")
```