Skip to content
Snippets Groups Projects
Commit 538a42c3 authored by lukas leufen's avatar lukas leufen
Browse files

refac but now docs yet

parent 7af779f2
No related branches found
No related tags found
3 merge requests!125Release v0.10.0,!124Update Master to new version v0.10.0,!91WIP: Resolve "create sphinx docu"
Pipeline #35421 passed
...@@ -9,7 +9,20 @@ import keras ...@@ -9,7 +9,20 @@ import keras
def flatten_tail(input_X: keras.layers, name: str, bound_weight: bool = False, dropout_rate: float = 0.0, def flatten_tail(input_X: keras.layers, name: str, bound_weight: bool = False, dropout_rate: float = 0.0,
window_lead_time: int = 4, activation: Callable = keras.activations.relu, window_lead_time: int = 4, activation: Callable = keras.activations.relu,
reduction_filter: int = 64, first_dense: int = 64): reduction_filter: int = 64, first_dense: int = 64):
"""
Flatten output of
:param input_X:
:param name:
:param bound_weight:
:param dropout_rate:
:param window_lead_time:
:param activation:
:param reduction_filter:
:param first_dense:
:return:
"""
X_in = keras.layers.Conv2D(reduction_filter, (1, 1), padding='same', name='{}_Conv_1x1'.format(name))(input_X) X_in = keras.layers.Conv2D(reduction_filter, (1, 1), padding='same', name='{}_Conv_1x1'.format(name))(input_X)
X_in = activation(name='{}_conv_act'.format(name))(X_in) X_in = activation(name='{}_conv_act'.format(name))(X_in)
......
...@@ -5,7 +5,8 @@ import logging ...@@ -5,7 +5,8 @@ import logging
import keras import keras
import keras.layers as layers import keras.layers as layers
from src.model_modules.advanced_paddings import PadUtils, ReflectionPadding2D, SymmetricPadding2D, Padding2D
from src.model_modules.advanced_paddings import PadUtils, ReflectionPadding2D, Padding2D
class InceptionModelBase: class InceptionModelBase:
...@@ -22,6 +23,7 @@ class InceptionModelBase: ...@@ -22,6 +23,7 @@ class InceptionModelBase:
def block_part_name(self): def block_part_name(self):
""" """
Use unicode due to some issues of keras with normal strings Use unicode due to some issues of keras with normal strings
:return: :return:
""" """
return chr(self.ord_base + self.part_of_block) return chr(self.ord_base + self.part_of_block)
...@@ -41,6 +43,7 @@ class InceptionModelBase: ...@@ -41,6 +43,7 @@ class InceptionModelBase:
""" """
This function creates a "convolution tower block" containing a 1x1 convolution to reduce filter size followed by This function creates a "convolution tower block" containing a 1x1 convolution to reduce filter size followed by
convolution with given filter and kernel size convolution with given filter and kernel size
:param input_x: Input to network part :param input_x: Input to network part
:param reduction_filter: Number of filters used in 1x1 convolution to reduce overall filter size before conv. :param reduction_filter: Number of filters used in 1x1 convolution to reduce overall filter size before conv.
:param tower_filter: Number of filters for n x m convolution :param tower_filter: Number of filters for n x m convolution
...@@ -137,6 +140,7 @@ class InceptionModelBase: ...@@ -137,6 +140,7 @@ class InceptionModelBase:
def create_pool_tower(self, input_x, pool_kernel, tower_filter, activation='relu', max_pooling=True, **kwargs): def create_pool_tower(self, input_x, pool_kernel, tower_filter, activation='relu', max_pooling=True, **kwargs):
""" """
This function creates a "MaxPooling tower block" This function creates a "MaxPooling tower block"
:param input_x: Input to network part :param input_x: Input to network part
:param pool_kernel: size of pooling kernel :param pool_kernel: size of pooling kernel
:param tower_filter: Number of filters used in 1x1 convolution to reduce filter size :param tower_filter: Number of filters used in 1x1 convolution to reduce filter size
...@@ -172,6 +176,7 @@ class InceptionModelBase: ...@@ -172,6 +176,7 @@ class InceptionModelBase:
def inception_block(self, input_x, tower_conv_parts, tower_pool_parts, **kwargs): def inception_block(self, input_x, tower_conv_parts, tower_pool_parts, **kwargs):
""" """
Crate a inception block Crate a inception block
:param input_x: Input to block :param input_x: Input to block
:param tower_conv_parts: dict containing settings for parts of inception block; Example: :param tower_conv_parts: dict containing settings for parts of inception block; Example:
tower_conv_parts = {'tower_1': {'reduction_filter': 32, tower_conv_parts = {'tower_1': {'reduction_filter': 32,
...@@ -302,5 +307,3 @@ if __name__ == '__main__': ...@@ -302,5 +307,3 @@ if __name__ == '__main__':
keras.utils.plot_model(model, to_file='model.pdf', show_shapes=True, show_layer_names=True) keras.utils.plot_model(model, to_file='model.pdf', show_shapes=True, show_layer_names=True)
# model.fit(X_train, y_train, epochs=epochs, validation_data=(X_test, y_test)) # model.fit(X_train, y_train, epochs=epochs, validation_data=(X_test, y_test))
print('test') print('test')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment