def load_data_hf5(params,val_percent, test_percent):
    hdf5_file = common.PATCHES_DIR+"/patches_train_%s_%s.hdf5" % (params['dataset']['dataset'],params['dataset']['window'])
    f = h5py.File(hdf5_file,"r")
    N = f["targets"].shape[0]
    f.close()
    train_percent = 1 - val_percent - test_percent
    N_train = int(train_percent * N)
    N_val = int(val_percent * N)
    X_train = HDF5Matrix(hdf5_file, 'features', start=0, end=N_train)
    Y_train = HDF5Matrix(hdf5_file, 'targets', start=0, end=N_train)
    X_val = HDF5Matrix(hdf5_file, 'features', start=N_train, end=N_train+N_val)
    Y_val = HDF5Matrix(hdf5_file, 'targets', start=N_train, end=N_train+N_val)
    X_test = HDF5Matrix(hdf5_file, 'features', start=N_train+N_val, end=N)
    Y_test = HDF5Matrix(hdf5_file, 'targets', start=N_train+N_val, end=N)
    return X_train, Y_train, X_val, Y_val, X_test, Y_test, N_train