INNER CODE UNIT · Python

run_conversion

Nain57/Smart-AutoClicker · scripts/ocr-models/converters/paddle_to_ncnn.py:32

def run_conversion(model_dir, model_type, fp16=True):
    """
    Executes the full conversion pipeline for a single model folder.

    :param model_dir: Path to the directory containing PaddlePaddle model files.
    :param model_type: Type of model: "det" (detection) or "rec" (recognition).
    :param fp16: Whether to use FP16 precision for NCNN conversion.
    """
    model_dir = os.path.abspath(model_dir)
    if not os.path.isdir(model_dir):
        print(f"[ERROR] Input directory does not exist: {model_dir}")
        sys.exit(1)

    # 1. Setup temporary workspace
    temp_dir = os.path.join(model_dir, "temp_conv")
    if os.path.exists(temp_dir):
        shutil.rmtree(temp_dir)
    os.makedirs(temp_dir)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…