def __init__(self, config, scaling_factor, dropout): super( Deep128NoiseMsDiscS2Alternative.Discriminator. MultiscaleDisc, self).__init__() assert scaling_factor > 0 if scaling_factor != 1: size_x = int(128 * scaling_factor) size_y = int(128 * scaling_factor) tf.logging.info( "Multiscale discriminator operating on resolution: {}x{}" .format(size_x, size_y)) self.resize = lambda x: tf.image.resize_nearest_neighbor( x, (size_x, size_y)) else: tf.logging.info( "Multiscale discriminator operating on regular resolution" ) self.resize = lambda x: x initial_filters = 32 * 1 self.blocks = [ ConvBlock(initial_filters * 1, 4, 2), ConvBlock(initial_filters * 2, 4, 2), ConvBlock(initial_filters * 4, 4, 2), ConvBlock(initial_filters * 8, 4, 2), ] self.dropout = dropout self.flatten = Flatten() # self.pre_fc = Dense(1000, use_bias=False) self.fc = Dense(config.discriminator_classes, use_bias=False)
def __init__(self, config, scaling_factor, dropout): super(Deep240pTo480p.Discriminator.MultiscaleDisc, self).__init__() assert scaling_factor > 0 if scaling_factor != 1: size_x = int(640 * scaling_factor) size_y = int(480 * scaling_factor) tf.logging.info( "Multiscale discriminator operating on resolution: {}x{}" .format(size_x, size_y)) self.resize = lambda x: tf.image.resize_nearest_neighbor( x, (size_x, size_y)) else: tf.logging.info( "Multiscale discriminator operating on regular resolution" ) self.resize = lambda x: x initial_filters = 32 // 1 self.blocks = [ ConvBlock(initial_filters * 2, 5, 2), ConvBlock(initial_filters * 2, 5, 1), ConvBlock(initial_filters * 4, 5, 2), ConvBlock(initial_filters * 4, 5, 1), ConvBlock(initial_filters * 8, 5, 2), ConvBlock(initial_filters * 8, 5, 1), ConvBlock(initial_filters * 16, 5, 2), ConvBlock(initial_filters * 16, 5, 1), ] self.dropout = dropout self.flatten = Flatten() self.fc = Dense(config.discriminator_classes, use_bias=False)
def __init__(self, config): super(Deep240pTo480p.Generator, self).__init__() initial_filters = 1024 // 4 self.blocks = [ ConvBlock(initial_filters * 1, 5, 1), ConvBlock(initial_filters * 2, 5, 1), DeconvBlock(initial_filters * 4, 5, 2), ConvBlock(initial_filters * 2, 5, 1), ConvBlock(initial_filters * 1, 5, 1), ] self.final_conv = Conv(3 if config.has_colored_target else 1, 5, 1) self._low_res_generator = None
def __init__(self, config): super(Deep480NoiseS2.Discriminator, self).__init__() initial_filters = 32 // 2 * 1 self.blocks = [ ConvBlock(initial_filters * 2, 4, 2), ConvBlock(initial_filters * 4, 4, 2), ConvBlock(initial_filters * 8, 4, 2), ConvBlock(initial_filters * 16, 4, 2), ConvBlock(initial_filters * 32, 4, 2), ] self.dropout = Dropout(0.3) self.flatten = Flatten() self.fc = Dense(config.discriminator_classes, use_bias=False)
def __init__(self, config): super(Deep480NoiseS2.Generator, self).__init__() initial_filters = int(512 / 32) * 1 self.fc = tf.keras.layers.Dense(15 * 15 * 64, use_bias=False) self.initial_norm = tf.keras.layers.BatchNormalization() self.blocks = [ DeconvBlock(initial_filters * 32, 5, 2), ConvBlock(initial_filters * 16, 5, 1), DeconvBlock(initial_filters * 16, 5, 2), ConvBlock(initial_filters * 8, 5, 1), DeconvBlock(initial_filters * 8, 5, 2), ConvBlock(initial_filters * 4, 5, 1), DeconvBlock(initial_filters * 4, 5, 2), ConvBlock(initial_filters * 2, 5, 1), DeconvBlock(initial_filters * 2, 5, 2), ConvBlock(initial_filters * 1, 5, 1), ] self.final_conv = Conv(3 if config.has_colored_target else 1, 5, 1)