【发布时间】:2020-09-11 08:25:30
【问题描述】:
我想使用一个使用scipy.misc.imresize 的旧脚本。
但不幸的是,它完全从 scipy 中删除。
我不明白它做了什么,所以什么代码将执行与上述行相同的操作。
我尝试使用skimage.transform.resize(image, (num_px*num_px*3, 1), order = 3)
但得到错误 - ValueError: cannot reshape array of size 12288 into shape (1200,1)
编辑:更多信息
它将图片分类为属于两组之一。
my_image = "anyimage.jpg" #any image form the internet
#Preprocessing the image
fname = "images/" + my_image
image = np.array(ndimage.imread(fname, flatten=False))
image = image/255.
my_image = scipy.misc.imresize(image, size=(num_px,num_px)).reshape((1, num_px*num_px*3)).T #The original code which worked perfectly
my_predicted_image = predict(d["w"], d["b"], my_image) #predict function uses
#linear regression where the third parameter must be data of
#size (num_px * num_px * 3, number of examples)
【问题讨论】:
-
这能回答你的问题吗? Alternative to scipy.misc.imresize()
-
没有。我已经相应地编辑了问题
-
请提供更多详细信息(最好是minimal reproducible example),也许有人可以帮助您。目前,我们只是根据部分错误消息和没有数据进行猜测。
-
这有帮助吗?
标签: python python-3.x numpy scipy scikit-image