Example #1
0
def plot_rank_histogram(allres, orgres_type):
    print('[viz] plotting %r rank histogram' % orgres_type)
    ranks = allres.__dict__[orgres_type].ranks
    label = 'P(rank | ' + orgres_type + ' match)'
    title = orgres_type + ' match rankings histogram\n' + allres.title_suffix
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    df2.draw_histpdf(ranks, label=label)  # FIXME
    df2.set_xlabel('ground truth ranks')
    df2.set_ylabel('frequency')
    df2.legend()
    __dump_or_browse(allres.ibs, 'rankviz')
Example #2
0
def plot_rank_histogram(allres, orgres_type):
    print('[viz] plotting %r rank histogram' % orgres_type)
    ranks = allres.__dict__[orgres_type].ranks
    label = 'P(rank | ' + orgres_type + ' match)'
    title = orgres_type + ' match rankings histogram\n' + allres.title_suffix
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    df2.draw_histpdf(ranks, label=label)  # FIXME
    df2.set_xlabel('ground truth ranks')
    df2.set_ylabel('frequency')
    df2.legend()
    __dump_or_browse(allres.ibs, 'rankviz')
Example #3
0
def plot_score_pdf(allres, orgres_type, colorx=0.0, variation_truncate=False):
    print('[viz] plotting ' + orgres_type + ' score pdf')
    title  = orgres_type + ' match score frequencies\n' + allres.title_suffix
    scores = allres.__dict__[orgres_type].scores
    print('[viz] len(scores) = %r ' % (len(scores),))
    label  = 'P(score | %r)' % orgres_type
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    df2.draw_pdf(scores, label=label, colorx=colorx)
    if variation_truncate:
        df2.variation_trunctate(scores)
    #df2.variation_trunctate(false.scores)
    df2.set_xlabel('score')
    df2.set_ylabel('frequency')
    df2.legend()
    __dump_or_browse(allres.ibs, 'scoreviz')
Example #4
0
def plot_score_pdf(allres, orgres_type, colorx=0.0, variation_truncate=False):
    print('[viz] plotting ' + orgres_type + ' score pdf')
    title = orgres_type + ' match score frequencies\n' + allres.title_suffix
    scores = allres.__dict__[orgres_type].scores
    print('[viz] len(scores) = %r ' % (len(scores), ))
    label = 'P(score | %r)' % orgres_type
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    df2.draw_pdf(scores, label=label, colorx=colorx)
    if variation_truncate:
        df2.variation_trunctate(scores)
    #df2.variation_trunctate(false.scores)
    df2.set_xlabel('score')
    df2.set_ylabel('frequency')
    df2.legend()
    __dump_or_browse(allres.ibs, 'scoreviz')
Example #5
0
def plot_rank_stem(allres, orgres_type='true'):
    print('[viz] plotting rank stem')
    # Visualize rankings with the stem plot
    ibs = allres.ibs
    title = orgres_type + 'rankings stem plot\n' + allres.title_suffix
    orgres = allres.__dict__[orgres_type]
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    x_data = orgres.qcxs
    y_data = orgres.ranks
    df2.draw_stems(x_data, y_data)
    slice_num = int(np.ceil(np.log10(len(orgres.qcxs))))
    df2.set_xticks(ibs.test_sample_cx[::slice_num])
    df2.set_xlabel('query chip indeX (qcx)')
    df2.set_ylabel('groundtruth chip ranks')
    #df2.set_yticks(list(seen_ranks))
    __dump_or_browse(allres.ibs, 'rankviz')
Example #6
0
def plot_rank_stem(allres, orgres_type='true'):
    print('[viz] plotting rank stem')
    # Visualize rankings with the stem plot
    ibs = allres.ibs
    title = orgres_type + 'rankings stem plot\n' + allres.title_suffix
    orgres = allres.__dict__[orgres_type]
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    x_data = orgres.qcxs
    y_data = orgres.ranks
    df2.draw_stems(x_data, y_data)
    slice_num = int(np.ceil(np.log10(len(orgres.qcxs))))
    df2.set_xticks(ibs.test_sample_cx[::slice_num])
    df2.set_xlabel('query chip indeX (qcx)')
    df2.set_ylabel('groundtruth chip ranks')
    #df2.set_yticks(list(seen_ranks))
    __dump_or_browse(allres.ibs, 'rankviz')
def TEST_figure1(wpatch, gradx, grady, gmag, gori, hist, centers):
    from plottool import draw_func2 as df2
    import plottool
    import vtool.patch as ptool
    print('[rotinvar] 4) Draw histogram with interpolation annotations')
    fnum = 1
    gorimag = plottool.color_orimag(gori, gmag, True)
    nRow, nCol = (2, 7)

    df2.figure(fnum=1, pnum=(nRow, 1, nRow), doclf=True, docla=True)
    plottool.draw_hist_subbin_maxima(hist, centers)
    df2.set_xlabel('grad orientation (radians)')
    df2.set_ylabel('grad magnitude')
    df2.set_title('dominant orientations')

    print('[rotinvar] 5) Show patch, gradients, magintude, and orientation')
    df2.imshow(wpatch, pnum=(nRow, nCol, 1), fnum=fnum, title='patch')
    df2.draw_vector_field(gradx,
                          grady,
                          pnum=(nRow, nCol, 2),
                          fnum=fnum,
                          title='gori (vec)')
    df2.imshow(gorimag, pnum=(nRow, nCol, 3), fnum=fnum, title='gori (col)')
    df2.imshow(np.abs(gradx), pnum=(nRow, nCol, 4), fnum=fnum, title='gradx')
    df2.imshow(np.abs(grady), pnum=(nRow, nCol, 5), fnum=fnum, title='grady')
    df2.imshow(gmag, pnum=(nRow, nCol, 6), fnum=fnum, title='gmag')

    gpatch = ptool.gaussian_patch(shape=gori.shape)
    df2.imshow(gpatch * 255,
               pnum=(nRow, nCol, 7),
               fnum=fnum,
               title='gauss weights',
               cmap_='hot')
    #gpatch3 = np.dstack((gpatch, gpatch, gpatch))
    #df2.draw_vector_field(gradx * gpatch, grady * gpatch, pnum=(nRow, nCol, 8), fnum=fnum, title='gori (vec)')
    #df2.imshow(gorimag * gpatch3, pnum=(nRow, nCol, 9), fnum=fnum, title='gori (col)')
    #df2.imshow(gradx * gpatch,   pnum=(nRow, nCol, 10), fnum=fnum, title='gradx')
    #df2.imshow(grady * gpatch,   pnum=(nRow, nCol, 11), fnum=fnum, title='grady')
    #df2.imshow(gmag * gpatch,    pnum=(nRow, nCol, 12), fnum=fnum, title='gmag')
    return locals()
Example #8
0
def plot_score_matrix(allres):
    print('[viz] plotting score matrix')
    score_matrix = allres.score_matrix
    title = 'Score Matrix\n' + allres.title_suffix
    # Find inliers
    #inliers = util.find_std_inliers(score_matrix)
    #max_inlier = score_matrix[inliers].max()
    # Trunate above 255
    score_img = np.copy(score_matrix)
    #score_img[score_img < 0] = 0
    #score_img[score_img > 255] = 255
    #dim = 0
    #score_img = util.norm_zero_one(score_img, dim=dim)
    # Make colors
    scores = score_img.flatten()
    colors = df2.scores_to_color(scores, logscale=True)
    cmap = df2.scores_to_cmap(scores, colors)
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    # Show score matrix
    df2.imshow(score_img, fnum=FIGNUM, cmap=cmap)
    # Colorbar
    df2.colorbar(scores, colors)
    df2.set_xlabel('database')
    df2.set_ylabel('queries')
Example #9
0
def plot_score_matrix(allres):
    print('[viz] plotting score matrix')
    score_matrix = allres.score_matrix
    title = 'Score Matrix\n' + allres.title_suffix
    # Find inliers
    #inliers = util.find_std_inliers(score_matrix)
    #max_inlier = score_matrix[inliers].max()
    # Trunate above 255
    score_img = np.copy(score_matrix)
    #score_img[score_img < 0] = 0
    #score_img[score_img > 255] = 255
    #dim = 0
    #score_img = util.norm_zero_one(score_img, dim=dim)
    # Make colors
    scores = score_img.flatten()
    colors = df2.scores_to_color(scores, logscale=True)
    cmap = df2.scores_to_cmap(scores, colors)
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    # Show score matrix
    df2.imshow(score_img, fnum=FIGNUM, cmap=cmap)
    # Colorbar
    df2.colorbar(scores, colors)
    df2.set_xlabel('database')
    df2.set_ylabel('queries')