INNER CODE UNIT · Python

_set_thresholds

mindee/doctr · doctr/cli/main.py:147

def _set_thresholds(model: Any, args: argparse.Namespace) -> None:
    """Override the post-processing thresholds of the detection model

    Args:
        model: the predictor
        args: the parsed command-line arguments
    """
    if args.bin_thresh is None and args.box_thresh is None:
        return

    det_model = getattr(getattr(model, "det_predictor", None), "model", None)
    postprocessor = getattr(det_model, "postprocessor", None)
    if postprocessor is None:
        logger.warning("The detection model exposes no postprocessor: --bin_thresh & --box_thresh are ignored")
        return

    if args.bin_thresh is not None:
        postprocessor.bin_thresh = args.bin_thresh

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…