-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluate.py
More file actions
31 lines (23 loc) · 771 Bytes
/
Copy pathevaluate.py
File metadata and controls
31 lines (23 loc) · 771 Bytes
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
import tensorflow as tf
from model import create_model
img_height = 224
img_width = 224
batch_size = 32
model = model = create_model((img_height, img_width, 3))
model.compile(loss='sparse_categorical_crossentropy', optimizer=tf.optimizers.SGD(learning_rate=0.001), metrics=['accuracy'])
model.summary()
model.load_weights('./chk_points/checkpoint_1')
test_ds = tf.keras.utils.image_dataset_from_directory(
'test', labels='inferred',
label_mode='int',
color_mode='rgb',
batch_size=batch_size,
image_size=(img_height,img_width),
shuffle=True,
seed=6796013,
interpolation='bilinear'
)
evaluation = model.evaluate(test_ds, return_dict=True)
print("[+] Result:")
for name, value in evaluation.items():
print(f"{name}: {value:.4f}")