history = model.fit( X=Xs["train"], y=ys["train"], batch_size=batch_size, nb_epoch=epochs, verbose=1, validation_data=(Xs["val"], ys["val"]), shuffle=True, show_accuracy=True, ) model.layers.pop() model.compile(optimizer=Adam(lr=lr), loss="binary_crossentropy") train_pred = model.predict(X=Xs["train"], batch_size=batch_size, verbose=0) val_pred = model.predict(X=Xs["val"], batch_size=batch_size, verbose=0) cou = 0 with open(args.last_layer_file, "w") as layer_file: for vec in train_pred: layer_file.write(",".join([str(i) for i in vec])) layer_file.write("\n") cou += 1 for vec in val_pred: layer_file.write(",".join([str(i) for i in vec])) layer_file.write("\n") cou += 1 print(cou) with open(args.last_layer_file + ".labels", "w") as label_file:
print("Model built") history = model.fit( X=Xs["train"], y=ys["train"], batch_size=batch_size, nb_epoch=epochs, verbose=1, validation_data=(Xs["val"], ys["val"]), shuffle=True, show_accuracy=True, ) model.layers.pop() model.compile(optimizer=Adam(lr=lr), loss="binary_crossentropy") train_pred = model.predict(X=Xs["train"], batch_size=batch_size, verbose=0) val_pred = model.predict(X=Xs["val"], batch_size=batch_size, verbose=0) cou = 0 with open(args.last_layer_file, "w") as layer_file: for vec in train_pred: layer_file.write(",".join([str(i) for i in vec])) layer_file.write("\n") cou += 1 for vec in val_pred: layer_file.write(",".join([str(i) for i in vec])) layer_file.write("\n") cou += 1 print(cou) with open(args.last_layer_file+".labels", "w") as label_file: for value in ys["train"]: