Skip to content

Commit df1defa

Browse files
committed
feat: 💡 add timeit for inference test
1 parent 299c434 commit df1defa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

inference_iqa.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pyiqa import create_metric
55
from tqdm import tqdm
66
import csv
7+
from time import time
78

89

910
def main():
@@ -52,11 +53,13 @@ def main():
5253
else:
5354
ref_img_path = None
5455

56+
start_time = time()
5557
score = iqa_model(img_path, ref_img_path).cpu().item()
58+
end_time = time()
5659
avg_score += score
5760
pbar.update(1)
5861
pbar.set_description(f'{metric_name} of {img_name}: {score}')
59-
pbar.write(f'{metric_name} of {img_name}: {score}')
62+
pbar.write(f'{metric_name} of {img_name}: {score}\tTime: {end_time - start_time:.2f}s')
6063
if args.save_file:
6164
sfwriter.writerow([img_name, score])
6265

0 commit comments

Comments
 (0)