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 Mask for Multi-MNIST dataset #1

Open
shan18 opened this issue Jan 19, 2019 · 0 comments
Open

Reconstruction Mask for Multi-MNIST dataset #1

shan18 opened this issue Jan 19, 2019 · 0 comments

Comments

@shan18
Copy link

shan18 commented Jan 19, 2019

Can you please explain the code referenced below for multi MNIST dataset? Especially the part where you create recon_mask_0 and recon_mask_1, and then later add them.
Any help would be highly appreciated. Thank You.

CapsNet-tf/model.py

Lines 115 to 134 in 0727864

else:
if self.sess.run(self.recon_with_label) == True:
mask_target = tf.nn.top_k(self.input_y, 2).indices
else:
mask_target = self.multi_pred_label
recon_mask_0 = tf.one_hot(mask_target[0], depth=self.n_digit, name='mask_output_0')
recon_mask_0 = tf.multiply(self.digit_caps, recon_mask_0, name='mask_result_0')
recon_mask_0 = tf.layers.flatten(recon_mask_0, name='mask_input_0')
recon_mask_1 = tf.one_hot(mask_target[1], depth=self.n_digit, name='mask_output_1')
recon_mask_1 = tf.multiply(self.digit_caps, recon_mask_1, name='mask_result_1')
recon_mask_1 = tf.layers.flatten(recon_mask_1, name='mask_input_1')
recon_mask = recon_mask_0 + recon_mask_1
with tf.variable_scope(name) as scope:
hidden1 = fc_layer(recon_mask, self.recon_h1, activation='relu',name='hidden1')
hidden2 = fc_layer(hidden1, self.recon_h2, activation='relu',name='hidden2')
output = fc_layer(hidden2, self.recon_output, activation='sigmoid',name='reconstruction')

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

1 participant