Skip to content

Commit 5ff92e2

Browse files
Merge pull request yandexdataschool#63 from NickVeld/patch-17
week9: lfw_dataset rewrited for scipy >= 1.2.0
2 parents fb2ba5c + 9835151 commit 5ff92e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

week09_adversarial/lfw_dataset.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import numpy as np
22
import os
3-
from scipy.misc import imread,imresize
3+
from imageio import imread # as advised https://docs.scipy.org/doc/scipy-1.2.1/reference/generated/scipy.misc.imread.html
4+
from PIL import Image
45
import pandas as pd
56

7+
# as advised https://docs.scipy.org/doc/scipy-1.2.1/reference/generated/scipy.misc.imresize.html?highlight=imresize#scipy.misc.imresize
8+
def imresize(arr, size):
9+
return np.array(Image.fromarray(arr).resize(size=size))
10+
611
def fetch_lfw_dataset(attrs_name = "lfw_attributes.txt",
712
images_name = "lfw-deepfunneled",
813
raw_images_name = "lfw",
@@ -68,4 +73,3 @@ def fetch_lfw_dataset(attrs_name = "lfw_attributes.txt",
6873
all_attrs = df.drop(["photo_path","person","imagenum"],axis=1)
6974

7075
return all_photos,all_attrs
71-

0 commit comments

Comments
 (0)