Пример #1
0
    def __init__(self, net, print_architecture=True):
        """
        Constructor
        """
        self.net = net
        self.compute_output = None
        self.compute_output_dict = dict()
        self.saliency_function = None
        self.iter_funcs = None

        # get input shape of network
        l_in = lasagne.layers.helper.get_all_layers(self.net)[0]
        self.input_shape = l_in.output_shape

        if print_architecture:
            print_net_architecture(net, detailed=True)
Пример #2
0
                      W=init_conv(gain="relu"),
                      nonlinearity=nonlin)
    net = batch_norm(net, alpha=0.1)
    net = DropoutLayer(net, p=0.5)
    net = Conv2DLayer(net,
                      num_filters=8 * nf,
                      filter_size=1,
                      pad=0,
                      W=init_conv(gain="relu"),
                      nonlinearity=nonlin)
    net = batch_norm(net, alpha=0.1)
    net = DropoutLayer(net, p=0.5)

    # --- feed forward part ---
    net = Conv2DLayer(net,
                      num_filters=41,
                      filter_size=1,
                      W=init_conv(gain="relu"),
                      nonlinearity=None)
    net = batch_norm(net, alpha=0.1)
    net = GlobalPoolLayer(net)
    net = FlattenLayer(net)
    net = NonlinearityLayer(net, nonlinearity=lasagne.nonlinearities.softmax)

    return net


if __name__ == "__main__":
    from dcase_task2.lasagne_wrapper.utils import print_net_architecture
    print_net_architecture(build_model(None), detailed=True)