公告
财富商城
积分规则
提问
发文
2019-08-06 09:05发布
贼婆χ
I get this result when I apply vgg.prepare() to the following image:
I use this line of code:
Image.fromarray(np.uint8(vgg.prepare(pep).reshape(224,224,3)))
And get an image which is combined of 9 copies of the given image:
I finally got what you did... the only mistake is .reshape.
.reshape
Because the image is transposed, not reshaped, you have to re-transpose to restore the original image.
pep = pep.transpose((1, 2, 0)) # transpose pep += [103.939, 116.779, 123.68] # un-normalize pep = pep.astype(np.uint8) # revert dtype pep = np.flip(pep, axis=2) # BGR -> RGB PIL_image = Image.fromarray(pep) # finally got the original!
最多设置5个标签!
I finally got what you did... the only mistake is
.reshape
.Because the image is transposed, not reshaped, you have to re-transpose to restore the original image.