コード例 #1
0
def update_training_info_evaluation_sheet(exp_index,
                                          evaluation_index_list,
                                          debug=True):

    add_index_exp = lambda x: x + str(exp_index)
    columns_list = list(
        map(add_index_exp, get_training_params_colums_in_experiments_sheet()))
    training_info_list = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_experiments_sheet_id(),
        search_range=columns_list,
        debug=debug)  #

    # paste info to evaluation sheet
    for line_index in evaluation_index_list:
        add_index_evaluation = lambda x: x + str(line_index)
        columns_list = list(
            map(add_index_evaluation,
                get_training_params_colums_in_evaluation_sheet()))
        update_row2sheet(service=get_sheet_service(),
                         sheet_id=get_evaluation_sheet_id(),
                         row_starting_position=columns_list[0],
                         data=training_info_list,
                         debug=debug)  #
コード例 #2
0
def fetch_resize_factor_from_google_sheets(dataset,
                                           subset,
                                           size_set,
                                           model_name,
                                           debug=True):
    '''
	get model date during training
	'''
    row_index = get_row_index_from_experiments_sheet(dataset,
                                                     subset,
                                                     size_set,
                                                     model_name,
                                                     debug=debug)
    factor = get_data_from_sheet(service=get_sheet_service(),
                                 sheet_id=get_experiments_sheet_id(),
                                 search_range='g' + str(row_index),
                                 debug=debug)[0]
    return factor
コード例 #3
0
def fetch_output_stage_from_google_sheets(dataset,
                                          subset,
                                          size_set,
                                          model_name,
                                          debug=True):
    '''
	get model date during training
	'''
    row_index = get_row_index_from_experiments_sheet(dataset,
                                                     subset,
                                                     size_set,
                                                     model_name,
                                                     debug=debug)
    out_stage = get_data_from_sheet(service=get_sheet_service(),
                                    sheet_id=get_experiments_sheet_id(),
                                    search_range='I' + str(row_index),
                                    debug=debug)[0]
    out_stage = out_stage.split('S')
    return out_stage[-1]
コード例 #4
0
def fetch_downsample_from_google_sheets(dataset,
                                        subset,
                                        size_set,
                                        model_name,
                                        debug=True):
    '''
	get downsample factor during training
	'''
    row_index = get_row_index_from_experiments_sheet(dataset,
                                                     subset,
                                                     size_set,
                                                     model_name,
                                                     debug=debug)
    downsample = get_data_from_sheet(service=get_sheet_service(),
                                     sheet_id=get_experiments_sheet_id(),
                                     search_range='H' + str(row_index),
                                     debug=debug)[0]
    substrings = downsample.split('x')
    return substrings[0]
コード例 #5
0
def update_testing_info_evaluation_sheet(evaluation_index_list,
                                         info_list,
                                         debug=True):
    '''
	update testing configuration to the record
	'''
    if debug:
        assert len(info_list) == len(
            get_testing_params_colums_in_evaluation_sheet()
        ), 'the information list is not correct %d vs %d' % (len(
            info_list), len(get_testing_params_colums_in_evaluation_sheet()))

    info_list = list(info_list)
    for line_index in evaluation_index_list:
        row_starting_position = get_testing_params_colums_in_evaluation_sheet(
        )[0] + str(line_index)
        update_row2sheet(service=get_sheet_service(),
                         sheet_id=get_evaluation_sheet_id(),
                         row_starting_position=row_starting_position,
                         data=info_list,
                         debug=debug)
コード例 #6
0
def fetch_fitsize_from_google_sheets(dataset,
                                     subset,
                                     size_set,
                                     model_name,
                                     debug=True):
    '''
	get input size during training
	'''
    row_index = get_row_index_from_experiments_sheet(dataset,
                                                     subset,
                                                     size_set,
                                                     model_name,
                                                     debug=debug)
    inputsize = get_data_from_sheet(service=get_sheet_service(),
                                    sheet_id=get_experiments_sheet_id(),
                                    search_range='F' + str(row_index),
                                    debug=debug)[0]
    substrings = inputsize.split(' ')
    width = substrings[0]
    height = substrings[2]
    return [width, height]
コード例 #7
0
def get_row_index_list_from_evaluation_sheet(
        dataset,
        subset,
        size_set,
        evaluation_name,
        debug=True):  # all evaluated models might not be unique
    '''
		the returned index is already 1-indexed
	'''
    if debug:
        assert subset in get_compact_subset_list(
        ) or subset == 'face_old', 'subset is not correct!'
        assert size_set in ['resized_4', 'cropped',
                            'cropped_all'], 'size set is not correct'

    column_search_range = range(get_search_range_in_sheet())
    # find index in rows in experiments sheet
    columns_search_dataset = [
        'A%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_dataset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_evaluation_sheet_id(),
        search_range=columns_search_dataset,
        debug=debug)  #
    columns_search_subset = [
        'B%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_subset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_evaluation_sheet_id(),
        search_range=columns_search_subset,
        debug=debug)  #
    columns_search_sizeset = [
        'C%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_sizeset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_evaluation_sheet_id(),
        search_range=columns_search_sizeset,
        debug=debug)  #
    columns_search_model = [
        'D%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_model = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_evaluation_sheet_id(),
        search_range=columns_search_model,
        debug=debug)  #
    row_index_list = list()
    for row_index in column_search_range:
        if columns_name_subset[row_index] == subset and columns_name_sizeset[
                row_index] == size_set and columns_name_model[
                    row_index] == evaluation_name and columns_name_dataset[
                        row_index] == dataset:
            row_index_list.append(row_index + 1)

    if len(row_index_list) == 0:
        assert False, '%s, %s, %s, %s is not on the search range within the google sheet' % (
            dataset, subset, size_set, evaluation_name)

    return row_index_list
コード例 #8
0
def get_row_index_from_experiments_sheet(
        dataset,
        subset,
        size_set,
        model_name,
        debug=True):  # all experiments are unique
    '''
	the returned index is already 1-indexed
	'''
    if debug:
        assert subset in get_compact_subset_list(
        ) or subset == 'face_old', 'subset is not correct!'
        assert size_set in ['resized_4', 'cropped',
                            'cropped_all'], 'size set is not correct'

    column_search_range = range(get_search_range_in_sheet())
    # find index in rows in experiments sheet
    columns_search_dataset = [
        'A%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_dataset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_experiments_sheet_id(),
        search_range=columns_search_dataset,
        debug=debug)  #
    columns_search_subset = [
        'B%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_subset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_experiments_sheet_id(),
        search_range=columns_search_subset,
        debug=debug)  #
    columns_search_sizeset = [
        'C%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_sizeset = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_experiments_sheet_id(),
        search_range=columns_search_sizeset,
        debug=debug)  #
    columns_search_model = [
        'D%d' % (search_value_tmp + 1)
        for search_value_tmp in column_search_range
    ]
    columns_name_model = get_data_from_sheet(
        service=get_sheet_service(),
        sheet_id=get_experiments_sheet_id(),
        search_range=columns_search_model,
        debug=debug)  #

    row_index_exp = None
    for row_index in column_search_range:
        if columns_name_subset[row_index] == subset and columns_name_sizeset[
                row_index] == size_set and columns_name_model[
                    row_index] == model_name and columns_name_dataset[
                        row_index] == dataset:
            row_index_exp = row_index + 1
            break

    if row_index_exp is None:
        assert False, 'No entry model (%s, %s, %s, %s) found!' % (
            dataset, subset, size_set, model_name)

    return row_index_exp