Example #1
0
 def model(this,
           inputs,
           is_training,
           num_outputs=[None, 128, 64, 32],
           **kwargs):
     with tf.variable_scope('feature_fusion', values=kwargs["values"]):
         with this.get_slime_arg_scope(is_training,
                                       weight_decay=kwargs["weight_decay"]):
             g = []
             h = []
             for i in range(len(num_outputs)):
                 print('Shape of f_{} {}'.format(i, inputs[i].shape))
                 g.append(None)
                 h.append(None)
             for i in range(len(num_outputs)):
                 if i == 0:
                     h[i] = inputs[i]
                 else:
                     c1_1 = slim.conv2d(
                         tf.concat([g[i - 1], inputs[i]], axis=-1),
                         num_outputs[i], 1)
                     h[i] = slim.conv2d(c1_1, num_outputs[i], 3)
                 if i <= len(num_outputs) - 2:
                     g[i] = dogoo_ops.unpool(h[i])
                 else:
                     g[i] = slim.conv2d(h[i], num_outputs[i], 3)
                 print('Shape of h_{} {}, g_{} {}'.format(
                     i, h[i].shape, i, g[i].shape))
     return g
Example #2
0
    def model(this,
              inputs,
              is_training,
              num_outputs=[128, 128, 64, 32],
              dabcids=[],
              **kwargs):
        num_basis = [8, 4, 4, 4]

        with tf.variable_scope('feature_fusion', values=kwargs["values"]):
            with this.get_slime_arg_scope(is_training,
                                          weight_decay=kwargs["weight_decay"]):
                g = []
                h = []
                l = []
                w = []
                for i in range(len(num_outputs)):
                    print('Shape of f_{} {}'.format(i, inputs[i].shape))
                    g.append(None)
                    h.append(None)
                    l.append(None)
                    w.append(None)
                for i in range(len(num_outputs)):
                    if i == 0:
                        if (4 - i not in dabcids):
                            w[i], l[i] = this.cat_coabc(
                                inputs[i], inputs[i], num_basis[i],
                                num_outputs[i])
                        else:
                            print("disabling ", str(4 - i))
                            w[i], l[i] = this.cat_dcoabc(
                                inputs[i], inputs[i], num_basis[i],
                                num_outputs[i])
                        h[i] = l[i]
                    else:
                        if (4 - i not in dabcids):
                            w[i], l[i] = this.cat_coabc(
                                inputs[i], g[i - 1], num_basis[i],
                                num_outputs[i])
                        else:
                            print("disabling ", str(4 - i))
                            w[i], l[i] = this.cat_dcoabc(
                                inputs[i], g[i - 1], num_basis[i],
                                num_outputs[i])
                        c1_1 = slim.conv2d(
                            tf.concat([g[i - 1], l[i]], axis=-1),
                            num_outputs[i], 1)
                        h[i] = slim.conv2d(c1_1, num_outputs[i], 3)
                    if i <= len(num_outputs) - 2:
                        g[i] = dogoo_ops.unpool(h[i])
                    else:
                        g[i] = slim.conv2d(h[i], num_outputs[i], 3)
                    print('Shape of h_{} {}, g_{} {}'.format(
                        i, h[i].shape, i, g[i].shape))
        return g