Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

ncnn

> 数据库
Open source

ncnn is a high-performance neural network inference framework optimized for the mobile platform

23.6K stars0 likes0 views
WebsiteGitHub

About

ncnn is a high-performance neural network inference framework optimized for the mobile platform

ncnn

ncnn is a high-performance neural network inference framework optimized for mobile, embedded, and desktop deployment. It has no third-party runtime dependencies, runs across CPU and Vulkan GPU backends, and provides tools such as pnnx for converting PyTorch and ONNX models to ncnn. Developers can deploy deep learning models efficiently on phones, PCs, browsers, and edge devices. ncnn is currently being used in many Tencent applications, such as QQ, Qzone, WeChat, Pitu, and so on.

ncnn 是一个面向移动端、嵌入式和桌面端部署优化的高性能神经网络推理框架。 ncnn 无第三方运行时依赖,支持 CPU 和 Vulkan GPU 后端,并提供 pnnx 等工具将 PyTorch 和 ONNX 模型转换为 ncnn 模型。 基于 ncnn,开发者可以将深度学习模型高效部署到手机、PC、浏览器和边缘设备上。 ncnn 目前已在腾讯多款应用中使用,如:QQ,Qzone,微信,天天 P 图等。


Quick Start

The recommended beginner path is PyTorch -> pnnx -> ncnn.

Install pnnx in a PyTorch environment

bash
pip3 install pnnx

Export a PyTorch model to ncnn

python
import torch
import torch.nn as nn
import pnnx

class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 8, 1)
        self.relu = nn.ReLU()
        self.fc = nn.Linear(8, 4)

    def forward(self, x):
        x = self.conv(x)
        x = self.relu(x)
        x = x.mean((2, 3))
        return self.fc(x)

model = Model().eval()

x = torch.rand(1, 3, 224, 224)
pnnx.export(model, "model.pt", (x,))

This generates model.ncnn.param and model.ncnn.bin.

Run with ncnn C++ API

cpp
#include "net.h"

ncnn::Net net;
net.load_param("model.ncnn.param");
net.load_model("model.ncnn.bin");

ncnn::Mat in(224, 224, 3);

auto ex = net.create_extractor();
ex.input("in0", in);

ncnn::Mat out;
ex.extract("out0", out);

Or use Python

python
import numpy as np
import ncnn

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")
print(np.array(out).shape)

See pnnx, use ncnn with PyTorch or ONNX, Python API, and examples for complete workflows.


Community

技术交流 QQ 群
637093648 (超多大佬)
答案:卷卷卷卷卷(已满)
Telegram Group

https://t.me/ncnnyes

Discord Channel

https://discord.gg/YRsxgmF

Pocky QQ 群(MLIR YES!)
677104663 (超多大佬)
答案:multi-level intermediate representation
他们都不知道 pnnx 有多好用群
818998520 (新群!)

Download & Build status

https://github.com/Tencent/ncnn/releases/latest

how to build ncnn library on Linux / Windows / macOS / Raspberry Pi3, Pi4 / POWER / Android / NVIDIA Jetson / iOS / WebAssembly / AllWinner D1 / Loongson 2K1000

Source

  • Build for Android
  • Build for Termux on Android
Android

Android shared

  • Build for HarmonyOS with cross-compiling
HarmonyOS

HarmonyOS shared

  • Build for iOS on macOS with xcode
iOS

iOS-Simulator

  • Build for macOS
macOS

Mac-Catalyst

watchOS

watchOS-Simulator

tvOS

tvOS-Simulator

visionOS

visionOS-Simulator

Apple xcframework

  • Build for Linux / NVIDIA Jetson / Raspberry Pi3, Pi4 / POWER
Ubuntu 22.04

Ubuntu 24.04

  • Build for Windows x64 using VS2017
  • Build for Windows x64 using MinGW-w64
VS2015

VS2017

VS2019

VS2022

  • Build for WebAssembly
WebAssembly

  • Build for ARM Cortex-A family with cross-compiling
  • Build for Hisilicon platform with cross-compiling
  • Build for AllWinner D1
  • Build for Loongson 2K1000
  • Build for QNX
Linux (arm)

Linux (aarch64)

Linux (mips)

Linux (mips64)

Linux (ppc64)

[](https://github.com/Tencent/ncnn/actions?query=workflow%3Al

Issues· 1217 open

View all issuesOpen on GitHub
  • #7033

    邀请 ncnn 加入 GithubStarMate,让更多人发现你的作品

    Updated Sep 30, 2026
  • #7031

    `load_param_bin` 加载含未量化层(`int8_scale_term=0`)的 ncnn2int8 部分量化模型时推理输出错误——同一模型的文本 `load_param` 加载结果正确[BUG]

    Updated Sep 30, 2026
  • #7025

    Heap-buffer-overflow in Concat::forward (AVX and generic x86 kernel) with multi-scale YOLO export

    Updated Sep 29, 2026
  • #6766

    SGEMM (im2col + GEMM) convolution path may occasionally output NaN due to uninitialized workspace memory reuse

    Updated Sep 29, 2026
  • #6843

    Access violation 0xC0000005 during Vulkan GPU initialization on Windows with RTX 5060 + Intel Graphics

    Updated Sep 29, 2026
  • #6932

    ARM fp16 arithmetic produces all-NaN output for a ViT-tiny graph / model (ncnn 20260526)

    Updated Sep 25, 2026
  • #7019

    aarch64:padding 之后内核分发使用了过期的 elempack → `conv3x3s2_pack4_neon` 越界读(非确定性 NaN / SIGSEGV),触发输入为合法的 dims=2 Mat

    Updated Sep 23, 2026
  • #6818

    YOLOv8 detection results on Mali-G720 Vulkan GPU (CPU results are correct)

    Updated Sep 15, 2026
  • #6981

    feature plan

    enhancementUpdated Sep 15, 2026
  • #6987

    AMD CPU SDPA result error

    Updated Sep 14, 2026

> Tags

C++androidarm-neonartificial-intelligencecaffe

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库