Example #1
0
def model(data, dropout=None, maxout_k=1, activation_fn=tf.nn.relu):
    data = tf.reshape(data, [BATCH_SIZE, SIZE, SIZE, NUM_CHANNELS])
    conv = conv_layer(data,
                      depth=64,
                      window=5,
                      dropout=dropout,
                      pool=(2, 2),
                      maxout_k=maxout_k,
                      activation_fn=activation_fn,
                      name='conv1')
    conv = conv_layer(conv,
                      depth=32,
                      window=5,
                      dropout=dropout,
                      pool=(2, 2),
                      maxout_k=maxout_k,
                      activation_fn=activation_fn,
                      name='conv2')
    reshape = conv_to_fc_layer(conv)
    hidden = fc_layer(reshape,
                      depth=128,
                      maxout_k=maxout_k,
                      activation_fn=activation_fn,
                      dropout=dropout,
                      name='fc1')
    output = fc_layer(hidden,
                      depth=NUM_LABELS,
                      maxout_k=1,
                      activation=False,
                      name='fc2')
    return output
Example #2
0
 def model(self, data):
     variables = defaultdict(list)
     conv1 = conv_layer(data,
                        depth=96,
                        window=11,
                        stride=4,
                        activation_fn=tf.nn.relu,
                        pool=(3, 2),
                        lrn=(5, 1.0, 1e-4, 0.75),
                        name='conv1',
                        variables=variables)
     conv2 = conv_layer(conv1,
                        depth=256,
                        window=5,
                        activation_fn=tf.nn.relu,
                        pool=(3, 2),
                        lrn=(5, 1.0, 1e-4, 0.75),
                        name='conv2',
                        variables=variables)
     conv3 = conv_layer(conv2,
                        depth=384,
                        window=3,
                        activation_fn=tf.nn.relu,
                        name='conv3',
                        variables=variables)
     conv4 = conv_layer(conv3,
                        depth=384,
                        window=3,
                        activation_fn=tf.nn.relu,
                        name='conv4',
                        variables=variables)
     conv5 = conv_layer(conv4,
                        depth=256,
                        window=3,
                        activation_fn=tf.nn.relu,
                        pool=(3, 2),
                        name='conv5',
                        variables=variables)
     conv5r = conv_to_ff_layer(conv5)
     # ff_layer(input_layer, depth, activation_fn=tf.nn.sigmoid, dropout=None, name=None, activation=True, variables=None):
     fc6 = ff_layer(
         conv5r,
         depth=512,  # TODO: return to 4096
         activation_fn=tf.nn.relu,
         dropout=self.keep_prob,
         name='fc6',
         variables=variables)
     fc7 = ff_layer(
         fc6,
         depth=512,  # TODO: return to 4096
         activation_fn=tf.nn.relu,
         dropout=self.keep_prob,
         name='fc7',
         variables=variables)
     output = ff_layer(fc7,
                       depth=NUM_LABELS,
                       name='output',
                       activation=False,
                       variables=variables)
     return output, variables
Example #3
0
    def model(self, data):
        """Construct a model.

        :param data: the batched input images
        """
        variables = defaultdict(list)
        conv = conv_layer(data,
                          depth=64,
                          window=5,
                          pool=(2, 2),
                          name='conv1',
                          variables=variables)
        conv = conv_layer(conv,
                          depth=32,
                          window=5,
                          pool=(2, 2),
                          name='conv2',
                          variables=variables)
        reshape = conv_to_ff_layer(conv)
        hidden = ff_layer(reshape, depth=512, name='ff1', variables=variables)
        output = ff_layer(hidden,
                          depth=NUM_LABELS,
                          name='ff2',
                          activation=False,
                          variables=variables)
        return output, variables
Example #4
0
 def model(self, data):
     variables = defaultdict(list)
     conv11 = conv_layer(data,
                         depth=64,
                         window=3,
                         name='conv11',
                         variables=variables)
     conv12 = conv_layer(conv11,
                         depth=64,
                         window=3,
                         name='conv12',
                         variables=variables,
                         pool=(2, 2))
     conv21 = conv_layer(conv12,
                         depth=128,
                         window=3,
                         name='conv21',
                         variables=variables)
     conv22 = conv_layer(conv21,
                         depth=128,
                         window=3,
                         name='conv22',
                         variables=variables,
                         pool=(2, 2))
     conv31 = conv_layer(conv22,
                         depth=256,
                         window=3,
                         name='conv31',
                         variables=variables)
     conv32 = conv_layer(conv31,
                         depth=256,
                         window=3,
                         name='conv32',
                         variables=variables)
     conv33 = conv_layer(conv32,
                         depth=256,
                         window=3,
                         name='conv33',
                         variables=variables,
                         pool=(2, 2))
     conv41 = conv_layer(conv33,
                         depth=512,
                         window=3,
                         name='conv41',
                         variables=variables)
     conv42 = conv_layer(conv41,
                         depth=512,
                         window=3,
                         name='conv42',
                         variables=variables)
     conv43 = conv_layer(conv42,
                         depth=512,
                         window=3,
                         name='conv43',
                         variables=variables,
                         pool=(2, 2))
     conv51 = conv_layer(conv43,
                         depth=512,
                         window=3,
                         name='conv51',
                         variables=variables)
     conv52 = conv_layer(conv51,
                         depth=512,
                         window=3,
                         name='conv52',
                         variables=variables)
     conv53 = conv_layer(conv52,
                         depth=512,
                         window=3,
                         name='conv53',
                         variables=variables,
                         pool=(2, 2))
     conv5r = conv_to_ff_layer(conv53)
     # ff_layer(input_layer, depth, activation_fn=tf.nn.sigmoid, dropout=None, name=None, activation=True, variables=None):
     fc6 = ff_layer(conv5r,
                    depth=4096,
                    dropout=self.keep_prob,
                    name='fc6',
                    variables=variables)
     fc7 = ff_layer(fc6,
                    depth=4096,
                    dropout=self.keep_prob,
                    name='fc7',
                    variables=variables)
     output = ff_layer(fc7,
                       depth=NUM_LABELS,
                       name='output',
                       activation=False,
                       variables=variables)
     return output, variables