-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
083a37c
commit 38e8253
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import random | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from imgutils.restore.scunet import SCUNetModelTyping, restore_with_scunet | ||
|
||
|
||
class SCUNetBenchmark(BaseBenchmark): | ||
def __init__(self, model: SCUNetModelTyping): | ||
BaseBenchmark.__init__(self) | ||
self.model = model | ||
|
||
def load(self): | ||
from imgutils.restore.scunet import _open_scunet_model | ||
_open_scunet_model(self.model) | ||
|
||
def unload(self): | ||
from imgutils.restore.scunet import _open_scunet_model | ||
_open_scunet_model.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = restore_with_scunet(image_file, model=self.model) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
('SCUNet-GAN', SCUNetBenchmark('GAN')), | ||
('SCUNet-PSNR', SCUNetBenchmark('PSNR')), | ||
], | ||
title='Benchmark for SCUNet Models', | ||
run_times=5, | ||
try_times=10, | ||
)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters