Skip to content

Commit 2ef5ba9

Browse files
committed
simplify read_image
1 parent 1c619b5 commit 2ef5ba9

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

dassl/utils/tools.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,7 @@ def read_image(path):
117117
Returns:
118118
PIL image
119119
"""
120-
if not osp.exists(path):
121-
raise IOError("No file exists at {}".format(path))
122-
123-
while True:
124-
try:
125-
img = Image.open(path).convert("RGB")
126-
return img
127-
except IOError:
128-
print(
129-
"Cannot read image from {}, "
130-
"probably due to heavy IO. Will re-try".format(path)
131-
)
120+
return Image.open(path).convert("RGB")
132121

133122

134123
def collect_env_info():

0 commit comments

Comments
 (0)