Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

- Add duration of experiments in seconds in the benchmark CSV result by [mzweilin](https://github.com/mzweilin) in https://github.com/openvinotoolkit/anomalib/pull/2392

### Deprecated

### Fixed
Expand Down
11 changes: 11 additions & 0 deletions src/anomalib/pipelines/benchmark/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0

import logging
import time
from datetime import datetime
from pathlib import Path
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -48,6 +49,7 @@ def run(
task_id: int | None = None,
) -> dict[str, Any]:
"""Run the benchmark."""
job_start_time = time.time()
devices: str | list[int] = "auto"
if task_id is not None:
devices = [task_id]
Expand All @@ -59,8 +61,16 @@ def run(
devices=devices,
default_root_dir=temp_dir,
)
fit_start_time = time.time()
engine.fit(self.model, self.datamodule)
test_start_time = time.time()
test_results = engine.test(self.model, self.datamodule)
job_end_time = time.time()
durations = {
"job_duration": job_end_time - job_start_time,
"fit_duration": test_start_time - fit_start_time,
"test_duration": job_end_time - test_start_time,
}
# TODO(ashwinvaidya17): Restore throughput
# https://github.com/openvinotoolkit/anomalib/issues/2054
output = {
Expand All @@ -69,6 +79,7 @@ def run(
"model": self.model.__class__.__name__,
"data": self.datamodule.__class__.__name__,
"category": self.datamodule.category,
**durations,
**test_results[0],
}
logger.info(f"Completed with result {output}")
Expand Down