我正在使用Google Colab运行Python代码,尝试缩小图像。
from keras.layers import Lambda
import tensorflow as tf
from skimage import data, io, filters
import numpy as np
from numpy import array
from numpy.random import randint
from scipy.misc import imresize
import os
import sys
import matplotlib.pyplot as plt
plt.switch_backend('agg')
# Takes list of images and provide LR images in form of numpy array
def lr_images(images_real , downscale):
images = []
for img in range(len(images_real)):
images.append(imresize(images_real[img],[images_real[img].shape[0]//downscale,images_real[img].shape[1]//downscale], interp='bicubic', mode=None))
images_lr = array(images)
return images_lr
它应该缩小图片,但会显示此错误。
from scipy.misc import imresize ImportError: cannot import name 'imresize'
imresize
自版本1.3起已从Scipy中移除,因为它是可在其他地方找到的功能的重复,具体而言,它与Pillow模块的功能相同。 - jasonharper