Example #1
0
        m.fit(X, Y, verbose=1, epochs=100, shuffle=True)
        # for e in range(20):
        #     goOn=input("Go on? y or n :")
        #     if goOn=='n':
        #         break

        m.save_weights(MODEL_FILE_NAME)

        # m.save(MODEL_FILE_NAME)

    yPred = m.predict(X)

    # yPred = yPred - np.min(yPred)
    # yPred = yPred / np.max(yPred + EPS)
    yPred = img_hndlr.inv_preprocess_images(yPred)
    yPred = yPred.astype(np.uint8)

    x1LayerOut = Model(xx, m.get_layer("X1").output).predict(X, verbose=1)
    x1LayerOut = x1LayerOut - np.min(x1LayerOut)
    x1LayerOut = x1LayerOut / np.max(x1LayerOut + EPS)
    x1LayerOut = img_hndlr.inv_preprocess_images(x1LayerOut).astype(np.uint8)
    x2LayerOut = Model(xx, m.get_layer("X2").output).predict(X, verbose=1)
    x2LayerOut = x2LayerOut - np.min(x2LayerOut)
    x2LayerOut = x2LayerOut / np.max(x2LayerOut + EPS)
    x2LayerOut = img_hndlr.inv_preprocess_images(x2LayerOut).astype(np.uint8)
    diffLayerOut = Model(xx, m.get_layer("DIFF").output).predict(X, verbose=1)
    diffLayerOut = diffLayerOut - np.min(diffLayerOut)
    diffLayerOut = diffLayerOut / np.max(diffLayerOut + EPS)
    diffLayerOut = img_hndlr.inv_preprocess_images(diffLayerOut).astype(
        np.uint8)