Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

perf: scipy.misc.imresize is repalced by Image.resize #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from glob import glob
from urllib.request import urlretrieve
from tqdm import tqdm
from PIL import Image


class DLProgress(tqdm):
Expand Down Expand Up @@ -105,8 +106,8 @@ def get_batches_fn(batch_size):
for image_file in image_paths[batch_i:batch_i+batch_size]:
gt_image_file = label_paths[os.path.basename(image_file)]
# Re-size to image_shape
image = scipy.misc.imresize(scipy.misc.imread(image_file), image_shape)
gt_image = scipy.misc.imresize(scipy.misc.imread(gt_image_file), image_shape)
image = np.array(Image.open(image_file).resize(image_shape))
gt_image = np.array(Image.open(gt_image_file).resize(image_shape))

# Create "one-hot-like" labels by class
gt_bg = np.all(gt_image == background_color, axis=2)
Expand All @@ -132,7 +133,7 @@ def gen_test_output(sess, logits, keep_prob, image_pl, data_folder, image_shape)
:return: Output for for each test image
"""
for image_file in glob(os.path.join(data_folder, 'image_2', '*.png')):
image = scipy.misc.imresize(scipy.misc.imread(image_file), image_shape)
image = np.arrary(Image.open(image_file).resize(image_shape))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.array


# Run inference
im_softmax = sess.run(
Expand Down