def _merge(self, images, size):
h, w = images.shape[1], images.shape[2]
h_ = int(h * self.resize_factor)
w_ = int(w * self.resize_factor)
img = np.zeros((h_ * size[0], w_ * size[1]))
for idx, image in enumerate(images):
i = int(idx % size[1])
j = int(idx / size[1])
image_ = imresize(image, size=(w_, h_), interp='bicubic')
img[j * h_:j * h_ + h_, i * w_:i * w_ + w_] = image_
return img
# borrowed from https://github.com/ykwon0407/variational_autoencoder/blob/master/variational_bayes.ipynb
评论列表
文章目录