Exemplo n.º 1
0
def get_trainer_by_name(name, param_dict, rest_args):
  if name == 'normal':
    param_dict['num_epoch'] = args.num_epoch
    return Trainer(**param_dict)

  num_minibatch = util.string_to_int_list(args.num_minibatch)
  if len(num_minibatch) == 1:
    param_dict['num_minibatch'] = num_minibatch[0]
  else:
    param_dict['num_minibatch'] = num_minibatch

  if name == 'minibatch':
    return MiniBatchTrainer(**param_dict)

  if name == 'catewise':
    param_dict['num_caterange_list'] = util.string_to_int_list(args.num_caterange_list)
    return ImageNetCatewisedTrainer(**param_dict)

  if name == 'categroup':
    param_dict['num_group_list'] = util.string_to_int_list(args.num_group_list)
    return ImageNetCateGroupTrainer(**param_dict)
  
  raise Exception, 'No trainer found for name: %s' % name
Exemplo n.º 2
0
        if not getattr(args, a) and a not in extra_argument:
            assert False, 'You have to specify a value of %s' % a

    param_dict = {}
    param_dict['image_color'] = 3
    param_dict['test_id'] = args.test_id
    param_dict['data_dir'] = args.data_dir
    param_dict['data_provider'] = args.data_provider
    if args.data_provider.startswith('imagenet'):
        param_dict['image_size'] = 224
    elif args.data_provider.startswith('cifar'):
        param_dict['image_size'] = 32
    else:
        assert False, 'Unknown data_provider %s' % args.data_provider

    param_dict['train_range'] = util.string_to_int_list(args.train_range)
    param_dict['test_range'] = util.string_to_int_list(args.test_range)
    param_dict['save_freq'] = args.save_freq
    param_dict['test_freq'] = args.test_freq
    param_dict['adjust_freq'] = args.adjust_freq
    factor = util.string_to_float_list(args.factor)
    if len(factor) == 1:
        param_dict['factor'] = factor[0]
    else:
        param_dict['factor'] = factor

    learning_rate = util.string_to_float_list(args.learning_rate)
    if len(learning_rate) == 1:
        param_dict['learning_rate'] = learning_rate[0]
    else:
        param_dict['learning_rate'] = learning_rate
Exemplo n.º 3
0
      assert False, 'You have to specify a value of %s' % a


  param_dict = {}
  param_dict['image_color'] = 3
  param_dict['test_id'] = args.test_id
  param_dict['data_dir'] = args.data_dir
  param_dict['data_provider'] = args.data_provider
  if args.data_provider.startswith('imagenet'):
    param_dict['image_size'] = 224
  elif args.data_provider.startswith('cifar'):
    param_dict['image_size'] = 32
  else:
    assert False, 'Unknown data_provider %s' % args.data_provider

  param_dict['train_range'] = util.string_to_int_list(args.train_range)
  param_dict['test_range'] = util.string_to_int_list(args.test_range)
  param_dict['save_freq'] = args.save_freq
  param_dict['test_freq'] = args.test_freq
  param_dict['adjust_freq'] = args.adjust_freq
  factor = util.string_to_float_list(args.factor)
  if len(factor) == 1:
    param_dict['factor'] = factor[0]
  else:
    param_dict['factor'] = factor


  learning_rate = util.string_to_float_list(args.learning_rate)
  if len(learning_rate) == 1:
    param_dict['learning_rate'] = learning_rate[0]
  else:
Exemplo n.º 4
0
      assert False, 'You have to specify a value of %s' % a


  param_dict = {}
  param_dict['image_color'] = 3
  param_dict['test_id'] = args.test_id
  param_dict['data_dir'] = args.data_dir
  param_dict['data_provider'] = args.data_provider
  if args.data_provider.startswith('imagenet'):
    param_dict['image_size'] = 224
  elif args.data_provider.startswith('cifar'):
    param_dict['image_size'] = 32
  else:
    assert False, 'Unknown data_provider %s' % args.data_provider
 
  param_dict['train_range'] = util.string_to_int_list(args.train_range)
  param_dict['test_range'] = util.string_to_int_list(args.test_range)
  util.log('%s %s', args.test_range, param_dict['test_range'])
  param_dict['save_freq'] = args.save_freq
  param_dict['test_freq'] = args.test_freq
  param_dict['adjust_freq'] = args.adjust_freq
  factor = util.string_to_float_list(args.factor)
  if len(factor) == 1:
    param_dict['factor'] = factor[0]
  else:
    param_dict['factor'] = factor


  learning_rate = util.string_to_float_list(args.learning_rate)
  if len(learning_rate) == 1:
    param_dict['learning_rate'] = learning_rate[0]