LocalEnhancer¶
Inheritance Diagram

-
class
ashpy.models.convolutional.pix2pixhd.
LocalEnhancer
(input_res=512, min_res=64, initial_filters=64, filters_cap=512, channels=3, normalization_layer=<class 'ashpy.layers.instance_normalization.InstanceNormalization'>, non_linearity=<class 'tensorflow.python.keras.layers.advanced_activations.ReLU'>, num_resnet_blocks_global=9, num_resnet_blocks_local=3, kernel_size_resnet=3, kernel_size_front_back=7, num_internal_resnet_blocks=2)[source]¶ Bases:
tensorflow.python.keras.engine.training.Model
Local Enhancer module of the Pix2PixHD architecture.
Example
# instantiate the model model = LocalEnhancer() # call the model passing inputs inputs = tf.ones((1, 512, 512, 3)) output = model(inputs) # the output shape is # the same as the input shape print(output.shape)
(1, 512, 512, 3)
Methods
__init__
([input_res, min_res, …])Build the LocalEnhancer module of the Pix2PixHD architecture. call
(inputs[, training])Call the LocalEnhancer model. Attributes
activity_regularizer
Optional regularizer function for the output of this layer. dtype
dynamic
inbound_nodes
Deprecated, do NOT use! Only for compatibility with external Keras. input
Retrieves the input tensor(s) of a layer. input_mask
Retrieves the input mask tensor(s) of a layer. input_shape
Retrieves the input shape(s) of a layer. input_spec
Gets the network’s input specs. layers
losses
Losses which are associated with this Layer. metrics
Returns the model’s metrics added using compile, add_metric APIs. metrics_names
Returns the model’s display labels for all outputs. name
Returns the name of this module as passed or determined in the ctor. name_scope
Returns a tf.name_scope instance for this class. non_trainable_variables
non_trainable_weights
outbound_nodes
Deprecated, do NOT use! Only for compatibility with external Keras. output
Retrieves the output tensor(s) of a layer. output_mask
Retrieves the output mask tensor(s) of a layer. output_shape
Retrieves the output shape(s) of a layer. run_eagerly
Settable attribute indicating whether the model should run eagerly. sample_weights
state_updates
Returns the updates from all layers that are stateful. stateful
submodules
Sequence of all sub-modules. trainable
trainable_variables
Sequence of variables owned by this module and it’s submodules. trainable_weights
updates
variables
Returns the list of all layer variables/weights. weights
Returns the list of all layer variables/weights. -
__init__
(input_res=512, min_res=64, initial_filters=64, filters_cap=512, channels=3, normalization_layer=<class 'ashpy.layers.instance_normalization.InstanceNormalization'>, non_linearity=<class 'tensorflow.python.keras.layers.advanced_activations.ReLU'>, num_resnet_blocks_global=9, num_resnet_blocks_local=3, kernel_size_resnet=3, kernel_size_front_back=7, num_internal_resnet_blocks=2)[source]¶ Build the LocalEnhancer module of the Pix2PixHD architecture.
See High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs [2] for more details.
Parameters: - input_res (int) – input resolution.
- min_res (int) – minimum resolution reached by the global generator.
- initial_filters (int) – number of initial filters.
- filters_cap (int) – maximum number of filters.
- channels (int) – number of channels.
- normalization_layer (
tf.keras.layers.Layer
) – layer of normalization - Instance Normalization or BatchNormalization or LayerNormalization) ((e.g.) –
- non_linearity (
tf.keras.layers.Layer
) – non linearity used in Pix2Pix HD. - num_resnet_blocks_global (int) – number of residual blocks used in the global generator.
- num_resnet_blocks_local (int) – number of residual blocks used in the local generator.
- kernel_size_resnet (int) – kernel size used in resnets.
- kernel_size_front_back (int) – kernel size used for the front and back convolution.
- num_internal_resnet_blocks (int) – number of internal blocks of the resnet.
[2] High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs https://arxiv.org/abs/1711.11585
-