37f599f61067cc6947c9bf783eace05227c0f450,capsulenet.py,,CapsNet,#,25

Before Change


    masked = Mask()([digitcaps, y])  // The true label is used to mask the output of capsule layer.
    x_recon = layers.Dense(512, activation="relu")(masked)
    x_recon = layers.Dense(1024, activation="relu")(x_recon)
    x_recon = layers.Dense(np.prod(input_shape), activation="sigmoid")(x_recon)
    x_recon = layers.Reshape(target_shape=input_shape, name="out_recon")(x_recon)

    // two-input-two-output keras Model
    return models.Model([x, y], [out_caps, x_recon])

After Change


    masked = Mask()(digitcaps)  // Mask using the capsule with maximal length. For prediction

    // Shared Decoder model in training and prediction
    decoder = models.Sequential(name="decoder")
    decoder.add(layers.Dense(512, activation="relu", input_dim=16*n_class))
    decoder.add(layers.Dense(1024, activation="relu"))
    decoder.add(layers.Dense(np.prod(input_shape), activation="sigmoid"))
    decoder.add(layers.Reshape(target_shape=input_shape, name="out_recon"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: XifengGuo/CapsNet-Keras
Commit Name: 37f599f61067cc6947c9bf783eace05227c0f450
Time: 2017-11-13
Author: guoxifeng1990@163.com
File Name: capsulenet.py
Class Name:
Method Name: CapsNet


Project Name: inspirehep/magpie
Commit Name: 2a98094ba6ef75e8162773c6dc7a2f5ae0c458bf
Time: 2016-01-25
Author: jan.stypka@cern.ch
File Name: magpie/nn/models.py
Class Name:
Method Name: build_cnn_model


Project Name: philipperemy/keras-tcn
Commit Name: 0cfe82c6beb9a28a5ff7da81b86fa0e93c388f14
Time: 2019-11-20
Author: premy@cogent.co.jp
File Name: tasks/save_reload_model.py
Class Name:
Method Name: