Skip to content

Commit c15935f

Browse files
committed
Smaller minimum number of samples
1 parent ef5fb6a commit c15935f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

benchmarks/decoders/benchmark_transforms.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,23 @@ def main():
9898
f"Benchmarking {path.name}, duration: {duration}, codec: {metadata.codec}, averaging over {args.num_exp} runs:"
9999
)
100100

101-
height = metadata.height
102-
width = metadata.width
103-
dimensions = [
104-
(int(height * 0.5), int(width * 0.5)),
105-
(int(height * 0.25), int(width * 0.25)),
106-
(int(height * 0.125), int(width * 0.125)),
107-
]
108-
fraction_of_total_frames_to_sample = [0.01, 0.05, 0.1]
109-
110-
for fraction in fraction_of_total_frames_to_sample:
111-
print(f"Sampling {fraction * 100}% of {metadata.num_frames} frames")
112-
num_frames_to_sample = math.ceil(metadata.num_frames * fraction)
101+
input_height = metadata.height
102+
input_width = metadata.width
103+
fraction_of_total_frames_to_sample = [0.005, 0.01, 0.05, 0.1]
104+
fraction_of_input_dimensions = [0.5, 0.25, 0.125]
105+
106+
for num_fraction in fraction_of_total_frames_to_sample:
107+
num_frames_to_sample = math.ceil(metadata.num_frames * num_fraction)
108+
print(
109+
f"Sampling {num_fraction * 100}%, {num_frames_to_sample}, of {metadata.num_frames} frames"
110+
)
113111
uniform_timestamps = [
114112
i * duration / num_frames_to_sample for i in range(num_frames_to_sample)
115113
]
116114

117-
for dims in dimensions:
115+
for dims_fraction in fraction_of_input_dimensions:
116+
dims = (int(input_height * dims_fraction), int(input_width * dims_fraction))
117+
118118
times = bench(
119119
torchvision_resize, path, uniform_timestamps, dims, num_exp=args.num_exp
120120
)
@@ -130,8 +130,8 @@ def main():
130130
report_stats(times, prefix=f"decoder_native_resize({dims})")
131131
print()
132132

133-
center_x = (height - dims[0]) // 2
134-
center_y = (width - dims[1]) // 2
133+
center_x = (input_height - dims[0]) // 2
134+
center_y = (input_width - dims[1]) // 2
135135
times = bench(
136136
torchvision_crop,
137137
path,

0 commit comments

Comments
 (0)