Skip to content

Commit 50a6685

Browse files
author
User
committed
update
1 parent 107098a commit 50a6685

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

unsupervised_class3/util.py

100644100755
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,26 @@
1111
import zipfile
1212
import numpy as np
1313
import pandas as pd
14-
from scipy.misc import imread, imsave, imresize
14+
15+
try:
16+
# new version doesn't support
17+
from scipy.misc import imread, imsave, imresize
18+
except:
19+
from PIL import Image
20+
def imread(fn):
21+
im = Image.open(fn)
22+
return np.array(im)
23+
24+
def imsave(fn, arr):
25+
im = Image.fromarray(arr)
26+
im.save(fn)
27+
28+
def imresize(arr, sz):
29+
im = Image.fromarray(arr)
30+
im.resize(sz)
31+
return np.array(im)
32+
33+
1534
from glob import glob
1635
from tqdm import tqdm
1736
from sklearn.utils import shuffle

0 commit comments

Comments
 (0)