Commit
·
c8d07c4
1
Parent(s):
0c0d157
first commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .DS_Store +0 -0
- .ipynb_checkpoints/advance-cls-checkpoint.ipynb +0 -0
- .ipynb_checkpoints/leaf-classification-checkpoint.ipynb +466 -0
- Daun-Jambu.jpg +0 -0
- Daun-pepaya.jpg +0 -0
- README.dataset.txt +6 -0
- Tanaman-Herbal-7/.DS_Store +0 -0
- Tanaman-Herbal-7/README.dataset.txt +6 -0
- Tanaman-Herbal-7/README.roboflow.txt +32 -0
- Tanaman-Herbal-7/test/.DS_Store +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-40-_JPG.rf.890d30f6312fe18807604e5bbdb474b3.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-51-_JPG.rf.37c0dde6ed6a238a113293684bb43dbe.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-52-_JPG.rf.0e44f9579c04084ff438a3cd9452afe6.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-56-_JPG.rf.7ecb516f02561188bab405ea9d87520f.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-65-_JPG.rf.32c27b94c92f8b30cd34a1cf82f9f511.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-72-_JPG.rf.a6566a4d9e9f3465a58a0edc3d79dc68.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-73-_JPG.rf.1d77e1257780c86a70e4d2a6220143fe.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_112_jpg.rf.b1b752a79a987962de475df07684ec6a.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_118_jpg.rf.84bc7e31fef02e802b9d53690fd6502b.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_11_jpg.rf.823d0bbb3ff59c79848046cda38d2fa4.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_120_jpg.rf.e77498f952d4ba3d9dbe3c00229d1c0d.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_127_jpg.rf.8065f17aebce68b40f2f009ed769ddb2.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_128_jpg.rf.ee18b4e93a0338ecebf3d943c640b9e8.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_131_jpg.rf.ca9969ee6b8e3c64419824137ac7c5b3.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_144_jpg.rf.6c896330bd803e8079e07b0fa9429836.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_161_jpg.rf.79136eed7a59efd4bac39efff0251d75.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_172_jpg.rf.3d8f1b53cb1b6c0c1c7b78f78e4658b2.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_182_jpg.rf.1efcdb93711e3ab28c38d6bc8329c45d.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_186_jpg.rf.2ecec441662ec9254300480a3a514369.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_205_jpg.rf.26d79df311aae33de30af126af4c0f56.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_39_jpg.rf.9355537742475676281ed4be11c91954.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_44_jpg.rf.71ce9736ee51b63e1aeb043c2d15b4ba.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_55_jpg.rf.6caa4fb1b9c6a21f4093255b97b13e53.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_68_jpg.rf.959f9e683e0d9dad3674a6e2b87ed8e1.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_80_jpg.rf.5fcda6435eb8dfb3026b894e930eae80.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_84_jpg.rf.2565c9fb51ffaf6ce553d9dc2b6bdbff.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_87_jpg.rf.158f7c863c58f9156e524eeaa0eb59f1.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_89_jpg.rf.9340ff3858b2515aa5d4c09887bb114d.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/24_jpg.rf.b823ae03e9dd8c431dfda30ffb221a9c.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/40_jpg.rf.5b493c0f115680c83f8b5c94f6062136.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/41_jpg.rf.41fcb1ce62909267d986d8f6f7b5b4bd.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/47_jpg.rf.405eef61e4597158e8856028001b6ea6.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/4_jpg.rf.fbf7fab4778aa168d6ffca9acc2b3e86.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/75_jpg.rf.1eddbbf1f7771ed1511b392bcc54a7be.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/82_jpg.rf.6a16762306eabd5e370bf1445d998953.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/83_jpg.rf.57ab85cd0f71cd0f4f229949d243e1a6.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kumis Kucing/99_jpg.rf.780140f98428b5cddc447c5f6c96e998.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kunyit/kunyit-60-_JPG.rf.09cf6e6cf841e2382649354d3304c028.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kunyit/kunyit-66-_JPG.rf.61acd6ecad84fd95876c12909377dee4.jpg +0 -0
- Tanaman-Herbal-7/test/Daun Kunyit/kunyit-85-_JPG.rf.9095aeb6d3e42019da34111508abb852.jpg +0 -0
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
.ipynb_checkpoints/advance-cls-checkpoint.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.ipynb_checkpoints/leaf-classification-checkpoint.ipynb
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 2,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"# import libraries\n",
|
| 10 |
+
"import tensorflow as tf\n",
|
| 11 |
+
"from tensorflow.keras import layers, models\n",
|
| 12 |
+
"from matplotlib import pyplot as plt\n",
|
| 13 |
+
"from tensorflow.keras.preprocessing.image import ImageDataGenerator"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"execution_count": 18,
|
| 19 |
+
"metadata": {},
|
| 20 |
+
"outputs": [
|
| 21 |
+
{
|
| 22 |
+
"name": "stdout",
|
| 23 |
+
"output_type": "stream",
|
| 24 |
+
"text": [
|
| 25 |
+
"Found 1674 images belonging to 8 classes.\n",
|
| 26 |
+
"Found 157 images belonging to 8 classes.\n",
|
| 27 |
+
"Found 79 images belonging to 8 classes.\n"
|
| 28 |
+
]
|
| 29 |
+
}
|
| 30 |
+
],
|
| 31 |
+
"source": [
|
| 32 |
+
"TRAIN_DIR = 'dataset/train'\n",
|
| 33 |
+
"TEST_DIR = 'dataset/test'\n",
|
| 34 |
+
"VAL_DIR = 'dataset/val'\n",
|
| 35 |
+
"# Load dataset\n",
|
| 36 |
+
"datagen = ImageDataGenerator(rescale=1./255)\n",
|
| 37 |
+
"# Load data dari direktori menggunakan flow_from_directory\n",
|
| 38 |
+
"train_generator = datagen.flow_from_directory(\n",
|
| 39 |
+
" TRAIN_DIR,\n",
|
| 40 |
+
" target_size=(224, 224), # Sesuaikan dengan ukuran gambar input model\n",
|
| 41 |
+
" batch_size=32,\n",
|
| 42 |
+
" class_mode='categorical'\n",
|
| 43 |
+
")\n",
|
| 44 |
+
"\n",
|
| 45 |
+
"val_generator = datagen.flow_from_directory(\n",
|
| 46 |
+
" VAL_DIR,\n",
|
| 47 |
+
" target_size=(224, 224),\n",
|
| 48 |
+
" batch_size=32,\n",
|
| 49 |
+
" class_mode='categorical'\n",
|
| 50 |
+
")\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"test_generator = datagen.flow_from_directory(\n",
|
| 53 |
+
" TEST_DIR,\n",
|
| 54 |
+
" target_size=(224, 224),\n",
|
| 55 |
+
" batch_size=32,\n",
|
| 56 |
+
" class_mode='categorical',\n",
|
| 57 |
+
" shuffle=False # Untuk testing, tidak perlu shuffle\n",
|
| 58 |
+
")"
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"cell_type": "code",
|
| 63 |
+
"execution_count": 21,
|
| 64 |
+
"metadata": {},
|
| 65 |
+
"outputs": [
|
| 66 |
+
{
|
| 67 |
+
"data": {
|
| 68 |
+
"text/plain": [
|
| 69 |
+
"{'Daun Jambu Biji': 0,\n",
|
| 70 |
+
" 'Daun Kemangi': 1,\n",
|
| 71 |
+
" 'Daun Kunyit': 2,\n",
|
| 72 |
+
" 'Daun Mint': 3,\n",
|
| 73 |
+
" 'Daun Pepaya': 4,\n",
|
| 74 |
+
" 'Daun Sirih': 5,\n",
|
| 75 |
+
" 'Daun Sirsak': 6,\n",
|
| 76 |
+
" 'Lidah Buaya': 7}"
|
| 77 |
+
]
|
| 78 |
+
},
|
| 79 |
+
"execution_count": 21,
|
| 80 |
+
"metadata": {},
|
| 81 |
+
"output_type": "execute_result"
|
| 82 |
+
}
|
| 83 |
+
],
|
| 84 |
+
"source": [
|
| 85 |
+
"train_generator.class_indices"
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"cell_type": "code",
|
| 90 |
+
"execution_count": 26,
|
| 91 |
+
"metadata": {},
|
| 92 |
+
"outputs": [],
|
| 93 |
+
"source": [
|
| 94 |
+
"model = models.Sequential()\n",
|
| 95 |
+
"\n",
|
| 96 |
+
"model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(224, 224, 3)))\n",
|
| 97 |
+
"model.add(layers.MaxPooling2D((2, 2)))\n",
|
| 98 |
+
"model.add(layers.Conv2D(64, (3, 3), activation='relu'))\n",
|
| 99 |
+
"model.add(layers.MaxPooling2D((2, 2)))\n",
|
| 100 |
+
"model.add(layers.Conv2D(128, (3, 3), activation='relu'))\n",
|
| 101 |
+
"model.add(layers.MaxPooling2D((2, 2)))\n",
|
| 102 |
+
"model.add(layers.Conv2D(128, (3, 3), activation='relu'))\n",
|
| 103 |
+
"model.add(layers.MaxPooling2D((2, 2)))\n",
|
| 104 |
+
"\n",
|
| 105 |
+
"model.add(layers.Flatten())\n",
|
| 106 |
+
"model.add(layers.Dense(512, activation='relu'))\n",
|
| 107 |
+
"model.add(layers.Dense(8, activation='softmax'))\n",
|
| 108 |
+
"\n",
|
| 109 |
+
"model.compile(optimizer='adam',\n",
|
| 110 |
+
" loss='categorical_crossentropy',\n",
|
| 111 |
+
" metrics=['accuracy'])\n",
|
| 112 |
+
" "
|
| 113 |
+
]
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"cell_type": "code",
|
| 117 |
+
"execution_count": 27,
|
| 118 |
+
"metadata": {},
|
| 119 |
+
"outputs": [
|
| 120 |
+
{
|
| 121 |
+
"data": {
|
| 122 |
+
"text/html": [
|
| 123 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential_4\"</span>\n",
|
| 124 |
+
"</pre>\n"
|
| 125 |
+
],
|
| 126 |
+
"text/plain": [
|
| 127 |
+
"\u001b[1mModel: \"sequential_4\"\u001b[0m\n"
|
| 128 |
+
]
|
| 129 |
+
},
|
| 130 |
+
"metadata": {},
|
| 131 |
+
"output_type": "display_data"
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"data": {
|
| 135 |
+
"text/html": [
|
| 136 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
|
| 137 |
+
"┃<span style=\"font-weight: bold\"> Layer (type) </span>┃<span style=\"font-weight: bold\"> Output Shape </span>┃<span style=\"font-weight: bold\"> Param # </span>┃\n",
|
| 138 |
+
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
|
| 139 |
+
"│ conv2d_13 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">222</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">222</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">32</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">896</span> │\n",
|
| 140 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 141 |
+
"│ max_pooling2d_13 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">111</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">111</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">32</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 142 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 143 |
+
"│ conv2d_14 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">109</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">109</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">64</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">18,496</span> │\n",
|
| 144 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 145 |
+
"│ max_pooling2d_14 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">54</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">54</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">64</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 146 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 147 |
+
"│ conv2d_15 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">52</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">52</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">73,856</span> │\n",
|
| 148 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 149 |
+
"│ max_pooling2d_15 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">26</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">26</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 150 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 151 |
+
"│ conv2d_16 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Conv2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">24</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">24</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">147,584</span> │\n",
|
| 152 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 153 |
+
"│ max_pooling2d_16 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">MaxPooling2D</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">12</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">12</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 154 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 155 |
+
"│ flatten_4 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Flatten</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">18432</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
|
| 156 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 157 |
+
"│ dense_8 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">512</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">9,437,696</span> │\n",
|
| 158 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 159 |
+
"│ dense_9 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>) │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">8</span>) │ <span style=\"color: #00af00; text-decoration-color: #00af00\">4,104</span> │\n",
|
| 160 |
+
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n",
|
| 161 |
+
"</pre>\n"
|
| 162 |
+
],
|
| 163 |
+
"text/plain": [
|
| 164 |
+
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓\n",
|
| 165 |
+
"┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
|
| 166 |
+
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩\n",
|
| 167 |
+
"│ conv2d_13 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m222\u001b[0m, \u001b[38;5;34m222\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m896\u001b[0m │\n",
|
| 168 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 169 |
+
"│ max_pooling2d_13 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m111\u001b[0m, \u001b[38;5;34m111\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 170 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 171 |
+
"│ conv2d_14 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m109\u001b[0m, \u001b[38;5;34m109\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m18,496\u001b[0m │\n",
|
| 172 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 173 |
+
"│ max_pooling2d_14 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m54\u001b[0m, \u001b[38;5;34m54\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 174 |
+
"├─────────────────────────────────┼───────────────��────────┼───────────────┤\n",
|
| 175 |
+
"│ conv2d_15 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m52\u001b[0m, \u001b[38;5;34m52\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m73,856\u001b[0m │\n",
|
| 176 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 177 |
+
"│ max_pooling2d_15 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m26\u001b[0m, \u001b[38;5;34m26\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 178 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 179 |
+
"│ conv2d_16 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m24\u001b[0m, \u001b[38;5;34m24\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m147,584\u001b[0m │\n",
|
| 180 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 181 |
+
"│ max_pooling2d_16 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m12\u001b[0m, \u001b[38;5;34m12\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 182 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 183 |
+
"│ flatten_4 (\u001b[38;5;33mFlatten\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m18432\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
|
| 184 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 185 |
+
"│ dense_8 (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m512\u001b[0m) │ \u001b[38;5;34m9,437,696\u001b[0m │\n",
|
| 186 |
+
"├─────────────────────────────────┼────────────────────────┼───────────────┤\n",
|
| 187 |
+
"│ dense_9 (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m8\u001b[0m) │ \u001b[38;5;34m4,104\u001b[0m │\n",
|
| 188 |
+
"└─────────────────────────────────┴────────────────────────┴───────────────┘\n"
|
| 189 |
+
]
|
| 190 |
+
},
|
| 191 |
+
"metadata": {},
|
| 192 |
+
"output_type": "display_data"
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"data": {
|
| 196 |
+
"text/html": [
|
| 197 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">9,682,632</span> (36.94 MB)\n",
|
| 198 |
+
"</pre>\n"
|
| 199 |
+
],
|
| 200 |
+
"text/plain": [
|
| 201 |
+
"\u001b[1m Total params: \u001b[0m\u001b[38;5;34m9,682,632\u001b[0m (36.94 MB)\n"
|
| 202 |
+
]
|
| 203 |
+
},
|
| 204 |
+
"metadata": {},
|
| 205 |
+
"output_type": "display_data"
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"data": {
|
| 209 |
+
"text/html": [
|
| 210 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">9,682,632</span> (36.94 MB)\n",
|
| 211 |
+
"</pre>\n"
|
| 212 |
+
],
|
| 213 |
+
"text/plain": [
|
| 214 |
+
"\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m9,682,632\u001b[0m (36.94 MB)\n"
|
| 215 |
+
]
|
| 216 |
+
},
|
| 217 |
+
"metadata": {},
|
| 218 |
+
"output_type": "display_data"
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"data": {
|
| 222 |
+
"text/html": [
|
| 223 |
+
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
|
| 224 |
+
"</pre>\n"
|
| 225 |
+
],
|
| 226 |
+
"text/plain": [
|
| 227 |
+
"\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
|
| 228 |
+
]
|
| 229 |
+
},
|
| 230 |
+
"metadata": {},
|
| 231 |
+
"output_type": "display_data"
|
| 232 |
+
}
|
| 233 |
+
],
|
| 234 |
+
"source": [
|
| 235 |
+
"model.summary()"
|
| 236 |
+
]
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"cell_type": "code",
|
| 240 |
+
"execution_count": 28,
|
| 241 |
+
"metadata": {},
|
| 242 |
+
"outputs": [
|
| 243 |
+
{
|
| 244 |
+
"name": "stdout",
|
| 245 |
+
"output_type": "stream",
|
| 246 |
+
"text": [
|
| 247 |
+
"Epoch 1/20\n"
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"name": "stderr",
|
| 252 |
+
"output_type": "stream",
|
| 253 |
+
"text": [
|
| 254 |
+
"2024-10-14 11:16:05.231584: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:117] Plugin optimizer for device_type GPU is enabled.\n",
|
| 255 |
+
"/Users/edoaurahman/development/anaconda/anaconda3/envs/tensorflow/lib/python3.10/site-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:122: UserWarning: Your `PyDataset` class should call `super().__init__(**kwargs)` in its constructor. `**kwargs` can include `workers`, `use_multiprocessing`, `max_queue_size`. Do not pass these arguments to `fit()`, as they will be ignored.\n",
|
| 256 |
+
" self._warn_if_super_not_called()\n"
|
| 257 |
+
]
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"name": "stdout",
|
| 261 |
+
"output_type": "stream",
|
| 262 |
+
"text": [
|
| 263 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m26s\u001b[0m 353ms/step - accuracy: 0.2478 - loss: 2.1296 - val_accuracy: 0.5987 - val_loss: 1.1171\n",
|
| 264 |
+
"Epoch 2/20\n",
|
| 265 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m18s\u001b[0m 339ms/step - accuracy: 0.6152 - loss: 1.0357 - val_accuracy: 0.6688 - val_loss: 0.8430\n",
|
| 266 |
+
"Epoch 3/20\n",
|
| 267 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m18s\u001b[0m 322ms/step - accuracy: 0.7471 - loss: 0.7063 - val_accuracy: 0.7898 - val_loss: 0.6230\n",
|
| 268 |
+
"Epoch 4/20\n",
|
| 269 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 370ms/step - accuracy: 0.8481 - loss: 0.4345 - val_accuracy: 0.8408 - val_loss: 0.5627\n",
|
| 270 |
+
"Epoch 5/20\n",
|
| 271 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m26s\u001b[0m 471ms/step - accuracy: 0.9096 - loss: 0.2562 - val_accuracy: 0.8408 - val_loss: 0.5344\n",
|
| 272 |
+
"Epoch 6/20\n",
|
| 273 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 363ms/step - accuracy: 0.9161 - loss: 0.2274 - val_accuracy: 0.8408 - val_loss: 0.8011\n",
|
| 274 |
+
"Epoch 7/20\n",
|
| 275 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 367ms/step - accuracy: 0.9671 - loss: 0.0961 - val_accuracy: 0.8408 - val_loss: 0.6227\n",
|
| 276 |
+
"Epoch 8/20\n",
|
| 277 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m22s\u001b[0m 403ms/step - accuracy: 0.9832 - loss: 0.0657 - val_accuracy: 0.7898 - val_loss: 0.9990\n",
|
| 278 |
+
"Epoch 9/20\n",
|
| 279 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m23s\u001b[0m 420ms/step - accuracy: 0.9750 - loss: 0.0758 - val_accuracy: 0.8344 - val_loss: 0.8001\n",
|
| 280 |
+
"Epoch 10/20\n",
|
| 281 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 378ms/step - accuracy: 0.9909 - loss: 0.0312 - val_accuracy: 0.8344 - val_loss: 1.0499\n",
|
| 282 |
+
"Epoch 11/20\n",
|
| 283 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m19s\u001b[0m 359ms/step - accuracy: 0.9803 - loss: 0.0627 - val_accuracy: 0.8599 - val_loss: 0.8847\n",
|
| 284 |
+
"Epoch 12/20\n",
|
| 285 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 369ms/step - accuracy: 0.9984 - loss: 0.0089 - val_accuracy: 0.8280 - val_loss: 1.0634\n",
|
| 286 |
+
"Epoch 13/20\n",
|
| 287 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 377ms/step - accuracy: 0.9980 - loss: 0.0106 - val_accuracy: 0.8217 - val_loss: 1.2077\n",
|
| 288 |
+
"Epoch 14/20\n",
|
| 289 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m18s\u001b[0m 333ms/step - accuracy: 0.9768 - loss: 0.0614 - val_accuracy: 0.8535 - val_loss: 0.8965\n",
|
| 290 |
+
"Epoch 15/20\n",
|
| 291 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m19s\u001b[0m 345ms/step - accuracy: 0.9867 - loss: 0.0368 - val_accuracy: 0.7962 - val_loss: 1.3721\n",
|
| 292 |
+
"Epoch 16/20\n",
|
| 293 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━��━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m22s\u001b[0m 408ms/step - accuracy: 0.9825 - loss: 0.0534 - val_accuracy: 0.8153 - val_loss: 1.1506\n",
|
| 294 |
+
"Epoch 17/20\n",
|
| 295 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 372ms/step - accuracy: 0.9965 - loss: 0.0116 - val_accuracy: 0.8471 - val_loss: 1.2062\n",
|
| 296 |
+
"Epoch 18/20\n",
|
| 297 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m20s\u001b[0m 376ms/step - accuracy: 1.0000 - loss: 0.0027 - val_accuracy: 0.8408 - val_loss: 1.2559\n",
|
| 298 |
+
"Epoch 19/20\n",
|
| 299 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m22s\u001b[0m 415ms/step - accuracy: 1.0000 - loss: 2.3890e-04 - val_accuracy: 0.8535 - val_loss: 1.3033\n",
|
| 300 |
+
"Epoch 20/20\n",
|
| 301 |
+
"\u001b[1m53/53\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m22s\u001b[0m 411ms/step - accuracy: 1.0000 - loss: 1.3011e-04 - val_accuracy: 0.8471 - val_loss: 1.2932\n"
|
| 302 |
+
]
|
| 303 |
+
}
|
| 304 |
+
],
|
| 305 |
+
"source": [
|
| 306 |
+
"# Melatih model dengan data train, validasi dilakukan dengan data validation\n",
|
| 307 |
+
"history = model.fit(\n",
|
| 308 |
+
" train_generator,\n",
|
| 309 |
+
" epochs=10, # Sesuaikan jumlah epoch\n",
|
| 310 |
+
" validation_data=val_generator\n",
|
| 311 |
+
")"
|
| 312 |
+
]
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"cell_type": "code",
|
| 316 |
+
"execution_count": 29,
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"outputs": [
|
| 319 |
+
{
|
| 320 |
+
"name": "stderr",
|
| 321 |
+
"output_type": "stream",
|
| 322 |
+
"text": [
|
| 323 |
+
"WARNING:absl:You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`. \n"
|
| 324 |
+
]
|
| 325 |
+
}
|
| 326 |
+
],
|
| 327 |
+
"source": [
|
| 328 |
+
"# save model\n",
|
| 329 |
+
"model.save('model.h5')"
|
| 330 |
+
]
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"cell_type": "code",
|
| 334 |
+
"execution_count": 30,
|
| 335 |
+
"metadata": {},
|
| 336 |
+
"outputs": [],
|
| 337 |
+
"source": [
|
| 338 |
+
"# save history\n",
|
| 339 |
+
"import pickle\n",
|
| 340 |
+
"with open('history.pkl', 'wb') as file_pi:\n",
|
| 341 |
+
" pickle.dump(history.history, file_pi)"
|
| 342 |
+
]
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"cell_type": "code",
|
| 346 |
+
"execution_count": 1,
|
| 347 |
+
"metadata": {},
|
| 348 |
+
"outputs": [
|
| 349 |
+
{
|
| 350 |
+
"name": "stderr",
|
| 351 |
+
"output_type": "stream",
|
| 352 |
+
"text": [
|
| 353 |
+
"2024-10-14 11:41:05.053908: I metal_plugin/src/device/metal_device.cc:1154] Metal device set to: Apple M1\n",
|
| 354 |
+
"2024-10-14 11:41:05.053947: I metal_plugin/src/device/metal_device.cc:296] systemMemory: 8.00 GB\n",
|
| 355 |
+
"2024-10-14 11:41:05.053957: I metal_plugin/src/device/metal_device.cc:313] maxCacheSize: 2.67 GB\n",
|
| 356 |
+
"2024-10-14 11:41:05.054262: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.\n",
|
| 357 |
+
"2024-10-14 11:41:05.054278: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)\n",
|
| 358 |
+
"WARNING:absl:Compiled the loaded model, but the compiled metrics have yet to be built. `model.compile_metrics` will be empty until you train or evaluate the model.\n"
|
| 359 |
+
]
|
| 360 |
+
}
|
| 361 |
+
],
|
| 362 |
+
"source": [
|
| 363 |
+
"import tensorflow as tf\n",
|
| 364 |
+
"\n",
|
| 365 |
+
"# Load model .h5\n",
|
| 366 |
+
"model = tf.keras.models.load_model('model.h5')"
|
| 367 |
+
]
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"cell_type": "code",
|
| 371 |
+
"execution_count": 13,
|
| 372 |
+
"metadata": {},
|
| 373 |
+
"outputs": [],
|
| 374 |
+
"source": [
|
| 375 |
+
"import cv2\n",
|
| 376 |
+
"import numpy as np\n",
|
| 377 |
+
"from tensorflow.keras.preprocessing.image import img_to_array\n",
|
| 378 |
+
"\n",
|
| 379 |
+
"def preprocess_image(image_path, img_size):\n",
|
| 380 |
+
" # Baca gambar\n",
|
| 381 |
+
" img = cv2.imread(image_path)\n",
|
| 382 |
+
" \n",
|
| 383 |
+
" # Resize gambar sesuai dengan input model\n",
|
| 384 |
+
" img = cv2.resize(img, (img_size, img_size))\n",
|
| 385 |
+
" \n",
|
| 386 |
+
" # Konversi gambar ke array dan normalisasi\n",
|
| 387 |
+
" \n",
|
| 388 |
+
" # Tambahkan dimensi batch: (height, width, channels) -> (1, height, width, channels)\n",
|
| 389 |
+
" img = np.expand_dims(img, axis=0)\n",
|
| 390 |
+
" \n",
|
| 391 |
+
" return img\n"
|
| 392 |
+
]
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"cell_type": "code",
|
| 396 |
+
"execution_count": 14,
|
| 397 |
+
"metadata": {},
|
| 398 |
+
"outputs": [
|
| 399 |
+
{
|
| 400 |
+
"name": "stdout",
|
| 401 |
+
"output_type": "stream",
|
| 402 |
+
"text": [
|
| 403 |
+
"\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 152ms/step\n",
|
| 404 |
+
"Predictions: [[0. 0. 0. 1. 0. 0. 0. 0.]]\n",
|
| 405 |
+
"Predicted class: [3]\n",
|
| 406 |
+
"Predicted class: Daun Mint\n"
|
| 407 |
+
]
|
| 408 |
+
}
|
| 409 |
+
],
|
| 410 |
+
"source": [
|
| 411 |
+
"# Path ke gambar yang ingin diprediksi\n",
|
| 412 |
+
"image_path = 'lidah-buaya.jpg'\n",
|
| 413 |
+
"\n",
|
| 414 |
+
"# Preprocessing gambar (misalnya ukuran gambar input yang diharapkan model adalah 224x224)\n",
|
| 415 |
+
"img_size = 224\n",
|
| 416 |
+
"preprocessed_image = preprocess_image(image_path, img_size)\n",
|
| 417 |
+
"\n",
|
| 418 |
+
"# Prediksi menggunakan model\n",
|
| 419 |
+
"predictions = model.predict(preprocessed_image)\n",
|
| 420 |
+
"\n",
|
| 421 |
+
"# Tampilkan hasil prediksi\n",
|
| 422 |
+
"print(\"Predictions:\", predictions)\n",
|
| 423 |
+
"\n",
|
| 424 |
+
"# Ambil kelas dengan probabilitas tertinggi\n",
|
| 425 |
+
"predicted_class = np.argmax(predictions, axis=1)\n",
|
| 426 |
+
"\n",
|
| 427 |
+
"# Cetak kelas yang diprediksi\n",
|
| 428 |
+
"print(\"Predicted class:\", predicted_class)\n",
|
| 429 |
+
"\n",
|
| 430 |
+
"class_names = ['Daun Jambu Biji',\n",
|
| 431 |
+
" 'Daun Kemangi',\n",
|
| 432 |
+
" 'Daun Kunyit',\n",
|
| 433 |
+
" 'Daun Mint',\n",
|
| 434 |
+
" 'Daun Pepaya',\n",
|
| 435 |
+
" 'Daun Sirih',\n",
|
| 436 |
+
" 'Daun Sirsak',\n",
|
| 437 |
+
" 'Lidah Buaya']\n",
|
| 438 |
+
"# Konversi indeks prediksi menjadi nama kelas\n",
|
| 439 |
+
"predicted_class_name = class_names[predicted_class[0]]\n",
|
| 440 |
+
"\n",
|
| 441 |
+
"print(\"Predicted class:\", predicted_class_name)\n"
|
| 442 |
+
]
|
| 443 |
+
}
|
| 444 |
+
],
|
| 445 |
+
"metadata": {
|
| 446 |
+
"kernelspec": {
|
| 447 |
+
"display_name": "Python 3 (ipykernel)",
|
| 448 |
+
"language": "python",
|
| 449 |
+
"name": "python3"
|
| 450 |
+
},
|
| 451 |
+
"language_info": {
|
| 452 |
+
"codemirror_mode": {
|
| 453 |
+
"name": "ipython",
|
| 454 |
+
"version": 3
|
| 455 |
+
},
|
| 456 |
+
"file_extension": ".py",
|
| 457 |
+
"mimetype": "text/x-python",
|
| 458 |
+
"name": "python",
|
| 459 |
+
"nbconvert_exporter": "python",
|
| 460 |
+
"pygments_lexer": "ipython3",
|
| 461 |
+
"version": "3.10.14"
|
| 462 |
+
}
|
| 463 |
+
},
|
| 464 |
+
"nbformat": 4,
|
| 465 |
+
"nbformat_minor": 4
|
| 466 |
+
}
|
Daun-Jambu.jpg
ADDED
|
Daun-pepaya.jpg
ADDED
|
README.dataset.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tanaman Herbal > 2024-10-14 12:23pm
|
| 2 |
+
https://universe.roboflow.com/object-detection-9p5ol/tanaman-herbal-nfwdi
|
| 3 |
+
|
| 4 |
+
Provided by a Roboflow user
|
| 5 |
+
License: MIT
|
| 6 |
+
|
Tanaman-Herbal-7/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
Tanaman-Herbal-7/README.dataset.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tanaman Herbal > 2024-10-14 11:26pm
|
| 2 |
+
https://universe.roboflow.com/object-detection-9p5ol/tanaman-herbal-nfwdi
|
| 3 |
+
|
| 4 |
+
Provided by a Roboflow user
|
| 5 |
+
License: MIT
|
| 6 |
+
|
Tanaman-Herbal-7/README.roboflow.txt
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Tanaman Herbal - v7 2024-10-14 11:26pm
|
| 3 |
+
==============================
|
| 4 |
+
|
| 5 |
+
This dataset was exported via roboflow.com on October 14, 2024 at 11:27 PM GMT
|
| 6 |
+
|
| 7 |
+
Roboflow is an end-to-end computer vision platform that helps you
|
| 8 |
+
* collaborate with your team on computer vision projects
|
| 9 |
+
* collect & organize images
|
| 10 |
+
* understand and search unstructured image data
|
| 11 |
+
* annotate, and create datasets
|
| 12 |
+
* export, train, and deploy computer vision models
|
| 13 |
+
* use active learning to improve your dataset over time
|
| 14 |
+
|
| 15 |
+
For state of the art Computer Vision training notebooks you can use with this dataset,
|
| 16 |
+
visit https://github.com/roboflow/notebooks
|
| 17 |
+
|
| 18 |
+
To find over 100k other datasets and pre-trained models, visit https://universe.roboflow.com
|
| 19 |
+
|
| 20 |
+
The dataset includes 2468 images.
|
| 21 |
+
Leaf are annotated in folder format.
|
| 22 |
+
|
| 23 |
+
The following pre-processing was applied to each image:
|
| 24 |
+
* Auto-orientation of pixel data (with EXIF-orientation stripping)
|
| 25 |
+
* Resize to 640x640 (Stretch)
|
| 26 |
+
|
| 27 |
+
The following augmentation was applied to create 3 versions of each source image:
|
| 28 |
+
* 50% probability of horizontal flip
|
| 29 |
+
* 50% probability of vertical flip
|
| 30 |
+
* Equal probability of one of the following 90-degree rotations: none, clockwise, counter-clockwise, upside-down
|
| 31 |
+
|
| 32 |
+
|
Tanaman-Herbal-7/test/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-40-_JPG.rf.890d30f6312fe18807604e5bbdb474b3.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-51-_JPG.rf.37c0dde6ed6a238a113293684bb43dbe.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-52-_JPG.rf.0e44f9579c04084ff438a3cd9452afe6.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-56-_JPG.rf.7ecb516f02561188bab405ea9d87520f.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-65-_JPG.rf.32c27b94c92f8b30cd34a1cf82f9f511.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-72-_JPG.rf.a6566a4d9e9f3465a58a0edc3d79dc68.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jambu Biji/jambu-biji-73-_JPG.rf.1d77e1257780c86a70e4d2a6220143fe.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_112_jpg.rf.b1b752a79a987962de475df07684ec6a.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_118_jpg.rf.84bc7e31fef02e802b9d53690fd6502b.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_11_jpg.rf.823d0bbb3ff59c79848046cda38d2fa4.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_120_jpg.rf.e77498f952d4ba3d9dbe3c00229d1c0d.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_127_jpg.rf.8065f17aebce68b40f2f009ed769ddb2.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_128_jpg.rf.ee18b4e93a0338ecebf3d943c640b9e8.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_131_jpg.rf.ca9969ee6b8e3c64419824137ac7c5b3.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_144_jpg.rf.6c896330bd803e8079e07b0fa9429836.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_161_jpg.rf.79136eed7a59efd4bac39efff0251d75.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_172_jpg.rf.3d8f1b53cb1b6c0c1c7b78f78e4658b2.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_182_jpg.rf.1efcdb93711e3ab28c38d6bc8329c45d.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_186_jpg.rf.2ecec441662ec9254300480a3a514369.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_205_jpg.rf.26d79df311aae33de30af126af4c0f56.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_39_jpg.rf.9355537742475676281ed4be11c91954.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_44_jpg.rf.71ce9736ee51b63e1aeb043c2d15b4ba.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_55_jpg.rf.6caa4fb1b9c6a21f4093255b97b13e53.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_68_jpg.rf.959f9e683e0d9dad3674a6e2b87ed8e1.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_80_jpg.rf.5fcda6435eb8dfb3026b894e930eae80.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_84_jpg.rf.2565c9fb51ffaf6ce553d9dc2b6bdbff.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_87_jpg.rf.158f7c863c58f9156e524eeaa0eb59f1.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Jeruk/daun-jeruk_89_jpg.rf.9340ff3858b2515aa5d4c09887bb114d.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/24_jpg.rf.b823ae03e9dd8c431dfda30ffb221a9c.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/40_jpg.rf.5b493c0f115680c83f8b5c94f6062136.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/41_jpg.rf.41fcb1ce62909267d986d8f6f7b5b4bd.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/47_jpg.rf.405eef61e4597158e8856028001b6ea6.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/4_jpg.rf.fbf7fab4778aa168d6ffca9acc2b3e86.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/75_jpg.rf.1eddbbf1f7771ed1511b392bcc54a7be.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/82_jpg.rf.6a16762306eabd5e370bf1445d998953.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/83_jpg.rf.57ab85cd0f71cd0f4f229949d243e1a6.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kumis Kucing/99_jpg.rf.780140f98428b5cddc447c5f6c96e998.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kunyit/kunyit-60-_JPG.rf.09cf6e6cf841e2382649354d3304c028.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kunyit/kunyit-66-_JPG.rf.61acd6ecad84fd95876c12909377dee4.jpg
ADDED
|
Tanaman-Herbal-7/test/Daun Kunyit/kunyit-85-_JPG.rf.9095aeb6d3e42019da34111508abb852.jpg
ADDED
|