ncnn
ncnn is a high-performance neural network inference framework optimized for the mobile platform
What it is and what it does
ncnn is a C++-based neural network inference engine with Python bindings that specializes in running pre-trained deep learning models efficiently on mobile, embedded, and desktop hardware. It provides CPU and Vulkan GPU backends and is designed to minimize latency and memory footprint for deployment scenarios where model training is not needed—only inference. The typical workflow involves converting a PyTorch or ONNX model to ncnn format using the pnnx tool, then loading and executing the converted model files (.param and .bin) through the Python API.
The package depends on numpy for array handling, opencv-python for image operations, and utility libraries (tqdm, requests, portalocker) for model downloading and progress tracking. It is actively maintained by Tencent and widely used in production applications. Pre-built wheels are available for many platforms and Python versions, though installation involves compiled binaries that may require platform-specific dependencies.
Use it for:
- Deploy trained PyTorch or ONNX models to mobile phones or edge devices for real-time inference without model training.
- Run computer vision models (image classification, object detection) on resource-constrained hardware with minimal latency.
- Accelerate inference on desktop or server CPUs using optimized C++ execution with Python control.
- Build inference pipelines that load and execute multiple pre-converted models sequentially or in parallel.
- Integrate deep learning inference into applications targeting iOS, Android, or embedded Linux platforms.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ncnn is a neural network inference framework that loads and runs pre-trained deep learning models on CPU and Vulkan GPU backends, with Python bindings for model execution.
Yes, if you have pre-trained models to deploy and need efficient inference on mobile or embedded hardware. The permissive BSD-3 license and active maintenance are favorable. Install friction is moderate due to compiled wheels, but pre-built binaries for common platforms reduce friction. Not suitable if you need to train models or require a high-level training API—ncnn is inference-only. Verify that your target platform and model architecture are supported before committing.
Install
ncnn on PyPI
pip
pip install ncnnuv
uv add ncnnpoetry
poetry add ncnnInstalling ncnn
Before you install
Medium install friction due to compiled wheels across many platforms (macOS, Linux, Windows, various architectures). Active maintenance with recent releases; last commit 2026-08-13. Depends on numpy, opencv-python, tqdm, requests, and portalocker.
License in practice
BSD-3 permissive license allows commercial and private use with minimal restrictions; you must include the license text in distributions.
Quickstart
pip install ncnn
import ncnn
import numpy as np
net = ncnn.Net()
net.load_param("model.ncnn.param")
net.load_model("model.ncnn.bin")
x = np.zeros((3, 224, 224), np.float32)
mat = ncnn.Mat(x)
ex = net.create_extractor()
ex.input("in0", mat)
ret, out = ex.extract("out0")
Requires pre-converted ncnn model files (.param and .bin); use pnnx to convert PyTorch or ONNX models first.
Verify before relying
- Whether Vulkan GPU acceleration is available on all supported platforms or requires additional system libraries.
- Performance benchmarks compared to other inference frameworks on target hardware.
- Supported model architectures and any limitations in layer coverage.
Package facts
| License | BSD-3 (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — numpy, tqdm, requests, portalocker, opencv-python |
| Maintenance | actively maintained — 80 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 242,789/month — #8,839 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ncnn-1.0.20260526-cp310-cp310-macosx_11_0_arm64.whl; ncnn-1.0.20260526-cp310-cp310-macosx_11_0_x86_64.whl; ncnn-1.0.20260526-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ncnn-1.0.20260526-cp310-cp310-manylinux_2_24_i686.manylinux_2_28_i686.whl; ncnn-1.0.20260526-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ncnn-1.0.20260526-cp310-cp310-manylinux_2_31_armv7l.whl; ncnn-1.0.20260526-cp310-cp310-manylinux_2_39_riscv64.whl; ncnn-1.0.20260526-cp310-cp310-musllinux_1_2_aarch64.whl; ncnn-1.0.20260526-cp310-cp310-musllinux_1_2_armv7l.whl; ncnn-1.0.20260526-cp310-cp310-musllinux_1_2_i686.whl; ncnn-1.0.20260526-cp310-cp310-musllinux_1_2_riscv64.whl; ncnn-1.0.20260526-cp310-cp310-musllinux_1_2_x86_64.whl; ncnn-1.0.20260526-cp310-cp310-win32.whl; ncnn-1.0.20260526-cp310-cp310-win_amd64.whl; ncnn-1.0.20260526-cp310-cp310-win_arm64.whl; ncnn-1.0.20260526-cp311-cp311-macosx_11_0_arm64.whl; ncnn-1.0.20260526-cp311-cp311-macosx_11_0_x86_64.whl; ncnn-1.0.20260526-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ncnn-1.0.20260526-cp311-cp311-manylinux_2_24_i686.manylinux_2_28_i686.whl; ncnn-1.0.20260526-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
mnnMNN is a lightweight deep learning inference…
permissive · top 15,000 on PyPI
pnnxExports and converts PyTorch neural network…
permissive · top 15,000 on PyPI
executorchExecuTorch exports and runs PyTorch models on…
permissive · top 15,000 on PyPI
nvidia-cudnn-cu13Provides cuDNN runtime libraries for…
unclear · top 1,000 on PyPI
nvidia-cudnn-cu12Provides cuDNN runtime libraries for…
unclear · top 1,000 on PyPI
nvidia-cudnn-cu11Provides cuDNN runtime libraries for…
unclear · top 5,000 on PyPI
sit4onnxRuns inference tests on ONNX models using…
permissive · top 15,000 on PyPI
tensorflowTensorFlow is an open-source machine learning…
permissive · top 5,000 on PyPI
realesrganReal-ESRGAN upscales images and videos using…
permissive · top 15,000 on PyPI
spandrelSpandrel loads and runs pre-trained PyTorch…
permissive · top 5,000 on PyPI