コード例 #1
0
    def __init__(self, opt):
        super().__init__()
        with self.init_scope():
            self.detecter = L.VGG16Layers().to_gpu(0)
            self.layer_names = ['conv1_2', 'conv2_2', 'conv3_3', 'conv4_3', 'conv5_3']

            if opt.perceptual_model == 'VGG19':
                self.detecter = L.VGG19Layers().to_gpu(0)
                self.layer_name = ['conv1_2', 'conv2_2', 'conv3_4', 'conv4_4', 'conv5_4']

        self.weight = [32 ** -1,
                       16 ** -1,
                       8 ** -1,
                       4 ** -1,
                       1]

        self.coef = opt.perceptual_coef
        self.criterion = F.mean_absolute_error

        if opt.perceptual_mode == 'MAE':
            self.criterion = F.mean_absolute_error

        if opt.perceptual_mode == 'MSE':
            self.criterion = F.mean_squared_error
            self.coef *= 0.5
コード例 #2
0
ファイル: zoo.py プロジェクト: Zhaojp-Frank/recompute
def get_vgg19(batchsize):
    model = L.VGG19Layers(pretrained_model=None)
    model = Wrapper(model, 'fc8')
    x = np.random.uniform(size=(batchsize, 3, 224, 224)).astype('f')
    x = chainer.as_variable(x)
    t = np.random.randint(size=(batchsize, ), low=0,
                          high=1000).astype(np.int32)
    t = chainer.as_variable(t)

    return [x, t], model
コード例 #3
0
 def __init__(self, last_only=False):
     super(VGG, self).__init__()
     self.last_only = last_only
     with self.init_scope():
         self.base = L.VGG19Layers()
コード例 #4
0
    def __init__(self):
        super(VGG, self).__init__()

        with self.init_scope():
            self.base = L.VGG19Layers()