def build(self): model = Sequential() model.add(InputLayer(input_shape=INPUT_SHAPE, name="in")) encoder = Sequential(name="encoder") add_pool_convolution(encoder, 16, activation="prelu") add_pool_convolution(encoder, 32, activation="prelu") add_pool_convolution(encoder, 64, activation="prelu") add_pool_convolution(encoder, 128, activation="prelu") add_pool_convolution(encoder, 128, activation="prelu") model.add(encoder) decoder = Sequential(name="decoder") add_upsampling_convolution(decoder, 128, activation="prelu") add_upsampling_convolution(decoder, 128, activation="prelu") add_upsampling_convolution(decoder, 64, activation="prelu") add_upsampling_convolution(decoder, 32, activation="prelu") add_upsampling_convolution(decoder, 16, activation="prelu") add_convolution(decoder, INPUT_SHAPE[1]) # TODO: Add prelu model.add(decoder) model.compile(optimizer="adam", loss="mse", metrics=["acc"]) self.model = model self.build_encoder() self.build_decoder()
def build(self): model = Sequential() model.add(InputLayer(input_shape=(INPUT_COUNT, 1), name="in")) encoder = Sequential(name="encoder") add_pool_convolution(encoder, 32) add_pool_convolution(encoder, 64) add_pool_convolution(encoder, 128) add_pool_convolution(encoder, 256) encoder.add(Flatten()) add_fully_connected(encoder, BOTTLENECK_SIZE) model.add(encoder) decoder = Sequential(name="decoder") add_fully_connected(decoder, 1024 * 256) decoder.add(Reshape((1024, 256))) add_upsampling_convolution(decoder, 256) add_upsampling_convolution(decoder, 128) add_upsampling_convolution(decoder, 64) add_upsampling_convolution(decoder, 32) add_convolution(decoder, 1) model.add(decoder) model.summary() model.compile(optimizer="adam", loss="mse", metrics=["acc"]) self.model = model self.build_encoder() self.build_decoder()
def build(self): model = Sequential() model.add(InputLayer(input_shape=(INPUT_COUNT, 1), name="in")) encoder = Sequential(name="encoder") add_pool_convolution(encoder, 4) # TODO: Make prelu add_pool_convolution(encoder, 4) add_pool_convolution(encoder, 8) add_pool_convolution(encoder, 16) model.add(encoder) decoder = Sequential(name="decoder") add_upsampling_convolution(decoder, 16) add_upsampling_convolution(decoder, 8) add_upsampling_convolution(decoder, 4) add_upsampling_convolution(decoder, 4) add_convolution(decoder, 1) model.add(decoder) model.compile(optimizer="adam", loss="mse", metrics=["acc"]) self.model = model self.build_encoder() self.build_decoder()