Skip to content

Commit 5d1fda1

Browse files
committed
Export experiment duration in seconds in CSV.
Signed-off-by: Weilin Xu <[email protected]>
1 parent 3a403ae commit 5d1fda1

File tree

1 file changed

+4
-0
lines changed
  • src/anomalib/pipelines/benchmark

1 file changed

+4
-0
lines changed

src/anomalib/pipelines/benchmark/job.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: Apache-2.0
55

66
import logging
7+
import time
78
from datetime import datetime
89
from pathlib import Path
910
from tempfile import TemporaryDirectory
@@ -48,6 +49,7 @@ def run(
4849
task_id: int | None = None,
4950
) -> dict[str, Any]:
5051
"""Run the benchmark."""
52+
start_time = time.time()
5153
devices: str | list[int] = "auto"
5254
if task_id is not None:
5355
devices = [task_id]
@@ -61,6 +63,7 @@ def run(
6163
)
6264
engine.fit(self.model, self.datamodule)
6365
test_results = engine.test(self.model, self.datamodule)
66+
duration = time.time() - start_time
6467
# TODO(ashwinvaidya17): Restore throughput
6568
# https://github.com/openvinotoolkit/anomalib/issues/2054
6669
output = {
@@ -69,6 +72,7 @@ def run(
6972
"model": self.model.__class__.__name__,
7073
"data": self.datamodule.__class__.__name__,
7174
"category": self.datamodule.category,
75+
"duration": int(duration),
7276
**test_results[0],
7377
}
7478
logger.info(f"Completed with result {output}")

0 commit comments

Comments
 (0)