I'm running capsnet with 28*28 RGB cell images. I'm able to achieve good accuracy however, I've issues with reconstructing the test data, due to dimension mismatch. Could you please assist me in modifying the definition for test to suit RGB images? Here is the code:
def test(model, data, args):
# x_test, y_test = data
y_pred, x_recon = model.predict([x_test, y_test], batch_size=100)
print('Test acc:', np.sum(np.argmax(y_pred, 1) == np.argmax(y_test, 1))/y_test.shape[0])
image = combine_images(np.concatenate([x_test[:50],x_recon[:50]]))
image = image * 255
Image.fromarray(image.astype(np.uint8)).save(args.save_dir + "/real_and_recon.png")
print()
print('Reconstructed images are saved to %s/real_and_recon.png' % args.save_dir)
plt.imshow(plt.imread(args.save_dir + "/real_and_recon.png"))
plt.show()
I'm running capsnet with 28*28 RGB cell images. I'm able to achieve good accuracy however, I've issues with reconstructing the test data, due to dimension mismatch. Could you please assist me in modifying the definition for test to suit RGB images? Here is the code: