INNER CODE UNIT · Python

convert_pnnx

Nain57/Smart-AutoClicker · scripts/ocr-models/converters/onnx_to_ncnn.py:53

def convert_pnnx(onnx_path, output_dir, shape=None, fp16=True):
    """
    Converts an ONNX model to NCNN format using PNNX.

    :param onnx_path: Path to the input ONNX model.
    :param output_dir: Directory where the NCNN model files will be saved.
    :param shape: Optional input shape to freeze (e.g., "1,3,48,320").
    :param fp16: Whether to enable FP16 mode.
    """
    print("\n=== Converting to NCNN (PNNX) ===")

    os.makedirs(output_dir, exist_ok=True)

    # pnnx works on filename inside directory context
    cwd = os.getcwd()

    try:
        os.chdir(output_dir)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…