-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate.py
37 lines (29 loc) · 1.08 KB
/
evaluate.py
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
import os
import random
import tensorflow as tf
import utils.config as cfg
import utils.utilities as utils
import utils.evaluation as eval
def visualize_bboxes(model: tf.keras.Model):
"""Call visualizing functions.
Args:
model (tf.keras.Model): TensorFlow model
"""
seed = random.randint(0, 10000)
utils.visualize_batch(path=cfg.EVAL_DATA_DIR,
mode="validation",
seed=seed)
utils.visualize_predictions(path=cfg.EVAL_DATA_DIR,
mode="validation",
model=model,
seed=seed,
threshold=cfg.EVAL_THRESHOLD,
encoding="winsim")
if __name__ == "__main__":
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = ""
model = tf.saved_model.load(cfg.TRAINED_MODEL_PATH)
visualize_bboxes(model)
eval.evaluate(data_dir=cfg.TEST_IMAGE_DATA_DIR,
model=model,
threshold=cfg.EVAL_THRESHOLD)