Example #1
0
    def forward(self, tokens):
        net = self.apollo_net

        net.f(
            layers.NumpyData(self.seed_name,
                             np.zeros((tokens.shape[0], self.hidden_size))))

        for t in range(tokens.shape[1]):
            word_name = self.word_name % t
            wordvec_name = self.wordvec_name % t
            concat_name = self.concat_name % t
            lstm_name = self.lstm_name % t
            hidden_name = self.hidden_name % t
            mem_name = self.mem_name % t
            if t == 0:
                prev_hidden = self.seed_name
                prev_mem = self.seed_name
            else:
                prev_hidden = self.hidden_name % (t - 1)
                prev_mem = self.mem_name % (t - 1)

            net.f(layers.NumpyData(word_name, np.asarray(tokens[:, t])))
            net.f(
                layers.Wordvec(wordvec_name,
                               self.hidden_size,
                               len(STRING_INDEX),
                               bottoms=[word_name],
                               param_names=[self.wordvec_param_name],
                               param_lr_mults=[self.param_mult]))

            net.f(
                layers.Concat(concat_name, bottoms=[prev_hidden,
                                                    wordvec_name]))
            net.f(
                layers.LstmUnit(lstm_name,
                                bottoms=[concat_name, prev_mem],
                                param_names=[
                                    self.input_value_param_name,
                                    self.input_gate_param_name,
                                    self.forget_gate_param_name,
                                    self.output_gate_param_name
                                ],
                                param_lr_mults=[self.param_mult] * 4,
                                tops=[hidden_name, mem_name],
                                num_cells=self.hidden_size))

        net.f(
            layers.InnerProduct(self.ip_name,
                                len(ANSWER_INDEX),
                                bottoms=[hidden_name],
                                param_lr_mults=[self.param_mult] * 2))
        net.f(layers.ReLU(self.relu_name, bottoms=[self.ip_name]))
        net.f(
            layers.Eltwise(self.sum_name,
                           bottoms=[self.relu_name, self.incoming_name],
                           operation="SUM"))
Example #2
0
def alexnet_layers():
    conv_weight_filler = layers.Filler("gaussian", 0.01)
    bias_filler0 = layers.Filler("constant", 0.0)
    bias_filler1 = layers.Filler("constant", 1.0)
    conv_lr_mults = [1.0, 2.0]
    conv_decay_mults = [1.0, 0.0]

    alexnet_layers = [
        layers.Convolution("conv1", bottoms=["data"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults, kernel_dim=(11, 11),
            stride=4, weight_filler=conv_weight_filler, bias_filler=bias_filler0, num_output=96),
        layers.ReLU(name="relu1", bottoms=["conv1"], tops=["conv1"]),
        layers.Pooling(name="pool1", bottoms=["conv1"], kernel_size=3, stride=2),
        layers.LRN(name="norm1", bottoms=["pool1"], local_size=5, alpha=0.0001, beta=0.75),
        layers.Convolution(name="conv2", bottoms=["norm1"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults, kernel_dim=(5, 5),
            pad=2, group=2, weight_filler=conv_weight_filler, bias_filler=bias_filler1, num_output=256),
        layers.ReLU(name="relu2", bottoms=["conv2"], tops=["conv2"]),
        layers.Pooling(name="pool2", bottoms=["conv2"], kernel_size=3, stride=2),
        layers.LRN(name="norm2", bottoms=["pool2"], local_size=5, alpha=0.0001, beta=0.75),
        layers.Convolution(name="conv3", bottoms=["norm2"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults, kernel_dim=(3, 3),
            pad=1, weight_filler=conv_weight_filler, bias_filler=bias_filler0, num_output=384),
        layers.ReLU(name="relu3", bottoms=["conv3"], tops=["conv3"]),
        layers.Convolution(name="conv4", bottoms=["conv3"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults, kernel_dim=(3, 3),
            pad=1, group=2, weight_filler=conv_weight_filler, bias_filler=bias_filler1, num_output=384),
        layers.ReLU(name="relu4", bottoms=["conv4"], tops=["conv4"]),
        layers.Convolution(name="conv5", bottoms=["conv4"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults, kernel_dim=(3, 3),
            pad=1, group=2, weight_filler=conv_weight_filler, bias_filler=bias_filler1, num_output=256),
        layers.ReLU(name="relu5", bottoms=["conv5"], tops=["conv5"]),
        layers.Pooling(name="pool5", bottoms=["conv5"], kernel_size=3, stride=2),
        layers.InnerProduct(name="fc6", bottoms=["pool5"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults,
            weight_filler=layers.Filler("gaussian", 0.005),
            bias_filler=bias_filler1, num_output=4096),
        layers.ReLU(name="relu6", bottoms=["fc6"], tops=["fc6"]),
        layers.Dropout(name="drop6", bottoms=["fc6"], tops=["fc6"], dropout_ratio=0.5),
        layers.InnerProduct(name="fc7", bottoms=["fc6"], param_lr_mults=conv_lr_mults,
            param_decay_mults=conv_decay_mults,
            weight_filler=layers.Filler("gaussian", 0.005),
            bias_filler=bias_filler1, num_output=4096),
        layers.ReLU(name="relu7", bottoms=["fc7"], tops=["fc7"]),
        layers.Dropout(name="drop7", bottoms=["fc7"], tops=["fc7"], dropout_ratio=0.5),
        layers.InnerProduct(name="fc8", bottoms=["fc7"], param_lr_mults=[1.0, 2.0],
            param_decay_mults=conv_decay_mults,
            weight_filler=layers.Filler("gaussian", 0.01),
            bias_filler=bias_filler0, num_output=1000),
        layers.SoftmaxWithLoss(name="loss", bottoms=["fc8", "label"]),
    ]

    return alexnet_layers
Example #3
0
 def forward(self, data):
     assert len(data.shape) == 4
     batch_size, channels, width, height = data.shape
     if self.data_name not in self.apollo_net.blobs.keys():
         self.apollo_net.f(layers.NumpyData(self.data_name, data=data))
     else:
         self.apollo_net.blobs[self.data_name].data[:] = data
     if self.proj_size is not None:
         self.apollo_net.f(
             layers.Convolution(self.proj_name, (1, 1),
                                self.proj_size,
                                bottoms=[self.data_name]))
         self.apollo_net.f(
             layers.ReLU(self.relu_name, bottoms=[self.proj_name]))
Example #4
0
def googlenet_layers():
    weight_filler = layers.Filler("xavier")
    bias_filler = layers.Filler("constant", 0.2)
    conv_lr_mults = [1.0, 2.0]
    conv_decay_mults = [1.0, 0.0]

    googlenet_layers = [
        layers.Convolution(name="conv1/7x7_s2",
                           bottoms=["data"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(7, 7),
                           stride=2,
                           pad=3,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="conv1/relu_7x7",
                    bottoms=["conv1/7x7_s2"],
                    tops=["conv1/7x7_s2"]),
        layers.Pooling(name="pool1/3x3_s2",
                       bottoms=["conv1/7x7_s2"],
                       kernel_size=3,
                       stride=2),
        layers.LRN(name="pool1/norm1",
                   bottoms=["pool1/3x3_s2"],
                   local_size=5,
                   alpha=0.0001,
                   beta=0.75),
        layers.Convolution(name="conv2/3x3_reduce",
                           bottoms=["pool1/norm1"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="conv2/relu_3x3_reduce",
                    bottoms=["conv2/3x3_reduce"],
                    tops=["conv2/3x3_reduce"]),
        layers.Convolution(name="conv2/3x3",
                           bottoms=["conv2/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=192),
        layers.ReLU(name="conv2/relu_3x3",
                    bottoms=["conv2/3x3"],
                    tops=["conv2/3x3"]),
        layers.LRN(name="conv2/norm2",
                   bottoms=["conv2/3x3"],
                   local_size=5,
                   alpha=0.0001,
                   beta=0.75),
        layers.Pooling(name="pool2/3x3_s2",
                       bottoms=["conv2/norm2"],
                       kernel_size=3,
                       stride=2),
        layers.Convolution(name="inception_3a/1x1",
                           bottoms=["pool2/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_3a/relu_1x1",
                    bottoms=["inception_3a/1x1"],
                    tops=["inception_3a/1x1"]),
        layers.Convolution(name="inception_3a/3x3_reduce",
                           bottoms=["pool2/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=96),
        layers.ReLU(name="inception_3a/relu_3x3_reduce",
                    bottoms=["inception_3a/3x3_reduce"],
                    tops=["inception_3a/3x3_reduce"]),
        layers.Convolution(name="inception_3a/3x3",
                           bottoms=["inception_3a/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_3a/relu_3x3",
                    bottoms=["inception_3a/3x3"],
                    tops=["inception_3a/3x3"]),
        layers.Convolution(name="inception_3a/5x5_reduce",
                           bottoms=["pool2/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=16),
        layers.ReLU(name="inception_3a/relu_5x5_reduce",
                    bottoms=["inception_3a/5x5_reduce"],
                    tops=["inception_3a/5x5_reduce"]),
        layers.Convolution(name="inception_3a/5x5",
                           bottoms=["inception_3a/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_3a/relu_5x5",
                    bottoms=["inception_3a/5x5"],
                    tops=["inception_3a/5x5"]),
        layers.Pooling(name="inception_3a/pool",
                       bottoms=["pool2/3x3_s2"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_3a/pool_proj",
                           bottoms=["inception_3a/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_3a/relu_pool_proj",
                    bottoms=["inception_3a/pool_proj"],
                    tops=["inception_3a/pool_proj"]),
        layers.Concat(name="inception_3a/output",
                      bottoms=[
                          "inception_3a/1x1", "inception_3a/3x3",
                          "inception_3a/5x5", "inception_3a/pool_proj"
                      ]),
        layers.Convolution(name="inception_3b/1x1",
                           bottoms=["inception_3a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_3b/relu_1x1",
                    bottoms=["inception_3b/1x1"],
                    tops=["inception_3b/1x1"]),
        layers.Convolution(name="inception_3b/3x3_reduce",
                           bottoms=["inception_3a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_3b/relu_3x3_reduce",
                    bottoms=["inception_3b/3x3_reduce"],
                    tops=["inception_3b/3x3_reduce"]),
        layers.Convolution(name="inception_3b/3x3",
                           bottoms=["inception_3b/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=192),
        layers.ReLU(name="inception_3b/relu_3x3",
                    bottoms=["inception_3b/3x3"],
                    tops=["inception_3b/3x3"]),
        layers.Convolution(name="inception_3b/5x5_reduce",
                           bottoms=["inception_3a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_3b/relu_5x5_reduce",
                    bottoms=["inception_3b/5x5_reduce"],
                    tops=["inception_3b/5x5_reduce"]),
        layers.Convolution(name="inception_3b/5x5",
                           bottoms=["inception_3b/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=96),
        layers.ReLU(name="inception_3b/relu_5x5",
                    bottoms=["inception_3b/5x5"],
                    tops=["inception_3b/5x5"]),
        layers.Pooling(name="inception_3b/pool",
                       bottoms=["inception_3a/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_3b/pool_proj",
                           bottoms=["inception_3b/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_3b/relu_pool_proj",
                    bottoms=["inception_3b/pool_proj"],
                    tops=["inception_3b/pool_proj"]),
        layers.Concat(name="inception_3b/output",
                      bottoms=[
                          "inception_3b/1x1", "inception_3b/3x3",
                          "inception_3b/5x5", "inception_3b/pool_proj"
                      ]),
        layers.Pooling(name="pool3/3x3_s2",
                       bottoms=["inception_3b/output"],
                       kernel_size=3,
                       stride=2),
        layers.Convolution(name="inception_4a/1x1",
                           bottoms=["pool3/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=192),
        layers.ReLU(name="inception_4a/relu_1x1",
                    bottoms=["inception_4a/1x1"],
                    tops=["inception_4a/1x1"]),
        layers.Convolution(name="inception_4a/3x3_reduce",
                           bottoms=["pool3/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=96),
        layers.ReLU(name="inception_4a/relu_3x3_reduce",
                    bottoms=["inception_4a/3x3_reduce"],
                    tops=["inception_4a/3x3_reduce"]),
        layers.Convolution(name="inception_4a/3x3",
                           bottoms=["inception_4a/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=208),
        layers.ReLU(name="inception_4a/relu_3x3",
                    bottoms=["inception_4a/3x3"],
                    tops=["inception_4a/3x3"]),
        layers.Convolution(name="inception_4a/5x5_reduce",
                           bottoms=["pool3/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=16),
        layers.ReLU(name="inception_4a/relu_5x5_reduce",
                    bottoms=["inception_4a/5x5_reduce"],
                    tops=["inception_4a/5x5_reduce"]),
        layers.Convolution(name="inception_4a/5x5",
                           bottoms=["inception_4a/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=48),
        layers.ReLU(name="inception_4a/relu_5x5",
                    bottoms=["inception_4a/5x5"],
                    tops=["inception_4a/5x5"]),
        layers.Pooling(name="inception_4a/pool",
                       bottoms=["pool3/3x3_s2"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_4a/pool_proj",
                           bottoms=["inception_4a/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4a/relu_pool_proj",
                    bottoms=["inception_4a/pool_proj"],
                    tops=["inception_4a/pool_proj"]),
        layers.Concat(name="inception_4a/output",
                      bottoms=[
                          "inception_4a/1x1", "inception_4a/3x3",
                          "inception_4a/5x5", "inception_4a/pool_proj"
                      ]),
        layers.Pooling(name="loss1/ave_pool",
                       bottoms=["inception_4a/output"],
                       kernel_size=5,
                       stride=3,
                       pool='AVE'),
        layers.Convolution(name="loss1/conv",
                           bottoms=["loss1/ave_pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="loss1/relu_conv",
                    bottoms=["loss1/conv"],
                    tops=["loss1/conv"]),
        layers.InnerProduct(name="loss1/fc",
                            bottoms=["loss1/conv"],
                            param_lr_mults=conv_lr_mults,
                            param_decay_mults=conv_decay_mults,
                            weight_filler=weight_filler,
                            bias_filler=bias_filler,
                            num_output=1024),
        layers.ReLU(name="loss1/relu_fc",
                    bottoms=["loss1/fc"],
                    tops=["loss1/fc"]),
        layers.Dropout(name="loss1/drop_fc",
                       bottoms=["loss1/fc"],
                       tops=["loss1/fc"],
                       dropout_ratio=0.7),
        layers.InnerProduct(name="loss1/classifier",
                            bottoms=["loss1/fc"],
                            param_lr_mults=conv_lr_mults,
                            param_decay_mults=conv_decay_mults,
                            weight_filler=weight_filler,
                            bias_filler=layers.CaffeFiller(type="constant",
                                                           value=0.0),
                            num_output=1000),
        layers.SoftmaxWithLoss(name="loss1/loss",
                               bottoms=["loss1/classifier", "label"],
                               tops=["loss1/loss1"],
                               loss_weight=0.3),
        layers.Convolution(name="inception_4b/1x1",
                           bottoms=["inception_4a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=160),
        layers.ReLU(name="inception_4b/relu_1x1",
                    bottoms=["inception_4b/1x1"],
                    tops=["inception_4b/1x1"]),
        layers.Convolution(name="inception_4b/3x3_reduce",
                           bottoms=["inception_4a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=112),
        layers.ReLU(name="inception_4b/relu_3x3_reduce",
                    bottoms=["inception_4b/3x3_reduce"],
                    tops=["inception_4b/3x3_reduce"]),
        layers.Convolution(name="inception_4b/3x3",
                           bottoms=["inception_4b/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=224),
        layers.ReLU(name="inception_4b/relu_3x3",
                    bottoms=["inception_4b/3x3"],
                    tops=["inception_4b/3x3"]),
        layers.Convolution(name="inception_4b/5x5_reduce",
                           bottoms=["inception_4a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=24),
        layers.ReLU(name="inception_4b/relu_5x5_reduce",
                    bottoms=["inception_4b/5x5_reduce"],
                    tops=["inception_4b/5x5_reduce"]),
        layers.Convolution(name="inception_4b/5x5",
                           bottoms=["inception_4b/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4b/relu_5x5",
                    bottoms=["inception_4b/5x5"],
                    tops=["inception_4b/5x5"]),
        layers.Pooling(name="inception_4b/pool",
                       bottoms=["inception_4a/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_4b/pool_proj",
                           bottoms=["inception_4b/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4b/relu_pool_proj",
                    bottoms=["inception_4b/pool_proj"],
                    tops=["inception_4b/pool_proj"]),
        layers.Concat(name="inception_4b/output",
                      bottoms=[
                          "inception_4b/1x1", "inception_4b/3x3",
                          "inception_4b/5x5", "inception_4b/pool_proj"
                      ]),
        layers.Convolution(name="inception_4c/1x1",
                           bottoms=["inception_4b/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_4c/relu_1x1",
                    bottoms=["inception_4c/1x1"],
                    tops=["inception_4c/1x1"]),
        layers.Convolution(name="inception_4c/3x3_reduce",
                           bottoms=["inception_4b/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_4c/relu_3x3_reduce",
                    bottoms=["inception_4c/3x3_reduce"],
                    tops=["inception_4c/3x3_reduce"]),
        layers.Convolution(name="inception_4c/3x3",
                           bottoms=["inception_4c/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=256),
        layers.ReLU(name="inception_4c/relu_3x3",
                    bottoms=["inception_4c/3x3"],
                    tops=["inception_4c/3x3"]),
        layers.Convolution(name="inception_4c/5x5_reduce",
                           bottoms=["inception_4b/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=24),
        layers.ReLU(name="inception_4c/relu_5x5_reduce",
                    bottoms=["inception_4c/5x5_reduce"],
                    tops=["inception_4c/5x5_reduce"]),
        layers.Convolution(name="inception_4c/5x5",
                           bottoms=["inception_4c/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4c/relu_5x5",
                    bottoms=["inception_4c/5x5"],
                    tops=["inception_4c/5x5"]),
        layers.Pooling(name="inception_4c/pool",
                       bottoms=["inception_4b/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_4c/pool_proj",
                           bottoms=["inception_4c/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4c/relu_pool_proj",
                    bottoms=["inception_4c/pool_proj"],
                    tops=["inception_4c/pool_proj"]),
        layers.Concat(name="inception_4c/output",
                      bottoms=[
                          "inception_4c/1x1", "inception_4c/3x3",
                          "inception_4c/5x5", "inception_4c/pool_proj"
                      ]),
        layers.Convolution(name="inception_4d/1x1",
                           bottoms=["inception_4c/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=112),
        layers.ReLU(name="inception_4d/relu_1x1",
                    bottoms=["inception_4d/1x1"],
                    tops=["inception_4d/1x1"]),
        layers.Convolution(name="inception_4d/3x3_reduce",
                           bottoms=["inception_4c/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=144),
        layers.ReLU(name="inception_4d/relu_3x3_reduce",
                    bottoms=["inception_4d/3x3_reduce"],
                    tops=["inception_4d/3x3_reduce"]),
        layers.Convolution(name="inception_4d/3x3",
                           bottoms=["inception_4d/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=288),
        layers.ReLU(name="inception_4d/relu_3x3",
                    bottoms=["inception_4d/3x3"],
                    tops=["inception_4d/3x3"]),
        layers.Convolution(name="inception_4d/5x5_reduce",
                           bottoms=["inception_4c/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_4d/relu_5x5_reduce",
                    bottoms=["inception_4d/5x5_reduce"],
                    tops=["inception_4d/5x5_reduce"]),
        layers.Convolution(name="inception_4d/5x5",
                           bottoms=["inception_4d/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4d/relu_5x5",
                    bottoms=["inception_4d/5x5"],
                    tops=["inception_4d/5x5"]),
        layers.Pooling(name="inception_4d/pool",
                       bottoms=["inception_4c/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_4d/pool_proj",
                           bottoms=["inception_4d/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=64),
        layers.ReLU(name="inception_4d/relu_pool_proj",
                    bottoms=["inception_4d/pool_proj"],
                    tops=["inception_4d/pool_proj"]),
        layers.Concat(name="inception_4d/output",
                      bottoms=[
                          "inception_4d/1x1", "inception_4d/3x3",
                          "inception_4d/5x5", "inception_4d/pool_proj"
                      ]),
        layers.Pooling(name="loss2/ave_pool",
                       bottoms=["inception_4d/output"],
                       kernel_size=5,
                       stride=3,
                       pool='AVE'),
        layers.Convolution(name="loss2/conv",
                           bottoms=["loss2/ave_pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="loss2/relu_conv",
                    bottoms=["loss2/conv"],
                    tops=["loss2/conv"]),
        layers.InnerProduct(name="loss2/fc",
                            bottoms=["loss2/conv"],
                            param_lr_mults=conv_lr_mults,
                            param_decay_mults=conv_decay_mults,
                            weight_filler=weight_filler,
                            bias_filler=bias_filler,
                            num_output=1024),
        layers.ReLU(name="loss2/relu_fc",
                    bottoms=["loss2/fc"],
                    tops=["loss2/fc"]),
        layers.Dropout(name="loss2/drop_fc",
                       bottoms=["loss2/fc"],
                       tops=["loss2/fc"],
                       dropout_ratio=0.7),
        layers.InnerProduct(name="loss2/classifier",
                            bottoms=["loss2/fc"],
                            param_lr_mults=conv_lr_mults,
                            param_decay_mults=conv_decay_mults,
                            weight_filler=weight_filler,
                            bias_filler=layers.CaffeFiller(type="constant",
                                                           value=0.0),
                            num_output=1000),
        layers.SoftmaxWithLoss(name="loss2/loss",
                               bottoms=["loss2/classifier", "label"],
                               tops=["loss2/loss1"],
                               loss_weight=0.3),
        layers.Convolution(name="inception_4e/1x1",
                           bottoms=["inception_4d/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=256),
        layers.ReLU(name="inception_4e/relu_1x1",
                    bottoms=["inception_4e/1x1"],
                    tops=["inception_4e/1x1"]),
        layers.Convolution(name="inception_4e/3x3_reduce",
                           bottoms=["inception_4d/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=160),
        layers.ReLU(name="inception_4e/relu_3x3_reduce",
                    bottoms=["inception_4e/3x3_reduce"],
                    tops=["inception_4e/3x3_reduce"]),
        layers.Convolution(name="inception_4e/3x3",
                           bottoms=["inception_4e/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=320),
        layers.ReLU(name="inception_4e/relu_3x3",
                    bottoms=["inception_4e/3x3"],
                    tops=["inception_4e/3x3"]),
        layers.Convolution(name="inception_4e/5x5_reduce",
                           bottoms=["inception_4d/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_4e/relu_5x5_reduce",
                    bottoms=["inception_4e/5x5_reduce"],
                    tops=["inception_4e/5x5_reduce"]),
        layers.Convolution(name="inception_4e/5x5",
                           bottoms=["inception_4e/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_4e/relu_5x5",
                    bottoms=["inception_4e/5x5"],
                    tops=["inception_4e/5x5"]),
        layers.Pooling(name="inception_4e/pool",
                       bottoms=["inception_4d/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_4e/pool_proj",
                           bottoms=["inception_4e/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_4e/relu_pool_proj",
                    bottoms=["inception_4e/pool_proj"],
                    tops=["inception_4e/pool_proj"]),
        layers.Concat(name="inception_4e/output",
                      bottoms=[
                          "inception_4e/1x1", "inception_4e/3x3",
                          "inception_4e/5x5", "inception_4e/pool_proj"
                      ]),
        layers.Pooling(name="pool4/3x3_s2",
                       bottoms=["inception_4e/output"],
                       kernel_size=3,
                       stride=2),
        layers.Convolution(name="inception_5a/1x1",
                           bottoms=["pool4/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=256),
        layers.ReLU(name="inception_5a/relu_1x1",
                    bottoms=["inception_5a/1x1"],
                    tops=["inception_5a/1x1"]),
        layers.Convolution(name="inception_5a/3x3_reduce",
                           bottoms=["pool4/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=160),
        layers.ReLU(name="inception_5a/relu_3x3_reduce",
                    bottoms=["inception_5a/3x3_reduce"],
                    tops=["inception_5a/3x3_reduce"]),
        layers.Convolution(name="inception_5a/3x3",
                           bottoms=["inception_5a/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=320),
        layers.ReLU(name="inception_5a/relu_3x3",
                    bottoms=["inception_5a/3x3"],
                    tops=["inception_5a/3x3"]),
        layers.Convolution(name="inception_5a/5x5_reduce",
                           bottoms=["pool4/3x3_s2"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=32),
        layers.ReLU(name="inception_5a/relu_5x5_reduce",
                    bottoms=["inception_5a/5x5_reduce"],
                    tops=["inception_5a/5x5_reduce"]),
        layers.Convolution(name="inception_5a/5x5",
                           bottoms=["inception_5a/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_5a/relu_5x5",
                    bottoms=["inception_5a/5x5"],
                    tops=["inception_5a/5x5"]),
        layers.Pooling(name="inception_5a/pool",
                       bottoms=["pool4/3x3_s2"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_5a/pool_proj",
                           bottoms=["inception_5a/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_5a/relu_pool_proj",
                    bottoms=["inception_5a/pool_proj"],
                    tops=["inception_5a/pool_proj"]),
        layers.Concat(name="inception_5a/output",
                      bottoms=[
                          "inception_5a/1x1", "inception_5a/3x3",
                          "inception_5a/5x5", "inception_5a/pool_proj"
                      ]),
        layers.Convolution(name="inception_5b/1x1",
                           bottoms=["inception_5a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=384),
        layers.ReLU(name="inception_5b/relu_1x1",
                    bottoms=["inception_5b/1x1"],
                    tops=["inception_5b/1x1"]),
        layers.Convolution(name="inception_5b/3x3_reduce",
                           bottoms=["inception_5a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=192),
        layers.ReLU(name="inception_5b/relu_3x3_reduce",
                    bottoms=["inception_5b/3x3_reduce"],
                    tops=["inception_5b/3x3_reduce"]),
        layers.Convolution(name="inception_5b/3x3",
                           bottoms=["inception_5b/3x3_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(3, 3),
                           pad=1,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=384),
        layers.ReLU(name="inception_5b/relu_3x3",
                    bottoms=["inception_5b/3x3"],
                    tops=["inception_5b/3x3"]),
        layers.Convolution(name="inception_5b/5x5_reduce",
                           bottoms=["inception_5a/output"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=48),
        layers.ReLU(name="inception_5b/relu_5x5_reduce",
                    bottoms=["inception_5b/5x5_reduce"],
                    tops=["inception_5b/5x5_reduce"]),
        layers.Convolution(name="inception_5b/5x5",
                           bottoms=["inception_5b/5x5_reduce"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(5, 5),
                           pad=2,
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_5b/relu_5x5",
                    bottoms=["inception_5b/5x5"],
                    tops=["inception_5b/5x5"]),
        layers.Pooling(name="inception_5b/pool",
                       bottoms=["inception_5a/output"],
                       kernel_size=3,
                       stride=1,
                       pad=1),
        layers.Convolution(name="inception_5b/pool_proj",
                           bottoms=["inception_5b/pool"],
                           param_lr_mults=conv_lr_mults,
                           param_decay_mults=conv_decay_mults,
                           kernel_dim=(1, 1),
                           weight_filler=weight_filler,
                           bias_filler=bias_filler,
                           num_output=128),
        layers.ReLU(name="inception_5b/relu_pool_proj",
                    bottoms=["inception_5b/pool_proj"],
                    tops=["inception_5b/pool_proj"]),
        layers.Concat(name="inception_5b/output",
                      bottoms=[
                          "inception_5b/1x1", "inception_5b/3x3",
                          "inception_5b/5x5", "inception_5b/pool_proj"
                      ]),
        layers.Pooling(name="pool5/7x7_s1",
                       bottoms=["inception_5b/output"],
                       kernel_size=7,
                       stride=1,
                       pool='AVE'),
        layers.Dropout(name="pool5/drop_7x7_s1",
                       bottoms=["pool5/7x7_s1"],
                       tops=["pool5/7x7_s1"],
                       dropout_ratio=0.4),
        layers.InnerProduct(name="loss3/classifier",
                            bottoms=["pool5/7x7_s1"],
                            param_lr_mults=conv_lr_mults,
                            param_decay_mults=conv_decay_mults,
                            weight_filler=weight_filler,
                            bias_filler=layers.CaffeFiller(type="constant",
                                                           value=0.0),
                            num_output=1000),
        layers.SoftmaxWithLoss(name="loss3/loss3",
                               bottoms=["loss3/classifier", "label"],
                               loss_weight=1.0),
    ]
    return googlenet_layers
    def net_proto(self):
        conv_weight_filler = layers.Filler("gaussian", 0.01)
        bias_filler0 = layers.Filler("constant", 0.0)
        bias_filler1 = layers.Filler("constant", 0.1)
        bias_filler5 = layers.Filler("constant", 0.5)

        # same deploy structure as in deploy_demo.prototxt
        net_layers = [
            # saliency path
            layers.Convolution("conv1",
                               bottoms=["data"],
                               param_lr_mults=[0, 0],
                               param_decay_mults=[1, 0],
                               kernel_dim=(11, 11),
                               stride=4,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler0,
                               num_output=96),
            layers.ReLU(name="relu1", bottoms=["conv1"], tops=["conv1"]),
            layers.Pooling(name="pool1",
                           bottoms=["conv1"],
                           kernel_size=3,
                           stride=2),
            layers.LRN(name="norm1",
                       bottoms=["pool1"],
                       tops=["norm1"],
                       local_size=5,
                       alpha=0.0001,
                       beta=0.75),
            layers.Convolution(name="conv2",
                               bottoms=["norm1"],
                               param_lr_mults=[0, 0],
                               param_decay_mults=[1, 0],
                               kernel_dim=(5, 5),
                               pad=2,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=256),
            layers.ReLU(name="relu2", bottoms=["conv2"], tops=["conv2"]),
            layers.Pooling(name="pool2",
                           bottoms=["conv2"],
                           kernel_size=3,
                           stride=2),
            layers.LRN(name="norm2",
                       bottoms=["pool2"],
                       tops=["norm2"],
                       local_size=5,
                       alpha=0.0001,
                       beta=0.75),
            layers.Convolution(name="conv3",
                               bottoms=["norm2"],
                               param_lr_mults=[0.1, 0.2],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler0,
                               num_output=384),
            layers.ReLU(name="relu3", bottoms=["conv3"], tops=["conv3"]),
            layers.Convolution(name="conv4",
                               bottoms=["conv3"],
                               param_lr_mults=[0.1, 0.2],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=384),
            layers.ReLU(name="relu4", bottoms=["conv4"], tops=["conv4"]),
            layers.Convolution(name="conv5",
                               bottoms=["conv4"],
                               param_lr_mults=[0.1, 0.2],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=256),
            layers.ReLU(name="relu5", bottoms=["conv5"], tops=["conv5"]),
            layers.Convolution(name="conv5_red",
                               bottoms=["conv5"],
                               param_lr_mults=[1.0, 2.0],
                               param_decay_mults=[1, 0],
                               kernel_dim=(1, 1),
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=1),
            layers.ReLU(name="relu5_red",
                        bottoms=["conv5_red"],
                        tops=["conv5_red"]),

            # gaze path
            layers.Convolution("conv1_face",
                               bottoms=["face"],
                               param_lr_mults=[0, 0],
                               param_decay_mults=[1, 0],
                               kernel_dim=(11, 11),
                               stride=4,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler0,
                               num_output=96),
            layers.ReLU(name="relu1_face",
                        bottoms=["conv1_face"],
                        tops=["conv1_face"]),
            layers.Pooling(name="pool1_face",
                           bottoms=["conv1_face"],
                           kernel_size=3,
                           stride=2),
            layers.LRN(name="norm1_face",
                       bottoms=["pool1_face"],
                       tops=["norm1_face"],
                       local_size=5,
                       alpha=0.0001,
                       beta=0.75),
            layers.Convolution(name="conv2_face",
                               bottoms=["norm1_face"],
                               param_lr_mults=[0, 0],
                               param_decay_mults=[1, 0],
                               kernel_dim=(5, 5),
                               pad=2,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=256),
            layers.ReLU(name="relu2_face",
                        bottoms=["conv2_face"],
                        tops=["conv2_face"]),
            layers.Pooling(name="pool2_face",
                           bottoms=["conv2_face"],
                           kernel_size=3,
                           stride=2),
            layers.LRN(name="norm2_face",
                       bottoms=["pool2_face"],
                       tops=["norm2_face"],
                       local_size=5,
                       alpha=0.0001,
                       beta=0.75),
            layers.Convolution(name="conv3_face",
                               bottoms=["norm2_face"],
                               param_lr_mults=[0.2, 0.4],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler0,
                               num_output=384),
            layers.ReLU(name="relu3_face",
                        bottoms=["conv3_face"],
                        tops=["conv3_face"]),
            layers.Convolution(name="conv4_face",
                               bottoms=["conv3_face"],
                               param_lr_mults=[0.2, 0.4],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=384),
            layers.ReLU(name="relu4_face",
                        bottoms=["conv4_face"],
                        tops=["conv4_face"]),
            layers.Convolution(name="conv5_face",
                               bottoms=["conv4_face"],
                               param_lr_mults=[0.2, 0.4],
                               param_decay_mults=[1, 0],
                               kernel_dim=(3, 3),
                               pad=1,
                               group=2,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=256),
            layers.ReLU(name="relu5_face",
                        bottoms=["conv5_face"],
                        tops=["conv5_face"]),
            layers.Pooling(name="pool5_face",
                           bottoms=["conv5_face"],
                           kernel_size=3,
                           stride=2),
            layers.InnerProduct(name="fc6_face",
                                bottoms=["pool5_face"],
                                tops=["fc6_face"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.5),
                                bias_filler=bias_filler5,
                                num_output=500),
            layers.ReLU(name="relu6_face",
                        bottoms=["fc6_face"],
                        tops=["fc6_face"]),
            layers.Flatten(name="eyes_grid_flat",
                           bottoms=["eyes_grid"],
                           tops=["eyes_grid_flat"]),
            layers.Power(name="eyes_grid_mult",
                         bottoms=["eyes_grid_flat"],
                         tops=["eyes_grid_mult"],
                         power=1,
                         scale=24,
                         shift=0),
            layers.Concat(name="face_input",
                          bottoms=["fc6_face", "eyes_grid_mult"],
                          tops=["face_input"],
                          axis=1),
            layers.InnerProduct(name="fc7_face",
                                bottoms=["face_input"],
                                tops=["fc7_face"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler5,
                                num_output=400),
            layers.ReLU(name="relu7_face",
                        bottoms=["fc7_face"],
                        tops=["fc7_face"]),
            layers.InnerProduct(name="fc8_face",
                                bottoms=["fc7_face"],
                                tops=["fc8_face"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler5,
                                num_output=200),
            layers.ReLU(name="relu8_face",
                        bottoms=["fc8_face"],
                        tops=["fc8_face"]),
            layers.InnerProduct(name="importance_no_sigmoid",
                                bottoms=["fc8_face"],
                                tops=["importance_no_sigmoid"],
                                param_lr_mults=[0.2, 0.0],
                                param_decay_mults=[1.0, 0.0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                num_output=169),
            layers.Sigmoid(name="importance_map_prefilter",
                           bottoms=["importance_no_sigmoid"],
                           tops=["importance_map_prefilter"]),
            layers.Reshape('importance_map_reshape', (1, 1, 13, 13),
                           bottoms=['importance_map_prefilter'],
                           tops=["importance_map_reshape"]),
            layers.Convolution(name="importance_map",
                               bottoms=["importance_map_reshape"],
                               param_lr_mults=[0.0, 0.0],
                               param_decay_mults=[1.0, 0.0],
                               kernel_dim=(3, 3),
                               pad=1,
                               stride=1,
                               weight_filler=conv_weight_filler,
                               bias_filler=bias_filler1,
                               num_output=1),
            layers.Eltwise(name="fc_7",
                           bottoms=["conv5_red", "importance_map"],
                           tops=["fc_7"],
                           operation="PROD"),

            # shifted grids
            layers.InnerProduct(name="fc_0_0",
                                bottoms=["fc_7"],
                                tops=["fc_0_0"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler0,
                                num_output=25),
            layers.InnerProduct(name="fc_1_0",
                                bottoms=["fc_7"],
                                tops=["fc_1_0"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler0,
                                num_output=25),
            layers.InnerProduct(name="fc_m1_0",
                                bottoms=["fc_7"],
                                tops=["fc_m1_0"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler0,
                                num_output=25),
            layers.InnerProduct(name="fc_0_1",
                                bottoms=["fc_7"],
                                tops=["fc_0_1"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler0,
                                num_output=25),
            layers.InnerProduct(name="fc_0_m1",
                                bottoms=["fc_7"],
                                tops=["fc_0_m1"],
                                param_lr_mults=[1, 2],
                                param_decay_mults=[1, 0],
                                weight_filler=layers.Filler("gaussian", 0.01),
                                bias_filler=bias_filler0,
                                num_output=25),
            layers.Reshape('fc_0_0_reshape', (5, 5),
                           bottoms=['fc_0_0'],
                           tops=["fc_0_0_reshape"]),
            layers.Reshape('fc_1_0_reshape', (5, 5),
                           bottoms=['fc_1_0'],
                           tops=["fc_1_0_reshape"]),
            layers.Reshape('fc_m1_0_reshape', (5, 5),
                           bottoms=['fc_m1_0'],
                           tops=["fc_m1_0_reshape"]),
            layers.Reshape('fc_0_1_reshape', (5, 5),
                           bottoms=['fc_0_1'],
                           tops=["fc_0_1_reshape"]),
            layers.Reshape('fc_0_m1_reshape', (5, 5),
                           bottoms=['fc_0_m1'],
                           tops=["fc_0_m1_reshape"])
        ]

        return net_layers