Example #1
0
    def __init__(self, cfg_path:str, score_threshold:float = 0.5):
        cfg.merge_from_file(cfg_path)
        cfg.is_cuda = torch.cuda.is_available()
        cfg.freeze()
        self.net, self.box_coder, criterion, self.img_normalization, optimizer_state = build_os2d_from_config(cfg)

        self.source_img_size = 1500
        self.max_detections = 1
        self.score_threshold = score_threshold
Example #2
0
def parse_opts():
    parser = argparse.ArgumentParser(description="Evaluate detector-retrieval baseline")
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument("--output_dir", default=None, type=str,
                        help="path where to save all the outputs")
    # retrieval opts
    # network
    parser.add_argument('--retrieval_network_path', type=str,
                        help='network path, destination where network is saved')
    parser.add_argument('--retrieval_image_size', default=240, type=int,
                        help='maximum size of longer image side used for testing (default: 240)')
    parser.add_argument('--retrieval_multiscale', action='store_true',
                        help='use multiscale vectors for testing')
    parser.add_argument('--retrieval_whitening_path', default=None, type=str,
                        help='path to add the whitening (default: None)')
    # maskrcnn opts
    # config
    parser.add_argument('--maskrcnn_config_file', type=str,
                        help='network path, destination where network is saved')
    # weights
    parser.add_argument('--maskrcnn_weight_file', type=str,
                        help='network path, destination where network is saved')
    parser.add_argument("--nms_iou_threshold_detector_score", default=0.3, type=float,
                        help='first round of nms done w.r.t. the detector scores: IoU threshold')
    parser.add_argument("--nms_score_threshold_detector_score", default=0.1, type=float,
                        help='first round of nms done w.r.t. the detector scores: score threshold')

    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )
    args = parser.parse_args()

    if args.config_file:
        cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    return cfg, args
def parse_opts():
    parser = argparse.ArgumentParser(
        description="Training and evaluation of the OS2D model")
    parser.add_argument(
        "--config-file",
        default="",
        metavar="FILE",
        help="path to config file",
        type=str,
    )
    parser.add_argument(
        "opts",
        help="Modify config options using the command-line",
        default=None,
        nargs=argparse.REMAINDER,
    )
    args = parser.parse_args()

    if args.config_file:
        cfg.merge_from_file(args.config_file)
    cfg.merge_from_list(args.opts)
    cfg.freeze()

    return cfg, args.config_file