Skip to content

Commit 03a93a1

Browse files
mmarcinkiewicznv-kkudrynski
authored andcommitted
[UNetmed/TF] Fix registered metric names
1 parent 8d31298 commit 03a93a1

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

TensorFlow/Segmentation/UNet_Medical/utils/hooks/profiling_hook.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ def begin(self):
5050
def end(self, session):
5151
if hvd.rank() == 0:
5252
stats = process_performance_stats(np.array(self._timestamps),
53-
self._global_batch_size)
54-
self.logger.log(step=(), data={metric: value for (metric, value) in stats})
53+
self._global_batch_size,
54+
self.mode)
55+
self.logger.log(step=(), data=stats)

TensorFlow/Segmentation/UNet_Medical/utils/parse_results.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -17,18 +17,21 @@
1717
import argparse
1818

1919

20-
def process_performance_stats(timestamps, batch_size):
20+
def process_performance_stats(timestamps, batch_size, mode):
21+
""" Get confidence intervals
22+
23+
:param timestamps: Collection of timestamps
24+
:param batch_size: Number of samples per batch
25+
:param mode: Estimator's execution mode
26+
:return: Stats
27+
"""
2128
timestamps_ms = 1000 * timestamps
22-
latency_ms = timestamps_ms.mean()
23-
std = timestamps_ms.std()
24-
n = np.sqrt(len(timestamps_ms))
2529
throughput_imgps = (1000.0 * batch_size / timestamps_ms).mean()
30+
stats = {f"throughput_{mode}": throughput_imgps,
31+
f"latency_{mode}_mean": timestamps_ms.mean()}
32+
for level in [90, 95, 99]:
33+
stats.update({f"latency_{mode}_{level}": np.percentile(timestamps_ms, level)})
2634

27-
stats = [("Throughput Avg", str(throughput_imgps)),
28-
('Latency Avg:', str(latency_ms))]
29-
for ci, lvl in zip(["90%:", "95%:", "99%:"],
30-
[1.645, 1.960, 2.576]):
31-
stats.append(("Latency_" + ci, str(latency_ms + lvl * std / n)))
3235
return stats
3336

3437

@@ -77,4 +80,3 @@ def parse_convergence_results(path, environment):
7780
parse_convergence_results(path=args.model_dir, environment=args.env)
7881
elif args.exec_mode == 'benchmark':
7982
pass
80-
print()

0 commit comments

Comments
 (0)