Skip to content

Commit 47f3359

Browse files
authored
Merge pull request #47 from Janspiry/revert-37-PREPARE-DATA-OUTPUT-FIX
Revert "Fix output, suppress warning"
2 parents b247799 + f5835e5 commit 47f3359

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

data/prepare_data.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from PIL import Image
88
from tqdm import tqdm
99
from torchvision.transforms import functional as trans_fn
10-
from torchvision.transforms import InterpolationMode
1110
import os
1211
from pathlib import Path
1312
import lmdb
@@ -28,7 +27,7 @@ def image_convert_bytes(img):
2827
return buffer.getvalue()
2928

3029

31-
def resize_multiple(img, sizes=(16, 128), resample=InterpolationMode.BICUBIC, lmdb_save=False):
30+
def resize_multiple(img, sizes=(16, 128), resample=Image.BICUBIC, lmdb_save=False):
3231
lr_img = resize_and_convert(img, sizes[0], resample)
3332
hr_img = resize_and_convert(img, sizes[1], resample)
3433
sr_img = resize_and_convert(lr_img, sizes[1], resample)
@@ -98,7 +97,7 @@ def all_threads_inactive(worker_threads):
9897
return False
9998
return True
10099

101-
def prepare(img_path, out_path, n_worker, sizes=(16, 128), resample=InterpolationMode.BICUBIC, lmdb_save=False):
100+
def prepare(img_path, out_path, n_worker, sizes=(16, 128), resample=Image.BICUBIC, lmdb_save=False):
102101
resize_fn = partial(resize_worker, sizes=sizes,
103102
resample=resample, lmdb_save=lmdb_save)
104103
files = [p for p in Path(
@@ -133,7 +132,6 @@ def prepare(img_path, out_path, n_worker, sizes=(16, 128), resample=Interpolatio
133132
while not all_threads_inactive(worker_threads):
134133
print("{}/{} images processed".format(wctx.value(), total_count))
135134
time.sleep(0.1)
136-
print("{}/{} images processed".format(wctx.value(), total_count))
137135

138136
else:
139137
total = 0
@@ -175,7 +173,7 @@ def prepare(img_path, out_path, n_worker, sizes=(16, 128), resample=Interpolatio
175173

176174
args = parser.parse_args()
177175

178-
resample_map = {'bilinear': InterpolationMode.BILINEAR, 'bicubic': InterpolationMode.BICUBIC}
176+
resample_map = {'bilinear': Image.BILINEAR, 'bicubic': Image.BICUBIC}
179177
resample = resample_map[args.resample]
180178
sizes = [int(s.strip()) for s in args.size.split(',')]
181179

0 commit comments

Comments
 (0)