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.
|
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') |
Can you please explain the code referenced below for multi MNIST dataset? Especially the part where you create
recon_mask_0andrecon_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