Showing
1 changed file
with
4 additions
and
4 deletions
1 | import os | 1 | import os |
2 | import glob | 2 | import glob |
3 | import h5py | 3 | import h5py |
4 | -import scipy.misc as misc | 4 | +from skimage import io |
5 | import numpy as np | 5 | import numpy as np |
6 | 6 | ||
7 | -dataset_dir = "DIV2K/" | 7 | +dataset_dir = "/workspace/dataset/DIV2K/" |
8 | dataset_type = "train" | 8 | dataset_type = "train" |
9 | 9 | ||
10 | f = h5py.File("DIV2K_{}.h5".format(dataset_type), "w") | 10 | f = h5py.File("DIV2K_{}.h5".format(dataset_type), "w") |
11 | dt = h5py.special_dtype(vlen=np.dtype('uint8')) | 11 | dt = h5py.special_dtype(vlen=np.dtype('uint8')) |
12 | 12 | ||
13 | -for subdir in ["HR", "X2", "X3", "X4"]: | 13 | +for subdir in ["HR", "X2"]: |
14 | if subdir in ["HR"]: | 14 | if subdir in ["HR"]: |
15 | im_paths = glob.glob(os.path.join(dataset_dir, | 15 | im_paths = glob.glob(os.path.join(dataset_dir, |
16 | "DIV2K_{}_HR".format(dataset_type), | 16 | "DIV2K_{}_HR".format(dataset_type), |
... | @@ -24,6 +24,6 @@ for subdir in ["HR", "X2", "X3", "X4"]: | ... | @@ -24,6 +24,6 @@ for subdir in ["HR", "X2", "X3", "X4"]: |
24 | grp = f.create_group(subdir) | 24 | grp = f.create_group(subdir) |
25 | 25 | ||
26 | for i, path in enumerate(im_paths): | 26 | for i, path in enumerate(im_paths): |
27 | - im = misc.imread(path) | 27 | + im = io.imread(path) |
28 | print(path) | 28 | print(path) |
29 | grp.create_dataset(str(i), data=im) | 29 | grp.create_dataset(str(i), data=im) | ... | ... |
-
Please register or login to post a comment