Esempio n. 1
0
    def __init__(self, opt={}):
        self.out_depth = opt['in_depth']
        self.out_sx = opt['in_sx']
        self.out_sy = opt['in_sy']
        self.num_inputs = opt['in_sx'] * opt['in_sy'] * opt['in_depth']
        self.layer_type = 'add'

        self.skip = getopt(opt, 'skip', 0)  # skip n activations in input
        self.delta = getopt(opt, 'delta', [0] * self.num_inputs)
        self.num_neurons = getopt(opt, 'num_neurons', self.num_inputs)
Esempio n. 2
0
    def __init__(self, opt={}):
        self.out_depth = opt['in_depth']
        self.out_sx = opt['in_sx']
        self.out_sy = opt['in_sy']
        self.num_inputs = opt['in_sx'] * opt['in_sy'] * opt['in_depth']
        self.layer_type = 'add'

        self.skip = getopt(opt, 'skip', 0) # skip n activations in input
        self.delta = getopt(opt, 'delta', [0] * self.num_inputs)
        self.num_neurons = getopt(opt, 'num_neurons', self.num_inputs)
Esempio n. 3
0
    def __init__(self, opt={}):
        self.out_depth = opt['num_neurons']
        self.l1_decay_mul = getopt(opt, 'l1_decay_mul', 0.0)
        self.l2_decay_mul = getopt(opt, 'l2_decay_mul', 1.0)

        self.num_inputs = opt['in_sx'] * opt['in_sy'] * opt['in_depth']
        self.out_sx = 1
        self.out_sy = 1
        self.layer_type = 'fc'

        bias = getopt(opt, 'bias_pref', 0.0)
        self.filters = [ Vol(1, 1, self.num_inputs) for i in xrange(self.out_depth) ]
        self.biases = Vol(1, 1, self.out_depth, bias)
Esempio n. 4
0
    def __init__(self, opt={}):
        self.out_depth = opt['num_neurons']
        self.l1_decay_mul = getopt(opt, 'l1_decay_mul', 0.0)
        self.l2_decay_mul = getopt(opt, 'l2_decay_mul', 1.0)

        self.num_inputs = opt['in_sx'] * opt['in_sy'] * opt['in_depth']
        self.out_sx = 1
        self.out_sy = 1
        self.layer_type = 'sim'

        bias = getopt(opt, 'bias_pref', 0.0)
        self.filters = [ Vol(1, 1, self.num_inputs) for i in xrange(self.out_depth) ]
        self.biases = Vol(1, 1, self.out_depth, bias)
Esempio n. 5
0
 def __init__(self, opt={}):
     self.group_size = getopt(opt, 'group_size', 2)
     self.out_sx = opt['in_sx']
     self.out_sy = opt['in_sy']
     self.out_depth = opt['in_depth'] / self.group_size
     self.layer_type = 'maxout'
     self.switches = zeros(self.out_sx * self.out_sy * self.out_depth)
Esempio n. 6
0
 def __init__(self, opt={}):
     self.out_sx = opt['in_sx']
     self.out_sy = opt['in_sy']
     self.out_depth = opt['in_depth']
     self.layer_type = 'dropout'
     self.drop_prob = getopt(opt, 'drop_prob', 0.5)
     self.dropped = zeros(self.out_sx * self.out_sy * self.out_depth)
Esempio n. 7
0
 def __init__(self, opt={}):
     self.group_size = getopt(opt, 'group_size', 2)
     self.out_sx = opt['in_sx']
     self.out_sy = opt['in_sy']
     self.out_depth = opt['in_depth'] / self.group_size
     self.layer_type = 'maxout'
     self.switches = zeros(self.out_sx * self.out_sy * self.out_depth)
Esempio n. 8
0
    def __init__(self, opt={}):
        self.out_sx = opt['in_sx']
        self.out_sy = opt['in_sy']
        self.out_depth = opt['in_depth']

        self.zeta = getopt(opt, 'zeta', 1.0)
        if self.zeta == 0.0:
            print 'WARNING: zeta cannot equal 0'

        self.layer_type = 'mex'
Esempio n. 9
0
    def __init__(self, opt={}):
        self.sx = opt['sx'] # filter size
        self.in_depth = opt['in_depth']
        self.in_sx = opt['in_sx']
        self.in_sy = opt['in_sy']

        # optional
        self.sy = getopt(opt, 'sy', self.sx)
        self.stride = getopt(opt, 'stride', 2)
        self.pad = getopt(opt, 'pad', 0) # padding to borders of input volume

        self.out_depth = self.in_depth
        self.out_sx = int(floor((self.in_sx - self.sx + 2 * self.pad) / self.stride + 1))
        self.out_sy = int(floor((self.in_sy - self.sy + 2 * self.pad) / self.stride + 1))
        self.layer_type = 'pool'

        # Store switches for x,y coordinates for where the max comes from, for each output neuron
        switch_size = self.out_sx * self.out_sy * self.out_depth
        self.switch_x = zeros(switch_size)
        self.switch_y = zeros(switch_size)
Esempio n. 10
0
    def __init__(self, opt={}):
        self.out_depth = opt['filters']
        self.sx = opt['sx'] # filter size: should be odd if possible
        self.in_depth = opt['in_depth']
        self.in_sx = opt['in_sx']
        self.in_sy = opt['in_sy']

        # optional
        self.sy = getopt(opt, 'sy', self.sx)
        self.stride = getopt(opt, 'stride', 1) # stride at which we apply filters to input volume
        self.pad = getopt(opt, 'pad', 0) # padding to borders of input volume
        self.l1_decay_mul = getopt(opt, 'l1_decay_mul', 0.0)
        self.l2_decay_mul = getopt(opt, 'l2_decay_mul', 1.0)

        """
        Note we are doing floor, so if the strided convolution of the filter doesnt fit into the input
        volume exactly, the output volume will be trimmed and not contain the (incomplete) computed
        final application.
        """
        self.out_sx = int(floor((self.in_sx - self.sx + 2 * self.pad) / self.stride + 1))
        self.out_sy = int(floor((self.in_sy - self.sy + 2 * self.pad) / self.stride + 1))
        self.layer_type = 'conv'

        bias = getopt(opt, 'bias_pref', 0.0)
        self.filters = [ Vol(self.sx, self.sy, self.in_depth) for i in xrange(self.out_depth) ]
        self.biases = Vol(1, 1, self.out_depth, bias)
Esempio n. 11
0
    def __init__(self, opt={}):
        self.out_depth = opt['filters']
        self.sx = opt['sx']  # filter size: should be odd if possible
        self.in_depth = opt['in_depth']
        self.in_sx = opt['in_sx']
        self.in_sy = opt['in_sy']

        # optional
        self.sy = getopt(opt, 'sy', self.sx)
        self.stride = getopt(
            opt, 'stride',
            1)  # stride at which we apply filters to input volume
        self.pad = getopt(opt, 'pad', 0)  # padding to borders of input volume
        self.l1_decay_mul = getopt(opt, 'l1_decay_mul', 0.0)
        self.l2_decay_mul = getopt(opt, 'l2_decay_mul', 1.0)
        """
        Note we are doing floor, so if the strided convolution of the filter doesnt fit into the input
        volume exactly, the output volume will be trimmed and not contain the (incomplete) computed
        final application.
        """
        self.out_sx = int(
            floor((self.in_sx - self.sx + 2 * self.pad) / self.stride + 1))
        self.out_sy = int(
            floor((self.in_sy - self.sy + 2 * self.pad) / self.stride + 1))
        self.layer_type = 'conv'

        bias = getopt(opt, 'bias_pref', 0.0)
        self.filters = [
            Vol(self.sx, self.sx, self.in_depth)
            for i in xrange(self.out_depth)
        ]
        self.biases = Vol(1, 1, self.out_depth, bias)