def plot_final_scores():
    ''' Plot the scores '''
    font = {'size': 12}
    mpl.rc('font', **font)
    fig, ax = plt.subplots(nrows=1, ncols=1,
                           figsize=(7, 4))  # create figure & 1 axis
    outfiles = [
        RESULT_DIR + 'seq2seq_teacher_imagenet_%s_iter_5000.json',
        RESULT_DIR + 'seq2seq_sample_imagenet_%s_iter_20000.json',
        RESULT_DIR + '%s_stop_agent.json', RESULT_DIR + '%s_random_agent.json'
    ]
    for split in ['val_seen']:
        ev = Evaluation([split])
        for i, outfile in enumerate(outfiles):
            score_summary, scores = ev.score(outfile % split)
            if i == 0:
                method = 'Teacher-forcing'
                ax.hist(scores['nav_errors'],
                        bins=range(0, 30, 3),
                        label=method,
                        normed=True,
                        histtype='step',
                        linewidth=2.5,
                        color='C1')
            elif i == 1:
                method = 'Student-forcing'
                ax.hist(scores['nav_errors'],
                        bins=range(0, 30, 3),
                        label=method,
                        alpha=0.7,
                        normed=True,
                        color='C0')
            elif i == 2:
                method = 'Start locations'
                ax.hist(scores['nav_errors'],
                        bins=range(0, 30, 3),
                        label=method,
                        normed=True,
                        histtype='step',
                        linewidth=2.5,
                        color='C3')
            elif i == 3:
                method = 'Random agent'
                ax.hist(scores['nav_errors'],
                        bins=range(0, 30, 3),
                        label=method,
                        normed=True,
                        histtype='step',
                        linewidth=2.5,
                        color='C2')
    ax.set_title('Val Seen Navigation Error')
    ax.set_xlabel('Error (m)')
    ax.set_ylabel('Frequency')
    ax.set_ylim([0, 0.14])
    ax.set_xlim([0, 30])
    plt.axvline(x=3, color='black', linestyle='--')
    legend = ax.legend(loc='upper right')
    plt.tight_layout()
    plt.savefig('%s/val_seen_error.png' % (PLOT_DIR))
    plt.close(fig)
示例#2
0
def plot_final_scores():
    ''' Plot the scores '''
    font = {
      'size'   : 12
    }
    mpl.rc('font', **font)
    fig, ax = plt.subplots( nrows=1, ncols=1, figsize=(7,4) )  # create figure & 1 axis
    outfiles = [
        RESULT_DIR + 'seq2seq_sample_imagenet_%s_iter_20000.json',
        RESULT_DIR + 'seq2seq_teacher_imagenet_%s_iter_5000.json',
        RESULT_DIR + '%s_stop_agent.json',
        RESULT_DIR + '%s_random_agent.json'
    ]
    for split in ['val_seen']:
        ev = Evaluation([split])
        for i,outfile in enumerate(outfiles):
            score_summary,scores = ev.score(outfile % split)
            if i == 1:
                method = 'Teacher-forcing'
                ax.hist(scores['nav_errors'], bins=range(0,30,3), label=method, normed=True, histtype = 'step', linewidth=2.5, color='C1')
            elif i == 0:
                method = 'Student-forcing'
                ax.hist(scores['nav_errors'], bins=range(0,30,3), label=method, alpha=0.7, normed=True, color='C0')
            elif i == 2:
                method = 'Start locations'
                ax.hist(scores['nav_errors'], bins=range(0,30,3), label=method, normed=True, histtype = 'step', linewidth=2.5, color='C3')
            elif i == 3:
                method = 'Random agent'
                ax.hist(scores['nav_errors'], bins=range(0,30,3), label=method, normed=True, histtype = 'step', linewidth=2.5, color='C2')
    ax.set_title('Val Seen Navigation Error')
    ax.set_xlabel('Error (m)')
    ax.set_ylabel('Frequency')
    ax.set_ylim([0,0.14])
    ax.set_xlim([0,30])
    plt.axvline(x=3, color='black', linestyle='--')
    legend = ax.legend(loc='upper right')
    plt.tight_layout()
    plt.savefig('%s/val_seen_error.png' % (PLOT_DIR))
    plt.close(fig)
示例#3
0
文件: plot.py 项目: guhur/r2r_vln
def plot_final_scores():
    """ Plot the scores """
    font = {"size": 12}
    mpl.rc("font", **font)
    fig, ax = plt.subplots(nrows=1, ncols=1,
                           figsize=(7, 4))  # create figure & 1 axis
    outfiles = [
        RESULT_DIR + "seq2seq_sample_imagenet_%s_iter_20000.json",
        RESULT_DIR + "seq2seq_teacher_imagenet_%s_iter_5000.json",
        RESULT_DIR + "%s_stop_agent.json",
        RESULT_DIR + "%s_random_agent.json",
    ]
    for split in ["val_seen"]:
        ev = Evaluation([split])
        for i, outfile in enumerate(outfiles):
            score_summary, scores = ev.score(outfile % split)
            if i == 1:
                method = "Teacher-forcing"
                ax.hist(
                    scores["nav_errors"],
                    bins=list(range(0, 30, 3)),
                    label=method,
                    normed=True,
                    histtype="step",
                    linewidth=2.5,
                    color="C1",
                )
            elif i == 0:
                method = "Student-forcing"
                ax.hist(
                    scores["nav_errors"],
                    bins=list(range(0, 30, 3)),
                    label=method,
                    alpha=0.7,
                    normed=True,
                    color="C0",
                )
            elif i == 2:
                method = "Start locations"
                ax.hist(
                    scores["nav_errors"],
                    bins=list(range(0, 30, 3)),
                    label=method,
                    normed=True,
                    histtype="step",
                    linewidth=2.5,
                    color="C3",
                )
            elif i == 3:
                method = "Random agent"
                ax.hist(
                    scores["nav_errors"],
                    bins=list(range(0, 30, 3)),
                    label=method,
                    normed=True,
                    histtype="step",
                    linewidth=2.5,
                    color="C2",
                )
    ax.set_title("Val Seen Navigation Error")
    ax.set_xlabel("Error (m)")
    ax.set_ylabel("Frequency")
    ax.set_ylim([0, 0.14])
    ax.set_xlim([0, 30])
    plt.axvline(x=3, color="black", linestyle="--")
    legend = ax.legend(loc="upper right")
    plt.tight_layout()
    plt.savefig("%s/val_seen_error.png" % (PLOT_DIR))
    plt.close(fig)