Skip to content

Conversation

@jscanvic
Copy link

No description provided.

@jscanvic jscanvic mentioned this pull request Dec 11, 2025
3 tasks
Abstract base class for benchmarks

All of the benchmarks should inherit this class and implement the `run` method.
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have dataset, metrics in the init here

:param dinv.models.Denoiser | dinv.models.Reconstructor model: The model to benchmark
:param torch.device | str device: The device to run the benchmark on (default: `"cpu"`)
:return: (`Any`) The result of the benchmark
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could write the function here with deepinv.test and avoid re-writing the for-loop for each benchmark

import benchmarks


class DenoisingBenchmark(benchmarks.Benchmark):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need to redefine a new class,
why not something like

Benchmark(dataset=dinv.datasets.Urban100HR("data/Urban100", download=True, transform=transforms.ToTensor()), device=device, )

for model in models:
model_name = type(model).__name__
psnr_avg, psnr_std = benchmark.run(model, device=device)
rows.append(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could move this logic to the base class since all benchmarks will use this

@@ -0,0 +1 @@
from .benchmark import Benchmark

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔🤔could we have a config driven interface? :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants