Tencent/ncnn — 24.0k★ trên GitHub (C++). ncnn is a high-performance neural network inference framework optimized for the mobile platform
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
The recommended beginner path is PyTorch -> pnnx -> ncnn.
Install pnnx in a PyTorch environment
pip3 install pnnx
Export a PyTorch model to ncnn
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
#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
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.
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
Ubuntu 26.04
Build for Windows x64 using VS2017
Build for Windows x64 using MinGW-w64
VS2015
VS2017
VS2019
VS2022
VS2026
Build for WebAssembly
WebAssembly
WebAssembly64
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)
Linux (riscv64)
Linux (loongarch64)
Build
Use the prebuilt packages above when possible. To build from source, see the full how to build ncnn library guide for Linux, Windows, macOS, Android, iOS, WebAssembly, HarmonyOS, Raspberry Pi, Jetson, and embedded targets.
Common Linux build:
git clone --recursive https://github.com/Tencent/ncnn.git
cd ncnn
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=ON ..
cmake --build . -j$(nproc)
Model Conversion
Source model
Recommended path
Docs
PyTorch
pnnx.export(model, "model.pt", (input_tensor,)) or pnnx model.pt inputshape=[...]
pnnx, PyTorch / ONNX guide
ONNX
pnnx model.onnx
pnnx, onnx tools
ncnn model optimization
ncnnoptimize model.param model.bin new.param new.bin flag
quantization, model file spec
Legacy Caffe / MXNet / Darknet
Use compatibility converters when maintaining older models
caffe, mxnet, darknet, AlexNet legacy tutorial
Use Netron to inspect .param, .onnx, and .pnnx.param graphs.
Features
No third-party runtime dependencies and no BLAS / NNPACK requirement.
Pure C++ implementation with C API and Python binding.
Optimized CPU inference for mobile and embedded processors, including ARM NEON and multi-core scheduling.
Vulkan GPU acceleration for supported platforms.
Low memory footprint with explicit blob/workspace allocator design.
Supports multi-input, multi-output, and multi-branch graphs.
PyTorch and ONNX conversion through pnnx, plus legacy converter support for older model formats.
Supports fp16 storage/arithmetic paths, int8 quantized inference, model optimization, and custom layers.
Direct memory reference loading for .param and .bin models.
Model and Workload Coverage
ncnn is still strong for classic and mobile CNN workloads, but current usage is broader than CNN-only deployment.
Tencent/ncnn thuộc nhóm AI Tools trên TopGit, cùng 20 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về Tencent/ncnn ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/Tencent/ncnn là nguồn chính thức.
Tencent/ncnn có bao nhiêu sao?
Tencent/ncnn có 24.0k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/Tencent/ncnn. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Commit gần nhất trên Tencent/ncnn là 3 tháng trước (theo timestamp GitHub). Repo có 4.5k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Tencent/ncnn viết bằng ngôn ngữ gì?
Tencent/ncnn chủ yếu viết bằng C++. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao Tencent/ncnn được xếp vào nhóm AI Tools?
TopGit xếp Tencent/ncnn vào nhóm AI Tools dựa trên GitHub topics và mô tả của repo (gắn thẻ: "android", "arm-neon", "artificial-intelligence"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về ncnn?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về ncnn.