def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--weights', required=True)
    parser.add_argument('--expname', default='')
    parser.add_argument('--test_boxes', required=True)
    parser.add_argument('--gpu', default=0)
    parser.add_argument('--logdir', default='output')
    parser.add_argument('--iou_threshold', default=0.5, type=float)
    parser.add_argument('--tau', default=0.25, type=float)
    parser.add_argument('--min_conf', default=0.2, type=float)
    parser.add_argument('--show_suppressed', default=True, type=bool)
    args = parser.parse_args()
    os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu)
    hypes_file = ('%s/hypes.json' % os.path.dirname(args.weights))
    with open(hypes_file, 'r') as f:
        H = json.load(f)
    expname = ((args.expname + '_') if args.expname else '')
    pred_boxes = ('%s.%s%s' % (args.weights, expname, os.path.basename(args.test_boxes)))
    true_boxes = ('%s.gt_%s%s' % (args.weights, expname, os.path.basename(args.test_boxes)))
    (pred_annolist, true_annolist) = get_results(args, H)
    pred_annolist.save(pred_boxes)
    true_annolist.save(true_boxes)
    try:
        rpc_cmd = ('./utils/annolist/doRPC.py --minOverlap %f %s %s' % (args.iou_threshold, true_boxes, pred_boxes))
        print(('$ %s' % rpc_cmd))
        rpc_output = subprocess.check_output(rpc_cmd, shell=True)
        print(rpc_output)
        txt_file = [line for line in rpc_output.split('\n') if line.strip()][(- 1)]
        output_png = ('%s/results.png' % get_image_dir(args))
        plot_cmd = ('./utils/annolist/plotSimple.py %s --output %s' % (txt_file, output_png))
        print(('$ %s' % plot_cmd))
        plot_output = subprocess.check_output(plot_cmd, shell=True)
        print(('output results at: %s' % plot_output))
    except Exception as e:
        print(e)
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--weights', required=True)
    parser.add_argument('--expname', default=)
    parser.add_argument('--test_boxes', required=True)
    parser.add_argument('--gpu', default=0)
    parser.add_argument('--logdir', default='output')
    parser.add_argument('--iou_threshold', default=0.5, type=float)
    parser.add_argument('--tau', default=0.25, type=float)
    parser.add_argument('--min_conf', default=0.2, type=float)
    parser.add_argument('--show_suppressed', default=True, type=bool)
    args = parser.parse_args()
    os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu)
    hypes_file = ('%s/hypes.json' % os.path.dirname(args.weights))
    with open(hypes_file, 'r') as f:
        H = json.load(f)
    expname = ((args.expname + '_') if args.expname else )
    pred_boxes = ('%s.%s%s' % (args.weights, expname, os.path.basename(args.test_boxes)))
    true_boxes = ('%s.gt_%s%s' % (args.weights, expname, os.path.basename(args.test_boxes)))
    (pred_annolist, true_annolist) = get_results(args, H)
    pred_annolist.save(pred_boxes)
    true_annolist.save(true_boxes)
    try:
        rpc_cmd = ('./utils/annolist/doRPC.py --minOverlap %f %s %s' % (args.iou_threshold, true_boxes, pred_boxes))
        print(('$ %s' % rpc_cmd))
        rpc_output = subprocess.check_output(rpc_cmd, shell=True)
        print(rpc_output)
        txt_file = [line for line in rpc_output.split('\n') if line.strip()][(- 1)]
        output_png = ('%s/results.png' % get_image_dir(args))
        plot_cmd = ('./utils/annolist/plotSimple.py %s --output %s' % (txt_file, output_png))
        print(('$ %s' % plot_cmd))
        plot_output = subprocess.check_output(plot_cmd, shell=True)
        print(('output results at: %s' % plot_output))
    except Exception as e:
        print(e)