Upload folder using huggingface_hub
Browse files- README.md +47 -3
- config.json +9 -0
- model.onnx +3 -0
- preprocessor_config.json +20 -0
- pytorch_model.bin +3 -0
README.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- pytorch
|
6 |
+
- efficientnet
|
7 |
+
- image-classification
|
8 |
+
- rice-disease
|
9 |
+
datasets:
|
10 |
+
- Subh775/Rice-Disease-Augmented
|
11 |
+
metrics:
|
12 |
+
- accuracy
|
13 |
+
---
|
14 |
+
|
15 |
+
# EfficientNet-B3 for Rice Disease Classification
|
16 |
+
|
17 |
+
This model is fine-tuned on the Rice Disease Augmented dataset to classify different rice diseases.
|
18 |
+
|
19 |
+
## Classes
|
20 |
+
[0, 1, 2, 3]
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
26 |
+
import torch
|
27 |
+
from PIL import Image
|
28 |
+
|
29 |
+
# Load the model and feature extractor
|
30 |
+
model = AutoModelForImageClassification.from_pretrained("your-username/rice-disease-efficientnet-b3")
|
31 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained("your-username/rice-disease-efficientnet-b3")
|
32 |
+
|
33 |
+
# Load an image
|
34 |
+
image = Image.open("path/to/image.jpg")
|
35 |
+
|
36 |
+
# Preprocess the image
|
37 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
38 |
+
|
39 |
+
# Get predictions
|
40 |
+
with torch.no_grad():
|
41 |
+
logits = model(**inputs).logits
|
42 |
+
predicted_class_idx = logits.argmax(-1).item()
|
43 |
+
|
44 |
+
# Convert to class name
|
45 |
+
class_names = [0, 1, 2, 3]
|
46 |
+
print(f"Predicted class: {class_names[predicted_class_idx]}")
|
47 |
+
```
|
config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"EfficientNetForImageClassification"
|
4 |
+
],
|
5 |
+
"model_type": "efficientnet",
|
6 |
+
"num_labels": 4,
|
7 |
+
"id2label": {0: 0, 1: 1, 2: 2, 3: 3},
|
8 |
+
"label2id": {0: 0, 1: 1, 2: 2, 3: 3}
|
9 |
+
}
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:644b8995ebf35d5ea629092a7eededdd7e2c1f8571faacc7e931c132f8b88e7e
|
3 |
+
size 42774296
|
preprocessor_config.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_normalize": true,
|
3 |
+
"do_resize": true,
|
4 |
+
"image_processor_type": "EfficientNetImageProcessor",
|
5 |
+
"image_mean": [
|
6 |
+
0.485,
|
7 |
+
0.456,
|
8 |
+
0.406
|
9 |
+
],
|
10 |
+
"image_std": [
|
11 |
+
0.229,
|
12 |
+
0.224,
|
13 |
+
0.225
|
14 |
+
],
|
15 |
+
"resample": 2,
|
16 |
+
"size": {
|
17 |
+
"height": 300,
|
18 |
+
"width": 300
|
19 |
+
}
|
20 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:719d177c62a57aeb5058bb7ddc78f47acfa65de7284b0ea9df5ac69c00a4fd9c
|
3 |
+
size 129317606
|