未验证 提交 0024cfc5 编写于 作者: T Teng Xi 提交者: GitHub

adapt PY2 PY3 (#326)

上级 5d2529a1
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import numpy as np import numpy as np
import imageio import six
if six.PY2:
import scipy.misc as imgreader
else:
import imageio as imgreader
import os import os
import paddle import paddle
from paddle import fluid from paddle import fluid
...@@ -54,7 +58,7 @@ class CASIA_Face(object): ...@@ -54,7 +58,7 @@ class CASIA_Face(object):
target = self.label_list[index] target = self.label_list[index]
try: try:
img = imageio.imread(img_path) img = imgreader.imread(img_path)
except: except:
continue continue
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import numpy as np import numpy as np
import imageio import six
if six.PY2:
import scipy.misc as imgreader
else:
import imageio as imgreader
import paddle import paddle
from paddle import fluid from paddle import fluid
...@@ -32,10 +36,10 @@ class LFW(object): ...@@ -32,10 +36,10 @@ class LFW(object):
return return
index = self.shuffle_idx.pop(0) index = self.shuffle_idx.pop(0)
imgl = imageio.imread(self.imgl_list[index]) imgl = imgreader.imread(self.imgl_list[index])
if len(imgl.shape) == 2: if len(imgl.shape) == 2:
imgl = np.stack([imgl] * 3, 2) imgl = np.stack([imgl] * 3, 2)
imgr = imageio.imread(self.imgr_list[index]) imgr = imgreader.imread(self.imgr_list[index])
if len(imgr.shape) == 2: if len(imgr.shape) == 2:
imgr = np.stack([imgr] * 3, 2) imgr = np.stack([imgr] * 3, 2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册