def show_each_dstncvs_chip(self, dodraw=True): """ CommandLine: python -m ibeis.viz.interact.interact_matches --test-show_each_dstncvs_chip --show Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.interact.interact_matches import * # NOQA >>> self = testdata_match_interact(mx=1) >>> self.show_each_dstncvs_chip(dodraw=False) >>> pt.show_if_requested() """ dstncvs1, dstncvs2 = scoring.get_kpts_distinctiveness(self.ibs, [self.qaid, self.daid]) print('dstncvs1_stats = ' + ut.get_stats_str(dstncvs1)) print('dstncvs2_stats = ' + ut.get_stats_str(dstncvs2)) weight_label = 'dstncvs' showkw = dict(weight_label=weight_label, ell=False, pts=True) viz_chip.show_chip(self.ibs, self.qaid, weights=dstncvs1, fnum=pt.next_fnum(), **showkw) viz_chip.show_chip(self.ibs, self.daid, weights=dstncvs2, fnum=pt.next_fnum(), **showkw) if dodraw: #self.draw() pt.draw()
def on_click_inside(self, event, ax): import plottool as pt viztype = ph.get_plotdat(ax, 'viztype', None) print('[ik] viztype=%r' % viztype) if viztype is None: pass elif viztype == 'keypoints': kpts = ph.get_plotdat(ax, 'kpts', []) if len(kpts) == 0: print('...nokpts') else: print('...nearest') x, y = event.xdata, event.ydata fx = ut.nearest_point(x, y, kpts)[0] self._select_ith_kpt(fx) elif viztype == 'warped': hs_fx = ph.get_plotdat(ax, 'fx', None) if hs_fx is not None: kp = self.kpts[hs_fx] # FIXME sift = self.vecs[hs_fx] df2.draw_keypoint_gradient_orientations(self.chip, kp, sift=sift, mode='vec', fnum=pt.next_fnum()) pt.draw() elif viztype.startswith('colorbar'): pass else: print('...unhandled') self.draw()
def show_each_fgweight_chip(self): viz_chip.show_chip(self.ibs, self.qaid, fnum=pt.next_fnum(), weight_label='fg_weights') viz_chip.show_chip(self.ibs, self.daid, fnum=pt.next_fnum(), weight_label='fg_weights') #self.draw() pt.draw()
def query_last_feature(self): ibs = self.ibs qaid = self.qaid viz.show_nearest_descriptors(ibs, qaid, self.last_fx, pt.next_fnum(), qreq_=self.qreq_, draw_chip=True) fig3 = pt.gcf() ih.connect_callback(fig3, 'button_press_event', self.on_click) pt.draw()
def sv_view(self, dodraw=True): """ spatial verification view """ #fnum = viz.FNUMS['special'] aid = self.daid fnum = pt.next_fnum() fig = pt.figure(fnum=fnum, docla=True, doclf=True) ih.disconnect_callback(fig, 'button_press_event') viz.viz_sver.show_sver(self.ibs, self.qaid, aid2=aid, fnum=fnum) if dodraw: #self.draw() pt.draw()
def show_coverage(self, dodraw=True): """ CommandLine: python -m ibeis.viz.interact.interact_matches --test-show_coverage --show python -m ibeis.viz.interact.interact_matches --test-show_coverage Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.interact.interact_matches import * # NOQA >>> self = testdata_match_interact(mx=1) >>> self.show_coverage(dodraw=False) >>> pt.show_if_requested() """ masks_list = scoring.get_masks(self.qreq_, self.cm) scoring.show_coverage_mask(self.qreq_, self.cm, masks_list) if dodraw: #self.draw() pt.draw()
def _wrp(): import plottool as pt ret = func() pt.draw() return ret
def test_featweight_worker(): """ test function python -m ibeis.algo.preproc.preproc_featweight --test-gen_featweight_worker --show --cnn """ import ibeis qreq_ = ibeis.main_helpers.testdata_qreq_(defaultdb='PZ_MTEST', p=['default:fw_detector=cnn'], qaid_override=[1]) ibs = qreq_.ibs config2_ = qreq_.qparams lazy = True aid_list = qreq_.get_external_qaids() #aid_list = ibs.get_valid_aids()[0:30] kpts_list = ibs.get_annot_kpts(aid_list) chipsize_list = ibs.get_annot_chip_sizes(aid_list, config2_=config2_) probchip_fpath_list = preproc_probchip.compute_and_write_probchip(ibs, aid_list, lazy=lazy, config2_=config2_) print('probchip_fpath_list = %r' % (probchip_fpath_list,)) probchip_list = [vt.imread(fpath, grayscale=True) if exists(fpath) else None for fpath in probchip_fpath_list] _iter = list(zip(aid_list, kpts_list, probchip_list, chipsize_list)) _iter = ut.InteractiveIter(_iter, enabled=ut.get_argflag('--show')) for aid, kpts, probchip, chipsize in _iter: #kpts = kpts_list[0] #aid = aid_list[0] #probchip = probchip_list[0] #chipsize = chipsize_list[0] tup = (aid, kpts, probchip, chipsize) (aid, weights) = gen_featweight_worker(tup) if aid == 3 and ibs.get_dbname() == 'testdb1': # Run Asserts if not interactive weights_03_test = weights[0:3] print('weights[0:3] = %r' % (weights_03_test,)) #weights_03_target = [ 0.098, 0.155, 0.422] #weights_03_target = [ 0.324, 0.407, 0.688] #weights_thresh = [ 0.09, 0.09, 0.09] #ut.assert_almost_eq(weights_03_test, weights_03_target, weights_thresh) ut.assert_inbounds(weights_03_test, 0, 1) if not ut.show_was_requested(): break if ut.show_was_requested(): import plottool as pt #sfx, sfy = (probchip.shape[1] / chipsize[0], probchip.shape[0] / chipsize[1]) #kpts_ = vt.offset_kpts(kpts, (0, 0), (sfx, sfy)) pnum_ = pt.make_pnum_nextgen(1, 3) # *pt.get_square_row_cols(4)) fnum = 1 pt.figure(fnum=fnum, doclf=True) ### pt.imshow(ibs.get_annot_chips(aid, config2_=config2_), pnum=pnum_(0), fnum=fnum) if ut.get_argflag('--numlbl'): pt.gca().set_xlabel('(1)') ### pt.imshow(probchip, pnum=pnum_(2), fnum=fnum) if ut.get_argflag('--numlbl'): pt.gca().set_xlabel('(2)') #pt.draw_kpts2(kpts_, ell_alpha=.4, color_list=pt.ORANGE) ### #pt.imshow(probchip, pnum=pnum_(3), fnum=fnum) #color_list = pt.draw_kpts2(kpts_, weights=weights, ell_alpha=.7, cmap_='jet') #cb = pt.colorbar(weights, color_list) #cb.set_label('featweights') ### pt.imshow(ibs.get_annot_chips(aid, config2_=qreq_.qparams), pnum=pnum_(1), fnum=fnum) #color_list = pt.draw_kpts2(kpts, weights=weights, ell_alpha=.3, cmap_='jet') color_list = pt.draw_kpts2(kpts, weights=weights, ell_alpha=.3) cb = pt.colorbar(weights, color_list) cb.set_label('featweights') if ut.get_argflag('--numlbl'): pt.gca().set_xlabel('(3)') #pt.draw_kpts2(kpts, ell_alpha=.4) pt.draw() pt.show_if_requested()
def show_each_probchip(self): viz_hough.show_probability_chip(self.ibs, self.qaid, fnum=pt.next_fnum()) viz_hough.show_probability_chip(self.ibs, self.daid, fnum=pt.next_fnum()) pt.draw()
def show_each_chip(self): viz_chip.show_chip(self.ibs, self.qaid, fnum=pt.next_fnum(), nokpts=True) viz_chip.show_chip(self.ibs, self.daid, fnum=pt.next_fnum(), nokpts=True) pt.draw()