Skip to content

Commit

Permalink
fix reader hang issue when data path is not valid (PaddlePaddle#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyfbupt committed Apr 2, 2020
1 parent 292cc15 commit 80714b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion demo/imagenet_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def random_color(img, lower=0.5, upper=1.5):
def process_image(sample, mode, color_jitter, rotate):
img_path = sample[0]

img = Image.open(img_path)
try:
img = Image.open(img_path)
except:
print(img_path, "not exists!")
return None
if mode == 'train':
if rotate: img = rotate_image(img)
img = random_crop(img, DATA_DIM)
Expand Down

0 comments on commit 80714b0

Please sign in to comment.