• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H25-May-2021-946539

ncnn/H25-May-2021-3,9522,792

pybind11/H25-May-2021-

src/H25-May-2021-1,7241,471

tests/H25-May-2021-1,4641,026

README.mdH A D25-May-20212.1 KiB128101

setup.py.iH A D25-May-20211.5 KiB4941

README.md

1# ncnn
2python wrapper of ncnn with [pybind11](https://github.com/pybind/pybind11), only support python3.x now.
3
4
5Install from pip
6==================
7
8ncnn is available as wheel packages for macOS, Windows and Linux distributions, you can install with pip:
9
10```
11python -m pip install -U pip
12python -m pip install -U ncnn
13```
14
15# Build from source
16
17If you want to build ncnn with some options not as default, or just like to build everything yourself, it is not difficult to build ncnn from source.
18
19## Prerequisites
20
21**On Unix (Linux, OS X)**
22
23* A compiler with C++11 support
24* CMake >= 3.4
25
26**On Mac**
27
28* A compiler with C++11 support
29* CMake >= 3.4
30
31**On Windows**
32
33* Visual Studio 2015 or higher
34* CMake >= 3.4
35
36## Build
371. clone ncnn and init submodule.
38```bash
39cd /pathto/ncnn
40git submodule init && git submodule update
41```
422. build.
43```bash
44mkdir build
45cd build
46cmake -DNCNN_PYTHON=ON ..
47make
48```
49
50## Install
51```bash
52cd /pathto/ncnn/python
53pip install .
54```
55
56if you use conda or miniconda, you can also install as following:
57```bash
58cd /pathto/ncnn/python
59python3 setup.py install
60```
61
62## Tests
63**test**
64```bash
65cd /pathto/ncnn/python
66python3 tests/test.py
67```
68
69**benchmark**
70
71```bash
72cd /pathto/ncnn/python
73python3 tests/benchmark.py
74```
75
76## Numpy
77**ncnn.Mat->numpy.array, with no memory copy**
78
79```bash
80mat = ncnn.Mat(...)
81mat_np = np.array(mat)
82```
83
84**numpy.array->ncnn.Mat, with no memory copy**
85```bash
86mat_np = np.array(...)
87mat = ncnn.Mat(mat_np)
88```
89
90# Model Zoo
91install requirements
92```bash
93pip install -r requirements.txt
94```
95then you can import ncnn.model_zoo and get model list as follow:
96```bash
97import ncnn
98import ncnn.model_zoo as model_zoo
99
100print(model_zoo.get_model_list())
101```
102models now in model zoo are as list below:
103```bash
104mobilenet_yolov2
105mobilenetv2_yolov3
106yolov4_tiny
107yolov4
108yolov5s
109yolact
110mobilenet_ssd
111squeezenet_ssd
112mobilenetv2_ssdlite
113mobilenetv3_ssdlite
114squeezenet
115faster_rcnn
116peleenet_ssd
117retinaface
118rfcn
119shufflenetv2
120simplepose
121nanodet
122```
123all model in model zoo has example in ncnn/python/examples folder
124
125# Custom Layer
126
127custom layer demo is in ncnn/python/ncnn/model_zoo/yolov5.py:23
128