Ejemplo n.º 1
0
def find_atlas(atlas=None):
    if atlas:
        return atlas
    if atlas == None:
        atlas = nl.find('TT_N27+tlrc.HEAD')
    if atlas == None:
        atlas = nl.find('TT_N27.nii.gz')
    if atlas == None:
        nl.error('Error: No atlas specified, and I can\'t find "TT_N27"',
                 level=nl.level.error)
        return None
    return atlas
Ejemplo n.º 2
0
def net_error(net, training_data):
    error = [0.0, 0.0, 0.0, 0.0]
    for i in range(4):
        for row in training_data[i]:
            e = net.forward_pass(row)
            error[i] += nn.error(cfg.outputs[i], e)
        error[i] /= len(training_data[i])
    return sum(error)
Ejemplo n.º 3
0
def get_testing_error(net):

    # choose an emotion:
    error = [0.0, 0.0, 0.0, 0.0]
    for i, emotion in enumerate(cfg.emojis):
        test_cases = glob.glob('./test_data/non-training/' + emotion + '/*.png')
        for test_case in test_cases:
            inp = image.convert_to_1d(image.binary_image(test_case, cfg.RES))
            e = net.forward_pass(inp)
            error[i] += nn.error(cfg.outputs[i], e)
        error[i] /= len(test_cases)
    return sum(error)