:py:mod:`kwcoco.examples.draw_gt_and_predicted_boxes` ===================================================== .. py:module:: kwcoco.examples.draw_gt_and_predicted_boxes Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: kwcoco.examples.draw_gt_and_predicted_boxes.draw_true_and_pred_boxes .. py:function:: draw_true_and_pred_boxes(true_fpath, pred_fpath, gid, viz_fpath) How do you generally visualize gt and predicted bounding boxes together? .. rubric:: Example >>> import kwcoco >>> import ubelt as ub >>> from os.path import join >>> from kwcoco.demo.perterb import perterb_coco >>> # Create a working directory >>> dpath = ub.ensure_app_cache_dir('kwcoco/examples/draw_true_and_pred_boxes') >>> # Lets setup some dummy true data >>> true_dset = kwcoco.CocoDataset.demo('shapes2') >>> true_dset.fpath = join(dpath, 'true_dset.kwcoco.json') >>> true_dset.dump(true_dset.fpath, newlines=True) >>> # Lets setup some dummy predicted data >>> pred_dset = perterb_coco(true_dset, box_noise=100, rng=421) >>> pred_dset.fpath = join(dpath, 'pred_dset.kwcoco.json') >>> pred_dset.dump(pred_dset.fpath, newlines=True) >>> # >>> # We now have our true and predicted data, lets visualize >>> true_fpath = true_dset.fpath >>> pred_fpath = pred_dset.fpath >>> print('dpath = {!r}'.format(dpath)) >>> print('true_fpath = {!r}'.format(true_fpath)) >>> print('pred_fpath = {!r}'.format(pred_fpath)) >>> # Lets choose an image id to visualize and a path to write to >>> gid = 1 >>> viz_fpath = join(dpath, 'viz_{}.jpg'.format(gid)) >>> # The answer to the question is in the logic of this function >>> draw_true_and_pred_boxes(true_fpath, pred_fpath, gid, viz_fpath)