Exemplo n.º 1
0
if __name__ == '__main__':

    MEAN_FACTOR_NOISE = 0.
    STD_FACTOR_NOISE = 0.
    NBR_CHANNELS = 3
    NEGATIVE_LABEL_ID = 9

    # exp number
    exp_number = sys.argv[1]

    # paths
    original_dataset_path = '../../experiments/815/dataset_sequences.h5'
    save_path = os.path.join('../../experiments',exp_number)

    # create exp folder
    createExpFolderandCodeList(save_path)

    # set seeds
    np.random.seed(0)
    random.seed(0)

    # load sequence dataset
    f = h5py.File(original_dataset_path, 'r')
    sequences_x_train = f['sequences_x_train']
    sequences_x_valid = f['sequences_x_valid']
    # get meta data
    nbr_images_in_seq = sequences_x_train.shape[1]
    nbr_seq = sequences_x_train.shape[0]
    size_x = sequences_x_train[0].shape[1]
    size_y = sequences_x_train[0].shape[2]
    max_x = 255
    range(START_ID + 21, START_ID + 30),
    range(START_ID + 31, START_ID + 40),
    range(START_ID + 41, START_ID + 50),
    range(START_ID + 51, START_ID + 60),
    range(START_ID + 61, START_ID + 70),
    range(START_ID + 71, START_ID + 80),
    range(START_ID + 81, START_ID + 90),
    range(START_ID + 91, START_ID + 100)
]

# paths
path_experiments = '../../experiments'
path_save = os.path.join(path_experiments, EXPERIMENT_ID)

# create exp folder
createExpFolderandCodeList(path_save)

# iterate over metrics
for metric in METRICS:
    average_df = pd.DataFrame()
    for series in series_exp:
        average_dict = {}
        for risk_level, exp_id in enumerate(series):
            df = pd.read_csv(
                os.path.join(path_experiments, str(exp_id), 'metrics.csv'))
            average_dict[str(risk_level)] = df[metric][0]
        # update Dataframe
        average_df = average_df.append(average_dict, ignore_index=True)

    # compute average and std of averages
    mean = average_df.mean()