raysarocha commited on
Commit
3020d23
·
verified ·
1 Parent(s): 8be4db0

Upload plant disease recognition model

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +84 -0
  3. config.json +90 -0
  4. model.keras +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.keras filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - plants
4
+ - plant-disease
5
+ - image-classification
6
+ - tensorflow
7
+ - keras
8
+ - resnet50
9
+ license: apache-2.0
10
+ pipeline_tag: image-classification
11
+ ---
12
+
13
+ # plant-resnet50-38classes
14
+
15
+ Modelo keras (tensorflow) para reconhecimento de plantas e doenças (38 classes).
16
+
17
+ ## 📋 Classes suportadas
18
+
19
+ O modelo identifica as seguintes plantas e condições:
20
+
21
+ - **Maçã**: sarna, podridão negra, ferrugem do cedro, saudável
22
+ - **Mirtilo**: saudável
23
+ - **Cereja**: oídio, saudável
24
+ - **Milho**: mancha de cercospora, ferrugem comum, queima das folhas, saudável
25
+ - **Uva**: podridão negra, esca, queima das folhas, saudável
26
+ - **Laranja**: citrus greening
27
+ - **Pêssego**: mancha bacteriana, saudável
28
+ - **Pimentão**: mancha bacteriana, saudável
29
+ - **Batata**: requeima precoce, requeima tardia, saudável
30
+ - **Framboesa**: saudável
31
+ - **Soja**: saudável
32
+ - **Abóbora**: oídio
33
+ - **Morango**: queima das folhas, saudável
34
+ - **Tomate**: 10 condições diferentes
35
+
36
+ Total: 38 classes
37
+
38
+ ## 🚀 Uso rápido
39
+
40
+ ```python
41
+ import json
42
+ import numpy as np
43
+ from huggingface_hub import hf_hub_download
44
+ import tensorflow as tf
45
+ from PIL import Image
46
+
47
+ # Baixa modelo e configuração
48
+ repo_id = "raysarocha/plant-resnet50-38classes"
49
+ cfg_path = hf_hub_download(repo_id, "config.json")
50
+ model_path = hf_hub_download(repo_id, "model.keras")
51
+
52
+ # Carrega configuração e modelo
53
+ with open(cfg_path, "r") as f:
54
+ cfg = json.load(f)
55
+
56
+ model = tf.keras.models.load_model(model_path)
57
+
58
+ # Processa imagem
59
+ img = Image.open("sua_imagem.jpg").convert("RGB")
60
+ img = img.resize((cfg["image_size"], cfg["image_size"]))
61
+ arr = np.array(img).astype("float32") * cfg["rescale"]
62
+ arr = np.expand_dims(arr, axis=0)
63
+
64
+ # Predição
65
+ predictions = model(arr)
66
+ probs = tf.nn.softmax(predictions[0]).numpy()
67
+ pred_idx = int(np.argmax(probs))
68
+ confidence = float(probs[pred_idx])
69
+
70
+ print(f"Classe: {cfg['id2label'][str(pred_idx)]}")
71
+ print(f"Confiança: {confidence:.2%}")
72
+ ```
73
+
74
+ ## 📊 Informações do modelo
75
+
76
+ - **Arquitetura**: resnet50
77
+ - **Framework**: tensorflow/keras
78
+ - **Entrada**: 224x224 pixels
79
+ - **Normalização**: pixels / 255.0
80
+ - **Classes**: 38
81
+
82
+ ## 📝 Licença
83
+
84
+ Apache 2.0
config.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "tf-keras",
3
+ "image_size": 224,
4
+ "id2label": {
5
+ "0": "Apple___Apple_scab",
6
+ "1": "Apple___Black_rot",
7
+ "2": "Apple___Cedar_apple_rust",
8
+ "3": "Apple___healthy",
9
+ "4": "Blueberry___healthy",
10
+ "5": "Cherry_(including_sour)___Powdery_mildew",
11
+ "6": "Cherry_(including_sour)___healthy",
12
+ "7": "Corn_(maize)___Cercospora_leaf_spot Gray_leaf_spot",
13
+ "8": "Corn_(maize)___Common_rust_",
14
+ "9": "Corn_(maize)___Northern_Leaf_Blight",
15
+ "10": "Corn_(maize)___healthy",
16
+ "11": "Grape___Black_rot",
17
+ "12": "Grape___Esca_(Black_Measles)",
18
+ "13": "Grape___Leaf_blight_(Isariopsis_Leaf_Spot)",
19
+ "14": "Grape___healthy",
20
+ "15": "Orange___Haunglongbing_(Citrus_greening)",
21
+ "16": "Peach___Bacterial_spot",
22
+ "17": "Peach___healthy",
23
+ "18": "Pepper,_bell___Bacterial_spot",
24
+ "19": "Pepper,_bell___healthy",
25
+ "20": "Potato___Early_blight",
26
+ "21": "Potato___Late_blight",
27
+ "22": "Potato___healthy",
28
+ "23": "Raspberry___healthy",
29
+ "24": "Soybean___healthy",
30
+ "25": "Squash___Powdery_mildew",
31
+ "26": "Strawberry___Leaf_scorch",
32
+ "27": "Strawberry___healthy",
33
+ "28": "Tomato___Bacterial_spot",
34
+ "29": "Tomato___Early_blight",
35
+ "30": "Tomato___Late_blight",
36
+ "31": "Tomato___Leaf_Mold",
37
+ "32": "Tomato___Septoria_leaf_spot",
38
+ "33": "Tomato___Spider_mites Two-spotted_spider_mite",
39
+ "34": "Tomato___Target_Spot",
40
+ "35": "Tomato___Tomato_Yellow_Leaf_Curl_Virus",
41
+ "36": "Tomato___Tomato_mosaic_virus",
42
+ "37": "Tomato___healthy"
43
+ },
44
+ "label2id": {
45
+ "Apple___Apple_scab": 0,
46
+ "Apple___Black_rot": 1,
47
+ "Apple___Cedar_apple_rust": 2,
48
+ "Apple___healthy": 3,
49
+ "Blueberry___healthy": 4,
50
+ "Cherry_(including_sour)___Powdery_mildew": 5,
51
+ "Cherry_(including_sour)___healthy": 6,
52
+ "Corn_(maize)___Cercospora_leaf_spot Gray_leaf_spot": 7,
53
+ "Corn_(maize)___Common_rust_": 8,
54
+ "Corn_(maize)___Northern_Leaf_Blight": 9,
55
+ "Corn_(maize)___healthy": 10,
56
+ "Grape___Black_rot": 11,
57
+ "Grape___Esca_(Black_Measles)": 12,
58
+ "Grape___Leaf_blight_(Isariopsis_Leaf_Spot)": 13,
59
+ "Grape___healthy": 14,
60
+ "Orange___Haunglongbing_(Citrus_greening)": 15,
61
+ "Peach___Bacterial_spot": 16,
62
+ "Peach___healthy": 17,
63
+ "Pepper,_bell___Bacterial_spot": 18,
64
+ "Pepper,_bell___healthy": 19,
65
+ "Potato___Early_blight": 20,
66
+ "Potato___Late_blight": 21,
67
+ "Potato___healthy": 22,
68
+ "Raspberry___healthy": 23,
69
+ "Soybean___healthy": 24,
70
+ "Squash___Powdery_mildew": 25,
71
+ "Strawberry___Leaf_scorch": 26,
72
+ "Strawberry___healthy": 27,
73
+ "Tomato___Bacterial_spot": 28,
74
+ "Tomato___Early_blight": 29,
75
+ "Tomato___Late_blight": 30,
76
+ "Tomato___Leaf_Mold": 31,
77
+ "Tomato___Septoria_leaf_spot": 32,
78
+ "Tomato___Spider_mites Two-spotted_spider_mite": 33,
79
+ "Tomato___Target_Spot": 34,
80
+ "Tomato___Tomato_Yellow_Leaf_Curl_Virus": 35,
81
+ "Tomato___Tomato_mosaic_virus": 36,
82
+ "Tomato___healthy": 37
83
+ },
84
+ "rescale": 0.00392156862745098,
85
+ "mean": null,
86
+ "std": null,
87
+ "num_classes": 38,
88
+ "architecture": "ResNet50",
89
+ "task": "image-classification"
90
+ }
model.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62c2303b88ea942e3511bfcc9cc2e3e80bf90b3bc91812f60b7a42379397d77a
3
+ size 109397043