Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconstruction error for RGB images #1

Open
ghost opened this issue Dec 28, 2017 · 0 comments
Open

reconstruction error for RGB images #1

ghost opened this issue Dec 28, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 28, 2017

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants