Git Product home page Git Product logo

pyncnn's Introduction

pyncnn

python wrapper of ncnn with pybind11, only support python3.x now.

Prerequisites

On Unix (Linux, OS X)

  • A compiler with C++11 support
  • CMake >= 2.8.12

On Windows

  • Visual Studio 2015
  • CMake >= 3.1

Build

  1. clone ncnn and pybind11, build and install with default setting, if you change the install directory, change the cmake commond with your setting.
  2. change /path/to to your path and running the following cmd
cd /path/to/pyncnn
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/path/to/ncnn/build/install/lib/cmake/ncnn/ ..
make
cd ../python
pip install .

Tests

test

cd /path/to/pyncnn/tests
python3 test.py

benchmark

cd /path/to/pyncnn/tests
python3 benchmark.py

benchmark gpu(build ncnn with vulkan)

cd /path/to/pyncnn/tests
python3 benchmark_gpu.py

numpy

ncnn.Mat->numpy.array, with no memory copy

mat = ncnn.Mat(...)
mat_np = np.array(mat)

numpy.array->ncnn.Mat, with no memory copy

mat_np = np.array(...)
mat = ncnn.Mat(mat_np)

model zoo

install requirements

pip install tqdm requests portalocker opencv-python

then you can import ncnn.model_zoo and get model list as follow:

import ncnn
import ncnn.model_zoo as model_zoo

print(model_zoo.get_model_list())

all model in model zoo has example in examples folder

pyncnn's People

Contributors

caishanli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.