Exemplo n.º 1
0
  def __init__(self, test_id, data_dir, provider, checkpoint_dir, train_range, test_range, test_freq,
      save_freq, batch_size, num_epoch, image_size, image_color, learning_rate,  params):

    self.origin_test_range = test_range
    if len(test_range) != 1:
      test_range = [test_range[0]]
    AutoStopTrainer.__init__(self, test_id, data_dir, provider, checkpoint_dir, train_range, test_range, test_freq,
        save_freq, batch_size, num_epoch, image_size, image_color, learning_rate, False)

    self.conv_params = []
    self.fc_params = []
    self.softmax_param = None

    self.params = params

    conv = True
    for ld in self.params:
      if ld['type'] in ['conv', 'rnorm', 'pool', 'neuron'] and conv:
        self.conv_params.append(ld)
      elif ld['type'] == 'fc' or (not conv and ld['type'] == 'neuron'):
        self.fc_params.append(ld)
        conv = False
      else:
        self.softmax_param = ld

    self.conv_stack = FastNet.split_conv_to_stack(self.conv_params)
    self.fc_stack = FastNet.split_fc_to_stack(self.fc_params)

    pprint.pprint(self.conv_stack)
    pprint.pprint(self.fc_stack)

    self.fakefc_param = self.fc_stack[-1][0]
Exemplo n.º 2
0
    def _finish_init(self):
        self.curr_model = []
        self.complete_model = self.init_model
        self.fc_params = []
        self.conv_params = []
        self.final_num_epoch = self.num_epoch

        conv = True
        for ld in self.init_model:
            if ld['type'] in ['conv', 'rnorm', 'pool', 'neuron'] and conv:
                #self.conv_params.append(ld)
                self.curr_model.append(ld)
            elif ld['type'] == 'fc' or (not conv and ld['type'] == 'neuron'):
                self.fc_params.append(ld)
                conv = False
            else:
                self.softmax_param = ld

        #self.conv_stack = FastNet.split_conv_to_stack(self.conv_params)
        #for i in range(3):
        #  self.curr_model.extend(self.conv_stack[i])

        self.fc_stack = FastNet.split_fc_to_stack(self.fc_params)
        #tmp = self.conv_stack[3:]
        #tmp.extend(self.fc_stack)
        #self.stack = tmp
        self.stack = self.fc_stack

        self.curr_model.append(self.stack[-1][0])
        self.curr_model.append(self.softmax_param)
        del self.stack[-1]
        pprint.pprint(self.stack)

        self.layerwised = True
        self.num_epoch = 1
        self.net = FastNet(self.learning_rate, self.image_shape,
                           self.curr_model)
Exemplo n.º 3
0
  def _finish_init(self):
    self.curr_model = []
    self.complete_model = self.init_model
    self.fc_params = []
    self.conv_params = []
    self.final_num_epoch = self.num_epoch

    conv = True
    for ld in self.init_model:
      if ld['type'] in ['conv', 'rnorm', 'pool', 'neuron'] and conv:
        #self.conv_params.append(ld)
        self.curr_model.append(ld)
      elif ld['type'] == 'fc' or (not conv and ld['type'] == 'neuron'):
        self.fc_params.append(ld)
        conv = False
      else:
        self.softmax_param = ld

    #self.conv_stack = FastNet.split_conv_to_stack(self.conv_params)
    #for i in range(3):
    #  self.curr_model.extend(self.conv_stack[i])

    self.fc_stack = FastNet.split_fc_to_stack(self.fc_params)
    #tmp = self.conv_stack[3:]
    #tmp.extend(self.fc_stack)
    #self.stack = tmp
    self.stack = self.fc_stack

    self.curr_model.append(self.stack[-1][0])
    self.curr_model.append(self.softmax_param)
    del self.stack[-1]
    pprint.pprint(self.stack)

    self.layerwised = True
    self.num_epoch = 1
    self.net = FastNet(self.learning_rate, self.image_shape, self.curr_model)