Code Monkey home page Code Monkey logo

pyncnn's People

Contributors

caishanli avatar tpoisonooo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyncnn's Issues

make报错

前边编译都没问题,进行到make那一步的时候报这种错是怎么回事呢?
image

import error

编译完成后 在./pyncnn/python路径下 import ncnn没有报错,但是,换个路径出现ModuleNotFoundError,这个问题的原因大概是什么?

cmake 出错

在build目录执行cmake -DCMAKE_PREFIX_PATH=/home/pi/ncnn/ncnn/build/install/lib/cmake/ncnn/ ..
出错:
CMake Error at /usr/share/cmake-3.13/Modules/FindPython/Support.cmake:1236 (add_library):
No SOURCES given to target: pyncnn
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPython3.cmake:167 (__Python3_add_library)
/usr/local/share/cmake/pybind11/pybind11NewTools.cmake:138 (python3_add_library)
CMakeLists.txt:24 (pybind11_add_module)

Issues on installing

Hello
Did u check the installation?
First, there are your customized paths in the CMakeLists.txt.

image

I changed the paths.
Secondly, I met the following issue when configure with cmake.

image

So I commented the command find_package(Python3) in CMakeLists.txt and the above issue was disappeared.

Lastly, when building with make command, I met the following issue again.

image

Please let me know the solution.
Thanks

how to make on windows10

i followed the steps to build pyncnn, but until the make step, it reportd error:
image

If i try nmake, there is still errors:

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.7.5
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>cd C:\MachineLearning\CV\ncnn\pyncnn\build

C:\MachineLearning\CV\ncnn\pyncnn\build>cmake -G"NMake Makefiles" -DCMAKE_PREFIX_PATH=../build/install/lib/cmake/ncnn/ ..
-- The C compiler identification is MSVC 19.27.29112.0
-- The CXX compiler identification is MSVC 19.27.29112.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Found Vulkan: C:/VulkanSDK/1.2.148.1/Lib/vulkan-1.lib
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PythonInterp: C:/ProgramData/Anaconda3/python.exe (found version "3.7.4")
-- Found PythonLibs: C:/ProgramData/Anaconda3/libs/python37.lib
-- Performing Test HAS_MSVC_GL_LTCG
-- Performing Test HAS_MSVC_GL_LTCG - Success
-- Found pybind11: C:/ProgramData/Anaconda3/Lib/site-packages/pybind11/include (found version "2.6.1" )
-- Configuring done
-- Generating done
-- Build files have been written to: C:/MachineLearning/CV/ncnn/pyncnn/build

C:\MachineLearning\CV\ncnn\pyncnn\build>nmake

Microsoft (R) 程序维护实用工具 14.27.29112.0 版
版权所有 (C) Microsoft Corporation。  保留所有权利。

Scanning dependencies of target pyncnn
[ 50%] Building CXX object CMakeFiles/pyncnn.dir/src/main.cpp.obj
main.cpp
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(1835): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(2233): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(334): warning C4477: “sprintf”: 格式字符串“%ld”需要类型“long”的参数,但可变参数 5 拥有了类型“const size_t”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(334): note: 请考虑在格式字符串中使用“%zd”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(334): warning C4477: “sprintf”: 格式字符串“%ld”需要类型“long”的参数,但可变参数 6 拥有了类型“const size_t”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(334): note: 请考虑在格式字符串中使用“%zd”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(433): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,size_t,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(433): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(437): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,int,size_t,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(437): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(441): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,int,int,size_t,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(441): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(446): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,size_t,int,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(446): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(450): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,int,size_t,int,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(450): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(454): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(int,int,int,size_t,int,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(454): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(459): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(const ncnn::Mat &,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(459): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(459): error C2672: “pybind11::class_<ncnn::VkMat>::def”: 未找到匹配的重载函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2784: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)”: 未能从“const char [12]”为“pybind11::detail::initimpl::pickle_factory<Args...> &&”推导 模板 参数
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1313): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2784: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)”: 未能从“const char [12]”为“pybind11::detail::initimpl::factory<Args...> &&”推导 模板 参数
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1307): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2784: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)”: 未能从“const char [12]”为“const pybind11::detail::initimpl::alias_constructor<Args...> &”推导 模板 参数
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1301): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2784: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)”: 未能从“const char [12]”为“const pybind11::detail::initimpl::constructor<Args...> &”推导 模板 参数
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1295): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2784: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(const pybind11::detail::op_<id,ot,L,R> &,const Extra &...)”: 未能从“const char [12]”为“const pybind11::detail::op_<id,ot,L,R> &”推导 模板 参数
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1283): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2780: “pybind11::class_<ncnn::VkMat> &pybind11::class_<ncnn::VkMat>::def(const char *,Func &&,const Extra &...)”: 应输入 3 个参数,却提供了 1 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1265): note: 参见“pybind11::class_<ncnn::VkMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(460): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“void (__cdecl ncnn::VkMat::* )(const ncnn::VkMat &,ncnn::VkAllocator *,ncnn::VkAllocator *)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(460): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(461): error C2039: "prepare_staging_buffer": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “prepare_staging_buffer”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(462): error C2039: "discard_staging_buffer": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “discard_staging_buffer”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(463): error C2039: "upload": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “upload”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(464): error C2039: "download": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “download”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(471): error C2039: "channel": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “channel”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(472): error C2039: "channel": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(473): error C2039: "channel_range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “channel_range”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(474): error C2039: "channel_range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(475): error C2039: "row_range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “row_range”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(476): error C2039: "row_range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(477): error C2039: "range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “range”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(478): error C2039: "range": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(482): error C2039: "staging_buffer_offset": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “staging_buffer_offset”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(484): error C2039: "offset": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “offset”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(485): error C2039: "staging_data": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “staging_data”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(487): error C2039: "staging_refcount": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “staging_refcount”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(491): error C2039: "staging_allocator": 不是 "ncnn::VkMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(292): note: 参见“ncnn::VkMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(377): error C2065: “staging_allocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(500): error C2065: “VkImageAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2059: 语法错误:“>”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2144: 语法错误:“unknown-type”的前面应有“)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(500): error C2672: “pybind11::class_<ncnn::VkImageMat>::def”: 未找到匹配的重载函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(pybind11::detail::initimpl::pickle_factory<Args...> &&,const Extra &...)”: 应输入 2 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1313): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(pybind11::detail::initimpl::factory<Args...> &&,const Extra &...)”: 应输入 2 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1307): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(const pybind11::detail::initimpl::alias_constructor<Args...> &,const Extra &...)”: 应输入 2 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1301): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(const pybind11::detail::initimpl::constructor<Args...> &,const Extra &...)”: 应输入 2 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1295): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(const pybind11::detail::op_<id,ot,L,R> &,const Extra &...)”: 应输入 2 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1283): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2780: “pybind11::class_<ncnn::VkImageMat> &pybind11::class_<ncnn::VkImageMat>::def(const char *,Func &&,const Extra &...)”: 应 输入 3 个参数,却提供了 0 个
C:\ProgramData\Anaconda3\Lib\site-packages\pybind11\include\pybind11/pybind11.h(1265): note: 参见“pybind11::class_<ncnn::VkImageMat>::def”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2144: 语法错误:“unknown-type”的前面应有“;”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(498): error C2059: 语法错误:“)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(502): error C2065: “VkImageAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(513): error C2039: "width": 不是 "ncnn::VkImageMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(402): note: 参见“ncnn::VkImageMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(514): error C2039: "height": 不是 "ncnn::VkImageMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(402): note: 参见“ncnn::VkImageMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(515): error C2039: "format": 不是 "ncnn::VkImageMat" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\mat.h(402): note: 参见“ncnn::VkImageMat”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(531): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“int (__cdecl ncnn::Extractor::* )(const char *,ncnn::Mat &,int)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(531): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(535): error C2440: “类型强制转换”: 无法从“overloaded-function”转换为“int (__cdecl ncnn::Extractor::* )(int,ncnn::Mat &,int)”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(535): note: 在匹配目标类型的范围内没有具有该名称的函数
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(792): error C2039: "state": 不是 "ncnn::VkBufferMemory" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\allocator.h(207): note: 参见“ncnn::VkBufferMemory”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(785): error C2065: “state”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(797): error C2039: "memory_type_index": 不是 "ncnn::VkAllocator" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\gpu.h(171): note: 参见“ncnn::VkAllocator”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(795): error C2065: “memory_type_index”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2065: “VkBlobBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2065: “VkBlobBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2923: “PyVkAllocatorOther”: 对于参数“Other”,“VkBlobBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2923: “pybind11::class_”: 对于参数“type_”,“VkBlobBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C3203: “PyVkAllocatorOther”: 未专用化的 类 模板 不能用作 模板 变量,该变量属于 模板 参数“options”,应为 real 类型
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2440: “<function-style-cast>”: 无法从“initializer list”转换为“pybind11::class_”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): note: 无构造函数可以接受源类型,或构造函数重载决策不明确
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(800): error C2653: “VkBlobBufferAllocator”: 不是类或命名空间名称
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(802): error C2065: “clear”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2065: “VkWeightBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2065: “VkWeightBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2923: “PyVkAllocatorOther”: 对于参数“Other”,“VkWeightBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2923: “pybind11::class_”: 对于参数“type_”,“VkWeightBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C3203: “PyVkAllocatorOther”: 未专用化的 类 模板 不能用作 模板 变量,该变量属于 模板 参数“options”,应为 real 类型
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2440: “<function-style-cast>”: 无法从“initializer list”转换为“pybind11::class_”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): note: 无构造函数可以接受源类型,或构造函数重载决策不明确
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(805): error C2653: “VkWeightBufferAllocator”: 不是类或命名空间名称
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(807): error C2065: “clear”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2065: “VkStagingBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2065: “VkStagingBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2923: “PyVkAllocatorOther”: 对于参数“Other”,“VkStagingBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2923: “pybind11::class_”: 对于参数“type_”,“VkStagingBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C3203: “PyVkAllocatorOther”: 未专用化的 类 模板 不能用作 模板 变量,该变量属于 模板 参数“options”,应为 real 类型
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2440: “<function-style-cast>”: 无法从“initializer list”转换为“pybind11::class_”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): note: 无构造函数可以接受源类型,或构造函数重载决策不明确
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(810): error C2653: “VkStagingBufferAllocator”: 不是类或命名空间名称
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(812): error C2065: “set_size_compare_ratio”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(813): error C2065: “clear”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2065: “VkWeightStagingBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2065: “VkWeightStagingBufferAllocator”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2923: “PyVkAllocatorOther”: 对于参数“Other”,“VkWeightStagingBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2923: “pybind11::class_”: 对于参数“type_”,“VkWeightStagingBufferAllocator”不是有效的 模板 类型变量
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C3203: “PyVkAllocatorOther”: 未专用化的 类 模板 不能用作 模板 变量,该变量属于 模板 参数“options”,应为 real 类型
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2440: “<function-style-cast>”: 无法从“initializer list”转换为“pybind11::class_”
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): note: 无构造函数可以接受源类型,或构造函数重载决策不明确
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(816): error C2653: “VkWeightStagingBufferAllocator”: 不是类或命名空间名称
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(826): error C2039: "state": 不是 "ncnn::VkImageMemory" 的成员
C:\MachineLearning\CV\ncnn\build\install\include\ncnn\allocator.h(227): note: 参见“ncnn::VkImageMemory”的声明
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(821): error C2065: “state”: 未声明的标识符
C:\MachineLearning\CV\ncnn\pyncnn\src\main.cpp(821): fatal error C1003: 错误计数超过 100;正在停止编译
NMAKE : fatal error U1077: “C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x64\cl.exe”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\nmake.exe"”: 返回代码“0x2”
Stop.

关于数据预处理部分

感谢大佬的分享,但是我有一个疑问,我把数据处理完毕带进ncnn出来的结果不正确,但是把预处理部分放进ncnn去处理,出来的结果是正确的,两种方式结果不应该是一样的吗?
下面分别是两种方式的代码
方式一:
`import time
import ncnn
from PIL import Image
import cv2
import numpy as np
from torchvision.transforms import functional as F
from torchvision import transforms

def data_transform(img, im_size):
MEAN = [0.485, 0.456, 0.406]
STD = [0.229, 0.224, 0.225]
img = img.resize(im_size, Image.BILINEAR)
img = F.to_tensor(img) # convert to tensor (values between 0 and 1)
img = F.normalize(img, MEAN, STD) # normalize the tensor
return img

net = ncnn.Net()
net.load_param("espnetv2.param")
net.load_model("espnetv2.bin")
imagepath = '8.jpg'
img = cv2.imread(imagepath)
n_mat = ncnn.Mat(w=512, h=512, c=3)
w, h = img.shape[:2]
out_mat = ncnn.Mat()
mat_in = ncnn.Mat.from_pixels_resize(img, ncnn.Mat.PixelType.PIXEL_BGR2RGB,h,w,512,512)
mean_vals = [0.485255, 0.456255, 0.406*255];
mean_stds = [1/0.229/255, 1/0.224/255, 1/0.225/255];
mat_in.substract_mean_normalize(mean_vals, mean_stds)
ex = net.create_extractor()
ex.input("input.1", mat_in)
mat_out = ncnn.Mat()
ex.extract("1294", mat_out)
out = np.array(mat_out)
img_out = np.argmax(out,axis=0)

img_out = Image.fromarray(np.uint8(img_out*255))
img_out.show()`

方式二:
`import time
import ncnn
from PIL import Image
import cv2
import numpy as np
from torchvision.transforms import functional as F
from torchvision import transforms

def data_transform(img, im_size):
MEAN = [0.485, 0.456, 0.406]
STD = [0.229, 0.224, 0.225]
img = img.resize(im_size, Image.BILINEAR)
img = F.to_tensor(img) # convert to tensor (values between 0 and 1)
img = F.normalize(img, MEAN, STD) # normalize the tensor
return img
net = ncnn.Net()
net.load_param("espnetv2.param")
net.load_model("espnetv2.bin")

imagepath = '8.jpg'
img = Image.open(imagepath).convert('RGB')
w, h = img.size
img = data_transform(img, (512,512))
in_mat = ncnn.Mat(w=512, h=512, c=3)
img_numpy = img.numpy()
out_mat = ncnn.Mat()
mat_in = ncnn.Mat.from_pixels(img_numpy, ncnn.Mat.PixelType.PIXEL_RGB,h,w)
ex = net.create_extractor()
ex.input("input.1", mat_in)
mat_out = ncnn.Mat()
ex.extract("1294", mat_out)
out = np.array(mat_out)
img_out = np.argmax(out,axis=0)

img_out = Image.fromarray(np.uint8(img_out*255))
img_out.show()
`
data.zip

Support for the latest NCNN

Hello
How are you?
Thanks for contributing this project.
I am going to use this python binding for NCNN.
I set all the parameters and configured with cmake exactly.
While building I met the following issue.

image

Could u help me to solve this issue?
Thanks

where to place the pybind11 folder

i know nothing about cmake , i have success make ncnn and pybind11 .but just cmake the pyncnn always said:

`CMake Error at CMakeLists.txt:13 (find_package):
By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "pybind11",
but CMake did not find one.

Could not find a package configuration file provided by "pybind11" with any
of the following names:

pybind11Config.cmake
pybind11-config.cmake

Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
"pybind11_DIR" to a directory containing one of the above files. If
"pybind11" provides a separate development package or SDK, be sure it has
been installed.
`
what is the problem? and how to change the cmake file

ncnn.Mat ---> np.array

Thank you very much for sharing. I would like to know if there is any dimensional conversion when converting between ncnn.Mat and np.array. When checking the value of ncnn.Mat and the value of np.array, the corresponding relationship is What, looking forward to your answer.

Test出错

安装完运行test.py时报下面这个错误,
ModuleNotFoundError: No module named 'ncnn.ncnn'
不知道是什么原因。

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.