x = UpSampling1D(2)(x) out = Conv1D(6, kernel1, activation='softmax', padding='same')(x) outputs.append(out) outputs.append(y_out) # x = Conv1D(6, 20, activation="relu", padding='same')(x) autoencoder = Model(inputs, outputs) autoencoder.compile(optimizer='adam', loss='categorical_crossentropy') return autoencoder def autocorr(x): result = np.correlate(x, x, mode='full') return result[len(result) // 2:] if __name__ == "__main__": import numpy as np MODEL_PATH = "triple_binary_detection" model = build_triple_detection_network((4096, 1)) plot_model(model) model = load_model("models\\" + MODEL_PATH + "_ma.h5") model.summary() X = load_good_holter() model = train_eval(model, X, only_eval=True, save_path=MODEL_PATH, generator=artefact_for_detection_3_in_2_out, size=4096, epochs=50)
if name == "dual_detection": generator = artefact_for_detection_dual elif name == "triple_detection": generator = artefact_for_detection_3_in_2_out else: generator = artefact_for_detection res, _ = load_split() path = "C:\\Users\\donte_000\\Downloads\\Telegram Desktop\\noise_lbl.csv" idxs = pd.read_csv(path, encoding='utf-8', sep=";")['i'] X = load_dataset()["x"] x = X[np.where(idxs == 0, True, False), :, 0] x = np.expand_dims(x, 2) res1 = [0, 0] res1[0], res1[1] = train_test_split(x, test_size=0.25, random_state=42) res2 = load_good_holter() res3 = [0, 0] X = load_mit() res3[0], res3[1] = train_test_split(X, test_size=0.1, random_state=32) train_eval(model, (res1[0], res1[1]), only_eval=True, save_path=name + "_mit_test2", generator=generator, size=4096, epochs=100, noise_prob=[1 / 5, 1 / 5, 1 / 5, 1 / 5, 1 / 5, 0], noise_type='em')