-
Notifications
You must be signed in to change notification settings - Fork 6
/
eval.py
47 lines (34 loc) · 1.17 KB
/
eval.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
38
39
40
41
42
43
44
45
46
47
import loaders.dataset_loader as dataset_loader
import loaders.model_loader as model_loader
from absl import app
from common_flags import FLAGS
from iseg.core_env import common_env_setup
from iseg.evaluation import evaluate
def main(argv):
# tf.debugging.disable_traceback_filtering()
strategy = common_env_setup(
run_eagerly=False,
gpu_memory_growth=FLAGS.gpu_memory_growth,
cuda_visible_devices=FLAGS.cuda_visible_devices,
tpu_name=FLAGS.tpu_name,
random_seed=FLAGS.random_seed,
mixed_precision=FLAGS.mixed_precision,
use_deterministic=True,
)
_, val_ds, num_class, ignore_label, _, _, _, val_image_count = dataset_loader.load_dataset_from_flags()
model_helper = model_loader.load_model(strategy, num_class, ignore_label=ignore_label)
evaluate(
strategy,
model_helper.model,
val_ds,
FLAGS.gpu_batch_size,
num_class,
ignore_label,
scale_rates=FLAGS.scale_rates,
flip=FLAGS.flip,
val_image_count=val_image_count,
)
if FLAGS.press_key_to_end:
input("Press any key to exit")
if __name__ == "__main__":
app.run(main)