best_lips_IoU_ft = [
    77, 79, 120, 104, 141, 0, 34, 125, 15, 89, 49, 237, 174, 39, 210, 112, 111,
    201, 149, 165, 80, 42, 128, 74, 131, 193, 133, 44, 154, 101, 173, 6, 148,
    61, 27, 249, 209, 19, 247, 90, 1, 255, 182, 251, 186, 248
]

# load config
config = load_config(config_path, path='configs/norm_base_config')

# create directory if non existant
save_path = os.path.join("models/saved", config["config_name"])
if not os.path.exists(save_path):
    os.mkdir(save_path)

# load and define model
v4_model = load_extraction_model(config,
                                 input_shape=tuple(config["input_shape"]))
v4_model = tf.keras.Model(inputs=v4_model.input,
                          outputs=v4_model.get_layer(
                              config['v4_layer']).output)
size_ft = tuple(np.shape(v4_model.output)[1:3])
print("[LOAD] size_ft", size_ft)
print("[LOAD] Model loaded")
print()

nb_model = NormBase(config, tuple(config['input_shape']))
# -------------------------------------------------------------------------------------------------------------------
# train

# load data
data = load_data(config)
    # df["category"] = df["category"].astype(int)

    # get only human c2 = category 1
    category = "1"
    df = df[df['category'].isin([category])]

    # load data
    data = load_from_csv(df, config)
    print("shape data", np.shape(data[0]))

    sequence = np.copy(data[0])
    data[0] = tf.keras.applications.vgg19.preprocess_input(data[0])

    # declare model
    config["v4_layer"] = "block3_pool"
    model = load_extraction_model(config, tuple(config['input_shape']))
    model = tf.keras.Model(inputs=model.input,
                           outputs=model.get_layer(config['v4_layer']).output)

    # predict model
    preds = model.predict(data)
    print("shape preds", np.shape(preds))

    # # plot feature maps
    # plot_cnn_output(preds, os.path.join("models/saved", config["config_name"]),
    #                 config['v4_layer'] + ".gif",
    #                 image=raw_data,
    #                 video=True)

    # test model
    test_features_map_variability(preds, sequence, "06_" + config["v4_layer"])