def call(self, x): real = utils.GetReal()(x) imag = utils.GetImag()(x) abs1 = K.relu(utils.GetAbs()(x)) abs2 = K.relu(utils.GetAbs()(x) - self._b) real = real * abs2 / (abs1+0.0000001) imag = imag * abs2 / (abs1+0.0000001) merged = Concatenate()([real, imag]) return merged
def network_200_modrelu_short_shared(data_input, classes_num=10, weight_decay = 1e-4): ''' Network that gets 99% acc on 20 MHz WiFi-2 data without channel ''' convArgs = dict(use_bias=True, kernel_regularizer=l2(weight_decay), spectral_parametrization=False, kernel_initializer='complex_independent') model_name = "MODEL:" ######################## filters = 100 k_size = 200 strides = 100 o = ComplexConv1D(filters=filters, kernel_size=[k_size], strides=strides, padding='valid', activation=None, name="ComplexConv1", **convArgs)(data_input) model_name = model_name + "-" + str(filters) + "C" + str(k_size) + "x" + str(strides) ######################## ######################## o = Modrelu(name="ModRelu1")(o) model_name = model_name + "-ModReLU" ######################## ######################## filters = 100 k_size = 10 strides = 1 o = ComplexConv1D(filters=filters, kernel_size=[k_size], strides=strides, padding='valid', activation=None, name="ComplexConv2", **convArgs)(o) model_name = model_name + "-" + str(filters) + "C" + str(k_size) + "x" + str(strides) ######################### ######################## o = Modrelu(name="ModRelu2")(o) model_name = model_name + "-ModReLU" ######################## ######################## o = utils.GetAbs(name="Abs")(o) model_name = model_name + "-Abs" ######################## ######################## neuron_num = 100 shared_dense = Dense(neuron_num, activation='relu', kernel_initializer="he_normal", kernel_regularizer=l2(weight_decay), name="Shared_Dense1") model_name = model_name + "-" + str(neuron_num) + "shared_D" ######################## o = shared_dense(o) ######################## neuron_num = 100 shared_dense2 = Dense(neuron_num, activation='relu', kernel_initializer="he_normal", kernel_regularizer=l2(weight_decay), name="Shared_Dense2") model_name = model_name + "-" + str(neuron_num) + "shared_D" ######################## o = shared_dense2(o) ######################## o = GlobalAveragePooling1D(name="Avg")(o) model_name = model_name + "-Avg" ######################## x = Dense(classes_num, activation='softmax', kernel_initializer="he_normal", name="Dense3")(o) return x , model_name