Commit 6c2ac026 authored by Alykhan Tejani's avatar Alykhan Tejani Committed by Francisco Massa
Browse files

Fix PIL img close warning (#357)

* add scale and ratio params to RandomResizedCrop.get_params

* don't use Image as a context manager to avoid exceptions on close

* flake8
parent 5861f14a
......@@ -48,8 +48,8 @@ def make_dataset(dir, class_to_idx):
def pil_loader(path):
# open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835)
with open(path, 'rb') as f:
with Image.open(f) as img:
return img.convert('RGB')
img = Image.open(f)
return img.convert('RGB')
def accimage_loader(path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment