[Fix] Fix recent build problems (#544)
* simplify deps management * skip visibility flags for MSVC * simplify cuda deps * naming * workaround for cmake<3.17 * add spdlog dependency * move the enablement of CUDA to top level CMakeLists.txt * fix MSVC build * fix lint * fix build for backend ops only * remove comment * allow to use apis/python as a standalone project * remove redundant cmake code * control shared or static lib using `MMDEPLOY_SHARED_LIBS` instead of `BUILD_SHARED_LIBS` * fix MSVC build * update docspull/555/head
parent
51f630b22c
commit
567ec62296
|
@ -4,3 +4,6 @@
|
||||||
[submodule "third_party/pybind11"]
|
[submodule "third_party/pybind11"]
|
||||||
path = third_party/pybind11
|
path = third_party/pybind11
|
||||||
url = https://github.com/pybind/pybind11.git
|
url = https://github.com/pybind/pybind11.git
|
||||||
|
[submodule "third_party/spdlog"]
|
||||||
|
path = third_party/spdlog
|
||||||
|
url = https://github.com/gabime/spdlog.git
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
|
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "MMDeploy's installation directory")
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "installation directory")
|
||||||
endif ()
|
endif ()
|
||||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
|
@ -19,21 +19,28 @@ endif ()
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
option(BUILD_SHARED_LIBS "build shared lib" ON)
|
option(MMDEPLOY_SHARED_LIBS "build shared libs" ON)
|
||||||
option(MMDEPLOY_BUILD_MODEL_OPTIMIZER "build MMDeploy's model optimizer" ON)
|
option(MMDEPLOY_BUILD_SDK "build MMDeploy SDK" OFF)
|
||||||
option(MMDEPLOY_BUILD_SDK "build MMDeploy's SDK" OFF)
|
option(MMDEPLOY_BUILD_TEST "build unittests" OFF)
|
||||||
option(MMDEPLOY_ZIP_MODEL "support sdk model in zip format" OFF)
|
option(MMDEPLOY_BUILD_SDK_PYTHON_API "build SDK Python API" OFF)
|
||||||
option(MMDEPLOY_BUILD_SDK_CSHARP_API "build MMDeployExtern.dll for C# API" OFF)
|
option(MMDEPLOY_BUILD_SDK_CXX_API "build SDK C++ API" OFF)
|
||||||
option(MMDEPLOY_BUILD_TEST "build MMDeploy's csrc's unittest" OFF)
|
option(MMDEPLOY_BUILD_SDK_CSHARP_API "build SDK C# API support" OFF)
|
||||||
set(MMDEPLOY_TARGET_DEVICES
|
option(MMDEPLOY_SPDLOG_EXTERNAL "use external spdlog" OFF)
|
||||||
"cpu" CACHE STRING "MMDeploy's target devices")
|
option(MMDEPLOY_ZIP_MODEL "support SDK model in zip format" OFF)
|
||||||
set(MMDEPLOY_TARGET_BACKENDS "" CACHE STRING "MMDeploy's target inference engines")
|
set(MMDEPLOY_TARGET_DEVICES "cpu" CACHE STRING "target devices to support")
|
||||||
set(MMDEPLOY_CODEBASES "all" CACHE STRING "select OpenMMLab's codebases")
|
set(MMDEPLOY_TARGET_BACKENDS "" CACHE STRING "target inference engines to support")
|
||||||
|
set(MMDEPLOY_CODEBASES "all" CACHE STRING "select OpenMMLab codebases")
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "choose 'Release' as default build type" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "choose 'Release' as default build type" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (MMDEPLOY_SHARED_LIBS)
|
||||||
|
set(MMDEPLOY_LIB_TYPE SHARED)
|
||||||
|
else ()
|
||||||
|
set(MMDEPLOY_LIB_TYPE STATIC)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# when CUDA devices are enabled, the environment variable ASAN_OPTIONS=protect_shadow_gap=0
|
# when CUDA devices are enabled, the environment variable ASAN_OPTIONS=protect_shadow_gap=0
|
||||||
# must be set at runtime
|
# must be set at runtime
|
||||||
if (MMDEPLOY_ASAN_ENABLE)
|
if (MMDEPLOY_ASAN_ENABLE)
|
||||||
|
@ -53,16 +60,20 @@ if (MSVC)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/Zc:preprocessor>) # /experimental:preprocessor on VS2017
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/Zc:preprocessor>) # /experimental:preprocessor on VS2017
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>)
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4251>)
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4251>)
|
||||||
else ()
|
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fvisibility=hidden>)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
add_library(MMDeployStaticModules INTERFACE)
|
add_library(MMDeployStaticModules INTERFACE)
|
||||||
add_library(MMDeployDynamicModules INTERFACE)
|
add_library(MMDeployDynamicModules INTERFACE)
|
||||||
add_library(MMDeployLibs INTERFACE)
|
add_library(MMDeployLibs INTERFACE)
|
||||||
|
|
||||||
|
if ((cuda IN_LIST MMDEPLOY_TARGET_DEVICES) OR (trt IN_LIST MMDEPLOY_TARGET_BACKENDS))
|
||||||
|
include(cmake/cuda.cmake NO_POLICY_SCOPE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# this must come after including cuda.cmake because policies in function scope is captured
|
||||||
|
# at function definition
|
||||||
|
include(cmake/MMDeploy.cmake)
|
||||||
|
|
||||||
add_subdirectory(csrc)
|
add_subdirectory(csrc)
|
||||||
|
|
||||||
if (MMDEPLOY_BUILD_SDK)
|
if (MMDEPLOY_BUILD_SDK)
|
||||||
|
@ -84,6 +95,9 @@ if (MMDEPLOY_BUILD_SDK)
|
||||||
FILE MMDeployTargets.cmake
|
FILE MMDeployTargets.cmake
|
||||||
DESTINATION lib/cmake/MMDeploy)
|
DESTINATION lib/cmake/MMDeploy)
|
||||||
|
|
||||||
|
if (MMDEPLOY_SPDLOG_EXTERNAL)
|
||||||
|
set(SPDLOG_DEPENDENCY "find_package(spdlog QUIET)")
|
||||||
|
endif ()
|
||||||
# append backend deps
|
# append backend deps
|
||||||
mmdeploy_add_deps(trt BACKENDS ${MMDEPLOY_TARGET_BACKENDS} DEPS TENSORRT CUDNN)
|
mmdeploy_add_deps(trt BACKENDS ${MMDEPLOY_TARGET_BACKENDS} DEPS TENSORRT CUDNN)
|
||||||
mmdeploy_add_deps(ort BACKENDS ${MMDEPLOY_TARGET_BACKENDS} DEPS ONNXRUNTIME)
|
mmdeploy_add_deps(ort BACKENDS ${MMDEPLOY_TARGET_BACKENDS} DEPS ONNXRUNTIME)
|
||||||
|
@ -110,13 +124,24 @@ if (MMDEPLOY_BUILD_SDK)
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/MMDeployConfig.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/MMDeployConfig.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/MMDeployConfigVersion.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/MMDeployConfigVersion.cmake
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/MMDeploy.cmake
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/MMDeploy.cmake
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/loader.cpp.in
|
|
||||||
DESTINATION lib/cmake/MMDeploy
|
DESTINATION lib/cmake/MMDeploy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/loader.cpp.in
|
||||||
|
DESTINATION lib/cmake/MMDeploy
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
install(DIRECTORY
|
install(DIRECTORY
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
|
||||||
DESTINATION lib/cmake/MMDeploy
|
DESTINATION lib/cmake/MMDeploy
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example)
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/demo/csrc/ DESTINATION example)
|
||||||
|
|
||||||
|
if (${CMAKE_VERSION} VERSION_LESS "3.17.0")
|
||||||
|
install(SCRIPT cmake/post-install.cmake)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -14,8 +14,18 @@ endfunction ()
|
||||||
|
|
||||||
|
|
||||||
function (mmdeploy_add_library NAME)
|
function (mmdeploy_add_library NAME)
|
||||||
|
# EXCLUDE: exclude from registering & exporting
|
||||||
cmake_parse_arguments(_MMDEPLOY "EXCLUDE" "" "" ${ARGN})
|
cmake_parse_arguments(_MMDEPLOY "EXCLUDE" "" "" ${ARGN})
|
||||||
add_library(${NAME} ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
# search for add_library keywords
|
||||||
|
cmake_parse_arguments(_TYPE "STATIC;SHARED;MODULE" "" "" ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
||||||
|
set(_MAYBE_TYPE)
|
||||||
|
if (NOT (_TYPE_STATIC OR _TYPE_SHARED OR _TYPE_MODULE))
|
||||||
|
set(_MAYBE_TYPE ${MMDEPLOY_LIB_TYPE})
|
||||||
|
endif ()
|
||||||
|
add_library(${NAME} ${_MAYBE_TYPE} ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
||||||
|
if (NOT MSVC)
|
||||||
|
target_compile_options(${NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fvisibility=hidden>)
|
||||||
|
endif ()
|
||||||
target_compile_definitions(${NAME} PRIVATE -DMMDEPLOY_API_EXPORTS=1)
|
target_compile_definitions(${NAME} PRIVATE -DMMDEPLOY_API_EXPORTS=1)
|
||||||
get_target_property(_TYPE ${NAME} TYPE)
|
get_target_property(_TYPE ${NAME} TYPE)
|
||||||
if (_TYPE STREQUAL STATIC_LIBRARY)
|
if (_TYPE STREQUAL STATIC_LIBRARY)
|
||||||
|
@ -36,19 +46,25 @@ function (mmdeploy_add_module NAME)
|
||||||
# LIBRARY: the module is also a library (add_libray with SHARED instead of MODULE)
|
# LIBRARY: the module is also a library (add_libray with SHARED instead of MODULE)
|
||||||
cmake_parse_arguments(_MMDEPLOY "EXCLUDE;LIBRARY" "" "" ${ARGN})
|
cmake_parse_arguments(_MMDEPLOY "EXCLUDE;LIBRARY" "" "" ${ARGN})
|
||||||
# search for add_library keywords
|
# search for add_library keywords
|
||||||
cmake_parse_arguments(_KW "STATIC;SHARED;MODULE" "" "" ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
cmake_parse_arguments(_TYPE "STATIC;SHARED;MODULE" "" "" ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
||||||
|
|
||||||
set(_MAYBE_MODULE)
|
set(_MAYBE_TYPE)
|
||||||
# no library type specified
|
# no library type specified
|
||||||
if (NOT (_KW_STATIC OR _KW_SHARED OR _KW_MODULE))
|
if (NOT (_TYPE_STATIC OR _TYPE_SHARED OR _TYPE_MODULE))
|
||||||
# shared but not marked as a library, build module library so that no .lib dependency
|
# shared but not marked as a library, build module library so that no .lib dependency
|
||||||
# will be generated for MSVC
|
# will be generated for MSVC
|
||||||
if (MSVC AND BUILD_SHARED_LIBS AND NOT _MMDEPLOY_LIBRARY)
|
if (MSVC AND MMDEPLOY_SHARED_LIBS AND NOT _MMDEPLOY_LIBRARY)
|
||||||
set(_MAYBE_MODULE MODULE)
|
set(_MAYBE_TYPE MODULE)
|
||||||
|
else ()
|
||||||
|
set(_MAYBE_TYPE ${MMDEPLOY_LIB_TYPE})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library(${NAME} ${_MAYBE_MODULE} ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
add_library(${NAME} ${_MAYBE_TYPE} ${_MMDEPLOY_UNPARSED_ARGUMENTS})
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
target_compile_options(${NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fvisibility=hidden>)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# automatically link mmdeploy::core if exists
|
# automatically link mmdeploy::core if exists
|
||||||
if (TARGET mmdeploy::core)
|
if (TARGET mmdeploy::core)
|
||||||
|
|
|
@ -8,7 +8,7 @@ set(MMDEPLOY_CODEBASES @MMDEPLOY_CODEBASES@)
|
||||||
set(MMDEPLOY_TARGET_DEVICES @MMDEPLOY_TARGET_DEVICES@)
|
set(MMDEPLOY_TARGET_DEVICES @MMDEPLOY_TARGET_DEVICES@)
|
||||||
set(MMDEPLOY_TARGET_BACKENDS @MMDEPLOY_TARGET_BACKENDS@)
|
set(MMDEPLOY_TARGET_BACKENDS @MMDEPLOY_TARGET_BACKENDS@)
|
||||||
set(MMDEPLOY_BUILD_TYPE @CMAKE_BUILD_TYPE@)
|
set(MMDEPLOY_BUILD_TYPE @CMAKE_BUILD_TYPE@)
|
||||||
set(MMDEPLOY_BUILD_SHARED @BUILD_SHARED_LIBS@)
|
set(MMDEPLOY_BUILD_SHARED @MMDEPLOY_SHARED_LIBS@)
|
||||||
|
|
||||||
if (NOT MMDEPLOY_BUILD_SHARED)
|
if (NOT MMDEPLOY_BUILD_SHARED)
|
||||||
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
|
@ -26,6 +26,7 @@ endif ()
|
||||||
|
|
||||||
set(MMDEPLOY_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
|
set(MMDEPLOY_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
|
||||||
list(APPEND CMAKE_MODULE_PATH ${MMDEPLOY_MODULE_PATH})
|
list(APPEND CMAKE_MODULE_PATH ${MMDEPLOY_MODULE_PATH})
|
||||||
|
@SPDLOG_DEPENDENCY@
|
||||||
@TENSORRT_DEPENDENCY@
|
@TENSORRT_DEPENDENCY@
|
||||||
@CUDNN_DEPENDENCY@
|
@CUDNN_DEPENDENCY@
|
||||||
@ONNXRUNTIME_DEPENDENCY@
|
@ONNXRUNTIME_DEPENDENCY@
|
||||||
|
@ -34,7 +35,6 @@ list(APPEND CMAKE_MODULE_PATH ${MMDEPLOY_MODULE_PATH})
|
||||||
@pplnn_DEPENDENCY@
|
@pplnn_DEPENDENCY@
|
||||||
list(REMOVE_ITEM CMAKE_MODULE_PATH ${MMDEPLOY_MODULE_PATH})
|
list(REMOVE_ITEM CMAKE_MODULE_PATH ${MMDEPLOY_MODULE_PATH})
|
||||||
|
|
||||||
find_package(spdlog REQUIRED)
|
|
||||||
find_package(OpenCV REQUIRED)
|
find_package(OpenCV REQUIRED)
|
||||||
|
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
#message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
|
|
||||||
|
|
||||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0")
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0")
|
||||||
# suppress 'CMAKE_CUDA_ARCHITECTURES' warning
|
# suppress 'CMAKE_CUDA_ARCHITECTURES' warning
|
||||||
cmake_policy(SET CMP0104 OLD)
|
cmake_policy(SET CMP0104 OLD)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC OR (NOT DEFINED CMAKE_CUDA_RUNTIME_LIBRARY))
|
||||||
# use shared, on windows, python api can't build with static lib.
|
# use shared, on windows, python api can't build with static lib.
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
|
set(CMAKE_CUDA_RUNTIME_LIBRARY Shared)
|
||||||
|
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# nvcc compiler settings
|
# nvcc compiler settings
|
||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
#message(STATUS "CUDA VERSION: ${CUDA_VERSION_STRING}")
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc.exe)
|
set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc.exe)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
set(_TARGETS_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/MMDeploy/MMDeployTargets.cmake)
|
||||||
|
|
||||||
|
file(READ ${_TARGETS_PATH} _MMDEPLOY_TARGETS)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "::@<0x[a-z0-9]+>" ""
|
||||||
|
_MMDEPLOY_TARGETS_FIXED "${_MMDEPLOY_TARGETS}")
|
||||||
|
|
||||||
|
file(WRITE ${_TARGETS_PATH} "${_MMDEPLOY_TARGETS_FIXED}")
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindTENSORRT.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindTENSORRT.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindCUDNN.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindCUDNN.cmake)
|
||||||
find_path(
|
find_path(
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
add_subdirectory(backend_ops)
|
add_subdirectory(backend_ops)
|
||||||
|
|
||||||
if (MMDEPLOY_BUILD_SDK)
|
if (MMDEPLOY_BUILD_SDK)
|
||||||
|
# include OpenCV for SDK modules since many of them depends on it
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
||||||
|
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(execution)
|
add_subdirectory(execution)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(capis)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(capis)
|
||||||
|
|
||||||
set(COMMON_LIST
|
set(COMMON_LIST
|
||||||
common
|
common
|
||||||
|
|
|
@ -23,7 +23,7 @@ To use the nuget package, you also need to download the backend dependencies. Fo
|
||||||
|
|
||||||
**Step 0.** Build sdk.
|
**Step 0.** Build sdk.
|
||||||
|
|
||||||
Before building the c# api, you need to build sdk first. Please follow this [tutorial](../../../docs/en/build/windows.md)/[教程](../../../docs/zh_cn/build/windows.md) to build sdk. Remember to set the MMDEPLOY_BUILD_CSHARP_EXTERN option to ON. We recommend setting `BUILD_SHARED_LIBS` to OFF and use the static third party libraries(spdlog, pplcv, opencv, etc.). If so, you only need add the backend dependencies to your system path, or you need to add all dependencies.
|
Before building the c# api, you need to build sdk first. Please follow this [tutorial](../../../docs/en/build/windows.md)/[教程](../../../docs/zh_cn/build/windows.md) to build sdk. Remember to set the MMDEPLOY_BUILD_SDK_CSHARP_API option to ON. We recommend setting `MMDEPLOY_SHARED_LIBS` to OFF and use the static third party libraries(pplcv, opencv, etc.). If so, you only need add the backend dependencies to your system path, or you need to add all dependencies.
|
||||||
|
|
||||||
If you follow the tutorial, the MMDeployExtern.dll will be built in `build\bin\release`. Make sure the expected dll is in that path or the next step will throw a file-not-exist error.
|
If you follow the tutorial, the MMDeployExtern.dll will be built in `build\bin\release`. Make sure the expected dll is in that path or the next step will throw a file-not-exist error.
|
||||||
|
|
||||||
|
@ -42,4 +42,4 @@ dotnet build --configuration Release -p:Version=1.0.0
|
||||||
|
|
||||||
You can set the package-version through `Properties -> Package Version`. The default version is 1.0.0 if you don't set it.
|
You can set the package-version through `Properties -> Package Version`. The default version is 1.0.0 if you don't set it.
|
||||||
|
|
||||||
If you meets some missing dependencies error, follow the vs instructions.
|
If you encounter missing dependencies, follow the instructions for MSVC.
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
project(mmdeploy_python)
|
project(mmdeploy_python)
|
||||||
|
|
||||||
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
set(MMDEPLOY_PYTHON_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NOT TARGET pybind11)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if (${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/../../../third_party/pybind11
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/pybind11)
|
||||||
|
find_package(MMDeploy REQUIRED)
|
||||||
|
elseif (NOT TARGET pybind11)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/pybind11 pybind11)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/pybind11 pybind11)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(MMDEPLOY_PYTHON_SRCS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/common.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/executor.cpp)
|
|
||||||
|
|
||||||
macro(mmdeploy_python_add_module name)
|
macro(mmdeploy_python_add_module name)
|
||||||
if (TARGET mmdeploy_${name})
|
if (TARGET mmdeploy_${name})
|
||||||
list(APPEND MMDEPLOY_PYTHON_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp)
|
list(APPEND MMDEPLOY_PYTHON_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.cpp)
|
||||||
|
@ -36,5 +37,5 @@ mmdeploy_load_dynamic(${PROJECT_NAME} MMDeployDynamicModules)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE MMDeployLibs)
|
target_link_libraries(${PROJECT_NAME} PRIVATE MMDeployLibs)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
// Copyright (c) OpenMMLab. All rights reserved.
|
// Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
#include "apis/python/common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "core/value.h"
|
|
||||||
|
|
||||||
namespace mmdeploy {
|
namespace mmdeploy {
|
||||||
|
|
||||||
|
@ -34,6 +32,8 @@ mm_mat_t GetMat(const PyImage& img) {
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
py::object ConvertToPyObject(const Value& value) {
|
py::object ConvertToPyObject(const Value& value) {
|
||||||
switch (value.type()) {
|
switch (value.type()) {
|
||||||
case ValueType::kNull:
|
case ValueType::kNull:
|
||||||
|
@ -102,6 +102,8 @@ Value ConvertToValue(const py::object& obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace mmdeploy
|
} // namespace mmdeploy
|
||||||
|
|
||||||
PYBIND11_MODULE(mmdeploy_python, m) {
|
PYBIND11_MODULE(mmdeploy_python, m) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "apis/c/common.h"
|
#include "c/common.h"
|
||||||
#include "pybind11/numpy.h"
|
#include "pybind11/numpy.h"
|
||||||
#include "pybind11/pybind11.h"
|
#include "pybind11/pybind11.h"
|
||||||
#include "pybind11/stl.h"
|
#include "pybind11/stl.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright (c) OpenMMLab. All rights reserved.
|
// Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
#include "apis/python/common.h"
|
#include "common.h"
|
||||||
#include "core/utils/formatter.h"
|
#include "core/utils/formatter.h"
|
||||||
#include "execution/execution.h"
|
#include "execution/execution.h"
|
||||||
#include "execution/schedulers/inlined_scheduler.h"
|
#include "execution/schedulers/inlined_scheduler.h"
|
||||||
|
@ -47,16 +47,6 @@ using _python::PySender;
|
||||||
static void register_python_executor(py::module& m) {
|
static void register_python_executor(py::module& m) {
|
||||||
py::class_<PySender, std::unique_ptr<PySender>>(m, "PySender")
|
py::class_<PySender, std::unique_ptr<PySender>>(m, "PySender")
|
||||||
.def("__await__", &PySender::__await__);
|
.def("__await__", &PySender::__await__);
|
||||||
|
|
||||||
// m.def("test_async", [](const py::object& x) {
|
|
||||||
// static StaticThreadPool pool;
|
|
||||||
// TypeErasedScheduler<Value> scheduler{pool.GetScheduler()};
|
|
||||||
// auto sender = TransferJust(scheduler, ConvertToValue(x)) | Then([](Value x) {
|
|
||||||
// // std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
||||||
// return Value(x.get<int>() * x.get<int>());
|
|
||||||
// });
|
|
||||||
// return std::make_unique<PySender>(std::move(sender));
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PythonExecutorRegisterer {
|
class PythonExecutorRegisterer {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#include "pose_detector.h"
|
#include "pose_detector.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "core/logger.h"
|
|
||||||
|
|
||||||
namespace mmdeploy {
|
namespace mmdeploy {
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ using Rect = std::array<float, 4>;
|
||||||
class PyPoseDedector {
|
class PyPoseDedector {
|
||||||
public:
|
public:
|
||||||
PyPoseDedector(const char *model_path, const char *device_name, int device_id) {
|
PyPoseDedector(const char *model_path, const char *device_name, int device_id) {
|
||||||
MMDEPLOY_INFO("{}, {}, {}", model_path, device_name, device_id);
|
|
||||||
auto status =
|
auto status =
|
||||||
mmdeploy_pose_detector_create_by_path(model_path, device_name, device_id, &handle_);
|
mmdeploy_pose_detector_create_by_path(model_path, device_name, device_id, &handle_);
|
||||||
if (status != MM_SUCCESS) {
|
if (status != MM_SUCCESS) {
|
||||||
|
@ -26,9 +25,9 @@ class PyPoseDedector {
|
||||||
return py::list{};
|
return py::list{};
|
||||||
}
|
}
|
||||||
if (vboxes.size() != 0 && vboxes.size() != imgs.size()) {
|
if (vboxes.size() != 0 && vboxes.size() != imgs.size()) {
|
||||||
std::string error =
|
std::ostringstream os;
|
||||||
fmt::format("imgs length not equal with vboxes [{} vs {}]", imgs.size(), vboxes.size());
|
os << "imgs length not equal with vboxes [" << imgs.size() << " vs " << vboxes.size() << "]";
|
||||||
throw std::invalid_argument(error);
|
throw std::invalid_argument(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<mm_mat_t> mats;
|
std::vector<mm_mat_t> mats;
|
||||||
|
@ -51,7 +50,7 @@ class PyPoseDedector {
|
||||||
// full image
|
// full image
|
||||||
if (vboxes.size() == 0) {
|
if (vboxes.size() == 0) {
|
||||||
for (int i = 0; i < mats.size(); i++) {
|
for (int i = 0; i < mats.size(); i++) {
|
||||||
mm_rect_t box = {0.f, 0.f, mats[i].width - 1, mats[i].height - 1};
|
mm_rect_t box = {0.f, 0.f, mats[i].width - 1.f, mats[i].height - 1.f};
|
||||||
boxes.push_back(box);
|
boxes.push_back(box);
|
||||||
bbox_count.push_back(1);
|
bbox_count.push_back(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
#include "rotated_detector.h"
|
#include "rotated_detector.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "core/logger.h"
|
|
||||||
|
|
||||||
namespace mmdeploy {
|
namespace mmdeploy {
|
||||||
|
|
||||||
class PyRotatedDetector {
|
class PyRotatedDetector {
|
||||||
public:
|
public:
|
||||||
PyRotatedDetector(const char *model_path, const char *device_name, int device_id) {
|
PyRotatedDetector(const char *model_path, const char *device_name, int device_id) {
|
||||||
MMDEPLOY_INFO("{}, {}, {}", model_path, device_name, device_id);
|
|
||||||
auto status =
|
auto status =
|
||||||
mmdeploy_rotated_detector_create_by_path(model_path, device_name, device_id, &handle_);
|
mmdeploy_rotated_detector_create_by_path(model_path, device_name, device_id, &handle_);
|
||||||
if (status != MM_SUCCESS) {
|
if (status != MM_SUCCESS) {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_archive)
|
project(mmdeploy_archive)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} INTERFACE)
|
add_library(${PROJECT_NAME} INTERFACE)
|
||||||
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
|
target_link_libraries(${PROJECT_NAME} INTERFACE mmdeploy::core)
|
||||||
add_library(mmdeploy::archive ALIAS mmdeploy_archive)
|
add_library(mmdeploy::archive ALIAS mmdeploy_archive)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/archive
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
||||||
DESTINATION include/cpp
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/archive
|
||||||
FILES_MATCHING PATTERN "*.h")
|
DESTINATION include/cpp
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/third_party/json/json.hpp DESTINATION include/cpp/archive)
|
FILES_MATCHING PATTERN "*.h")
|
||||||
|
install(FILES ${CMAKE_SOURCE_DIR}/third_party/json/json.hpp
|
||||||
|
DESTINATION include/cpp/archive)
|
||||||
|
endif ()
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
|
|
||||||
# ncnn
|
# ncnn
|
||||||
find_package(ncnn)
|
find_package(ncnn)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(onnx2ncnn)
|
project(onnx2ncnn)
|
||||||
|
|
||||||
find_package(Protobuf)
|
find_package(Protobuf)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_ncnn_ops)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(mmdeploy_ncnn_ops)
|
||||||
|
|
||||||
# add plugin source
|
# add plugin source
|
||||||
file(GLOB_RECURSE NCNN_OPS_SRCS *.cpp)
|
file(GLOB_RECURSE NCNN_OPS_SRCS *.cpp)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(ncnn_ext)
|
project(ncnn_ext)
|
||||||
|
|
||||||
# pybind11
|
# pybind11
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_onnxruntime_ops)
|
project(mmdeploy_onnxruntime_ops)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindONNXRUNTIME.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindONNXRUNTIME.cmake)
|
||||||
|
|
||||||
# add plugin source
|
# add plugin source
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
project(mmdeploy_tensorrt_ops)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
|
||||||
project(mmdeploy_tensorrt_ops CUDA CXX)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/tensorrt.cmake)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/tensorrt.cmake NO_POLICY_SCOPE)
|
|
||||||
|
|
||||||
# cub
|
# cub
|
||||||
if (NOT DEFINED CUB_ROOT_DIR)
|
if (NOT DEFINED CUB_ROOT_DIR)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
|
|
||||||
add_subdirectory(ops)
|
add_subdirectory(ops)
|
||||||
add_subdirectory(optimizer)
|
add_subdirectory(optimizer)
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
|
|
||||||
if("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
project(mmdeploy_torchscript_ops CUDA CXX)
|
project(mmdeploy_torchscript_ops CUDA CXX)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
|
||||||
file(GLOB_RECURSE BACKEND_OPS_SRCS *.cpp *.cu)
|
file(GLOB_RECURSE BACKEND_OPS_SRCS *.cpp *.cu)
|
||||||
else()
|
else()
|
||||||
project(mmdeploy_torchscript_ops CXX)
|
project(mmdeploy_torchscript_ops CXX)
|
||||||
file(GLOB_RECURSE BACKEND_OPS_SRCS *.cpp)
|
file(GLOB_RECURSE BACKEND_OPS_SRCS *.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
find_package(Torch REQUIRED)
|
find_package(Torch REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(ts_optimizer)
|
project(ts_optimizer)
|
||||||
|
|
||||||
find_package(Torch REQUIRED)
|
find_package(Torch REQUIRED)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_codebase)
|
project(mmdeploy_codebase)
|
||||||
|
|
||||||
set(CODEBASES "")
|
set(CODEBASES "")
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmcls)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(mmdeploy_mmcls)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmdet)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_mmdet)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmedit)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_mmedit)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmocr)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_mmocr)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} OCR_SRCS)
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} OCR_SRCS)
|
||||||
aux_source_directory(${CMAKE_SOURCE_DIR}/third_party/clipper CLIPPER_SRCS)
|
aux_source_directory(${CMAKE_SOURCE_DIR}/third_party/clipper CLIPPER_SRCS)
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmocr_cpu_impl CXX)
|
project(mmdeploy_mmocr_cpu_impl CXX)
|
||||||
|
|
||||||
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
add_library(${PROJECT_NAME} OBJECT dbnet.cpp panet.cpp psenet.cpp)
|
add_library(${PROJECT_NAME} OBJECT dbnet.cpp panet.cpp psenet.cpp)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmocr_cuda_impl)
|
project(mmdeploy_mmocr_cuda_impl)
|
||||||
|
|
||||||
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
|
||||||
enable_language(CUDA)
|
|
||||||
add_library(${PROJECT_NAME} OBJECT
|
add_library(${PROJECT_NAME} OBJECT
|
||||||
connected_component.cu
|
connected_component.cu
|
||||||
utils.cu
|
utils.cu
|
||||||
|
@ -19,7 +15,8 @@ if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
mmdeploy_opencv_utils
|
mmdeploy_opencv_utils
|
||||||
mmdeploy::core
|
mmdeploy::core
|
||||||
${CUDA_LIBRARIES})
|
${CUDA_LIBRARIES}
|
||||||
|
cuda)
|
||||||
target_link_libraries(mmdeploy_mmocr PRIVATE
|
target_link_libraries(mmdeploy_mmocr PRIVATE
|
||||||
${PROJECT_NAME})
|
${PROJECT_NAME})
|
||||||
mmdeploy_export(${PROJECT_NAME})
|
mmdeploy_export(${PROJECT_NAME})
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmpose)
|
project(mmdeploy_mmpose)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmrotate)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_mmrotate)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_mmseg)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_mmseg)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_core)
|
project(mmdeploy_core)
|
||||||
|
|
||||||
#[==[
|
# this is used to keep compatibility with legacy spdlog where CMake package is not available
|
||||||
Refer to: https://cmake.org/cmake/help/latest/command/file.html
|
|
||||||
Note We do not recommend using GLOB to collect a list of source files from your source tree.
|
|
||||||
If no CMakeLists.txt file changes when a source is added or removed then the generated build
|
|
||||||
system cannot know when to ask CMake to regenerate. The CONFIGURE_DEPENDS flag may not work
|
|
||||||
reliably on all generators, or if a new generator is added in the future that cannot support it,
|
|
||||||
projects using it will be stuck. Even if CONFIGURE_DEPENDS works reliably, there is still a cost
|
|
||||||
to perform the check on every rebuild.
|
|
||||||
#]==]
|
|
||||||
set(SPDLOG_LIB)
|
set(SPDLOG_LIB)
|
||||||
find_package(spdlog QUIET)
|
|
||||||
if (spdlog_FOUND)
|
|
||||||
message(STATUS "spdlog is found")
|
|
||||||
set(SPDLOG_LIB spdlog::spdlog)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
if (MMDEPLOY_SPDLOG_EXTERNAL)
|
||||||
|
find_package(spdlog QUIET)
|
||||||
|
if (spdlog_FOUND)
|
||||||
|
set(SPDLOG_LIB spdlog::spdlog)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
set(MMDEPLOY_SPDLOG_DIR ${CMAKE_SOURCE_DIR}/third_party/spdlog)
|
||||||
|
add_subdirectory(${MMDEPLOY_SPDLOG_DIR} ${CMAKE_CURRENT_BINARY_DIR}/spdlog EXCLUDE_FROM_ALL)
|
||||||
|
set_target_properties(spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(SPDLOG_LIB spdlog::spdlog)
|
||||||
|
mmdeploy_export(spdlog)
|
||||||
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
||||||
|
install(DIRECTORY ${MMDEPLOY_SPDLOG_DIR}/include/spdlog DESTINATION include/cpp)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
device_impl.cpp
|
device_impl.cpp
|
||||||
|
@ -46,20 +47,27 @@ target_include_directories(${PROJECT_NAME}
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/third_party/outcome>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/third_party/outcome>
|
||||||
# TODO: remove dependency of `json`
|
# TODO: remove dependency of `json`
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/third_party/json>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/third_party/json>
|
||||||
$<INSTALL_INTERFACE:include/cpp>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:include/cpp>)
|
||||||
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${SPDLOG_LIB})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${SPDLOG_LIB})
|
||||||
if (NOT (MSVC OR ANDROID))
|
if (NOT (MSVC OR ANDROID))
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
|
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
|
||||||
endif ()
|
endif ()
|
||||||
add_library(mmdeploy::core ALIAS ${PROJECT_NAME})
|
add_library(mmdeploy::core ALIAS ${PROJECT_NAME})
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/core
|
if (MMDEPLOY_BUILD_SDK_CXX_API)
|
||||||
DESTINATION include/cpp
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/core
|
||||||
FILES_MATCHING PATTERN "*.h")
|
DESTINATION include/cpp
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/third_party/outcome/outcome-experimental.hpp
|
FILES_MATCHING PATTERN "*.h")
|
||||||
DESTINATION include/cpp/core)
|
install(FILES ${CMAKE_SOURCE_DIR}/third_party/outcome/outcome-experimental.hpp
|
||||||
|
DESTINATION include/cpp/core)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/experimental
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/csrc/experimental
|
||||||
DESTINATION include/cpp
|
DESTINATION include/cpp
|
||||||
FILES_MATCHING PATTERN "*.h")
|
FILES_MATCHING PATTERN "*.h")
|
||||||
|
endif ()
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
#include "tensor.h"
|
#include "tensor.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "core/utils/formatter.h"
|
#include "core/utils/formatter.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
using std::stringstream;
|
using std::stringstream;
|
||||||
|
|
||||||
namespace mmdeploy {
|
namespace mmdeploy {
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
#ifndef MMDEPLOY_SRC_UTILS_FORMATTER_H_
|
#ifndef MMDEPLOY_SRC_UTILS_FORMATTER_H_
|
||||||
#define MMDEPLOY_SRC_UTILS_FORMATTER_H_
|
#define MMDEPLOY_SRC_UTILS_FORMATTER_H_
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "core/logger.h"
|
#include "core/logger.h"
|
||||||
|
#include "core/types.h"
|
||||||
|
#include "spdlog/fmt/ostr.h"
|
||||||
|
|
||||||
#if FMT_VERSION >= 50000
|
#if FMT_VERSION >= 50000
|
||||||
#include "spdlog/fmt/bundled/ostream.h"
|
#include "spdlog/fmt/bundled/ostream.h"
|
||||||
|
@ -20,12 +23,55 @@ class Value;
|
||||||
|
|
||||||
MMDEPLOY_API std::string format_value(const Value& value);
|
MMDEPLOY_API std::string format_value(const Value& value);
|
||||||
|
|
||||||
|
inline std::string to_string(PixelFormat format) {
|
||||||
|
switch (format) {
|
||||||
|
case PixelFormat::kBGR:
|
||||||
|
return "BGR";
|
||||||
|
case PixelFormat::kRGB:
|
||||||
|
return "RGB";
|
||||||
|
case PixelFormat::kGRAYSCALE:
|
||||||
|
return "GRAYSCALE";
|
||||||
|
case PixelFormat::kNV12:
|
||||||
|
return "NV12";
|
||||||
|
case PixelFormat::kNV21:
|
||||||
|
return "NV21";
|
||||||
|
case PixelFormat::kBGRA:
|
||||||
|
return "BGRA";
|
||||||
|
default:
|
||||||
|
return "invalid_format_enum";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string to_string(DataType type) {
|
||||||
|
switch (type) {
|
||||||
|
case DataType::kFLOAT:
|
||||||
|
return "FLOAT";
|
||||||
|
case DataType::kHALF:
|
||||||
|
return "HALF";
|
||||||
|
case DataType::kINT8:
|
||||||
|
return "INT8";
|
||||||
|
case DataType::kINT32:
|
||||||
|
return "INT32";
|
||||||
|
case DataType::kINT64:
|
||||||
|
return "INT64";
|
||||||
|
default:
|
||||||
|
return "invalid_data_type_enum";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, PixelFormat format) {
|
||||||
|
return os << to_string(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::ostream& operator<<(std::ostream& os, DataType type) { return os << to_string(type); }
|
||||||
|
|
||||||
} // namespace mmdeploy
|
} // namespace mmdeploy
|
||||||
|
|
||||||
namespace fmt {
|
namespace fmt {
|
||||||
|
|
||||||
#if FMT_VERSION >= 50000
|
#if FMT_VERSION >= 50000
|
||||||
|
|
||||||
|
// `Value` maybe an incomplete type at this point, making `operator<<` not usable
|
||||||
template <>
|
template <>
|
||||||
struct formatter<mmdeploy::Value> {
|
struct formatter<mmdeploy::Value> {
|
||||||
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
||||||
|
@ -37,21 +83,16 @@ struct formatter<mmdeploy::Value> {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline void format_arg(BasicFormatter<char> &f, const char *, const mmdeploy::Value &d) {
|
inline void format_arg(BasicFormatter<char>& f, const char*, const mmdeploy::Value& d) {
|
||||||
f.writer() << mmdeploy::format_value(d);
|
f.writer() << mmdeploy::format_value(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, std::enable_if_t<std::is_enum<std::decay_t<T> >::value, bool> = true>
|
|
||||||
void format_arg(BasicFormatter<char> &f, const char *, const T &v) {
|
|
||||||
f.writer() << (int)v;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto format_arg(BasicFormatter<char> &f, const char *, const T &v)
|
auto format_arg(BasicFormatter<char>& f, const char*, const T& v)
|
||||||
-> std::void_t<decltype(begin(v), end(v))> {
|
-> std::void_t<decltype(begin(v), end(v))> {
|
||||||
f.writer() << "[";
|
f.writer() << "[";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (const auto &x : v) {
|
for (const auto& x : v) {
|
||||||
f.writer() << (first ? "" : ", ") << fmt::format("{}", x);
|
f.writer() << (first ? "" : ", ") << fmt::format("{}", x);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +100,7 @@ auto format_arg(BasicFormatter<char> &f, const char *, const T &v)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Tuple, size_t... Is>
|
template <class Tuple, size_t... Is>
|
||||||
void format_tuple_impl(BasicFormatter<char> &f, const Tuple &t, std::index_sequence<Is...>) {
|
void format_tuple_impl(BasicFormatter<char>& f, const Tuple& t, std::index_sequence<Is...>) {
|
||||||
constexpr int last = sizeof...(Is) - 1;
|
constexpr int last = sizeof...(Is) - 1;
|
||||||
f.writer() << "(";
|
f.writer() << "(";
|
||||||
((f.writer() << fmt::format("{}", std::get<Is>(t)) << (Is != last ? ", " : "")), ...);
|
((f.writer() << fmt::format("{}", std::get<Is>(t)) << (Is != last ? ", " : "")), ...);
|
||||||
|
@ -67,7 +108,7 @@ void format_tuple_impl(BasicFormatter<char> &f, const Tuple &t, std::index_seque
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
void format_arg(BasicFormatter<char> &f, const char *, const std::tuple<Ts...> &t) {
|
void format_arg(BasicFormatter<char>& f, const char*, const std::tuple<Ts...>& t) {
|
||||||
format_tuple_impl(f, t, std::index_sequence_for<Ts...>{});
|
format_tuple_impl(f, t, std::index_sequence_for<Ts...>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
|
|
||||||
add_subdirectory(cpu)
|
add_subdirectory(cpu)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_cpu_device)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(mmdeploy_cpu_device)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCS "*.cpp")
|
file(GLOB_RECURSE SRCS "*.cpp")
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
project(mmdeploy_cuda_device)
|
||||||
project(mmdeploy_cuda_device CUDA CXX)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
cuda_device.cpp
|
cuda_device.cpp
|
||||||
cuda_builtin_kernels.cu)
|
cuda_builtin_kernels.cu)
|
||||||
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} "${SRCS}")
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CUDA_INCLUDE_DIRS})
|
target_include_directories(${PROJECT_NAME} PRIVATE ${CUDA_INCLUDE_DIRS})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE cudart cuda)
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${CUDA_LIBRARIES} cuda)
|
||||||
add_library(mmdeploy::device::cuda ALIAS ${PROJECT_NAME})
|
add_library(mmdeploy::device::cuda ALIAS ${PROJECT_NAME})
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_execution)
|
project(mmdeploy_execution)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
set(SRCS schedulers/schedulers.cpp)
|
set(SRCS schedulers/schedulers.cpp)
|
||||||
mmdeploy_add_module(${PROJECT_NAME} LIBRARY "${SRCS}")
|
mmdeploy_add_module(${PROJECT_NAME} LIBRARY "${SRCS}")
|
||||||
add_library(mmdeploy::execution ALIAS ${PROJECT_NAME})
|
add_library(mmdeploy::execution ALIAS ${PROJECT_NAME})
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_graph)
|
project(mmdeploy_graph)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
common.cpp
|
common.cpp
|
||||||
task.cpp
|
task.cpp
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(model)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(model)
|
||||||
|
|
||||||
set(MODEL_NAMES "directory_model")
|
set(MODEL_NAMES "directory_model")
|
||||||
if (${MMDEPLOY_ZIP_MODEL})
|
if (${MMDEPLOY_ZIP_MODEL})
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_net_module)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(mmdeploy_net_module)
|
||||||
|
|
||||||
if ("trt" IN_LIST MMDEPLOY_TARGET_BACKENDS)
|
if ("trt" IN_LIST MMDEPLOY_TARGET_BACKENDS)
|
||||||
add_subdirectory(trt)
|
add_subdirectory(trt)
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_ncnn_net)
|
project(mmdeploy_ncnn_net)
|
||||||
|
|
||||||
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
find_package(ncnn REQUIRED)
|
find_package(ncnn REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_openvino_net)
|
project(mmdeploy_openvino_net)
|
||||||
|
|
||||||
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
find_package(InferenceEngine REQUIRED)
|
find_package(InferenceEngine REQUIRED)
|
||||||
|
|
||||||
mmdeploy_add_module(${PROJECT_NAME} openvino_net.cpp)
|
mmdeploy_add_module(${PROJECT_NAME} openvino_net.cpp)
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_ort_net)
|
project(mmdeploy_ort_net)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindONNXRUNTIME.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/modules/FindONNXRUNTIME.cmake)
|
||||||
|
|
||||||
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
if ("cpu" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
mmdeploy_add_module(${PROJECT_NAME} ort_net.cpp)
|
mmdeploy_add_module(${PROJECT_NAME} ort_net.cpp)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${ONNXRUNTIME_DIR}/include)
|
target_include_directories(${PROJECT_NAME} PRIVATE ${ONNXRUNTIME_DIR}/include)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy_onnxruntime_ops_obj)
|
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy_onnxruntime_ops_obj)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_pplnn_net)
|
project(mmdeploy_pplnn_net)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
find_package(pplnn REQUIRED)
|
find_package(pplnn REQUIRED)
|
||||||
|
|
||||||
mmdeploy_add_module(${PROJECT_NAME} ppl_net.cpp)
|
mmdeploy_add_module(${PROJECT_NAME} ppl_net.cpp)
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
|
||||||
project(mmdeploy_trt_net)
|
project(mmdeploy_trt_net)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/tensorrt.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/tensorrt.cmake)
|
||||||
|
|
||||||
mmdeploy_add_module(${PROJECT_NAME} trt_net.cpp)
|
mmdeploy_add_module(${PROJECT_NAME} trt_net.cpp)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_transform_module)
|
project(mmdeploy_transform_module)
|
||||||
|
|
||||||
add_subdirectory(transform)
|
add_subdirectory(transform)
|
||||||
|
@ -8,7 +8,6 @@ if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
||||||
add_subdirectory(cuda)
|
add_subdirectory(cuda)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
mmdeploy_add_module(${PROJECT_NAME} transform_module.cpp)
|
mmdeploy_add_module(${PROJECT_NAME} transform_module.cpp)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy::transform)
|
target_link_libraries(${PROJECT_NAME} PRIVATE mmdeploy::transform)
|
||||||
add_library(mmdeploy::transform_module ALIAS ${PROJECT_NAME})
|
add_library(mmdeploy::transform_module ALIAS ${PROJECT_NAME})
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_cpu_transform_impl)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_cpu_transform_impl)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
collect_impl.cpp
|
collect_impl.cpp
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake NO_POLICY_SCOPE)
|
|
||||||
project(mmdeploy_cuda_transform_impl CUDA CXX)
|
project(mmdeploy_cuda_transform_impl CUDA CXX)
|
||||||
|
|
||||||
find_package(pplcv REQUIRED)
|
find_package(pplcv REQUIRED)
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
crop_impl.cpp
|
crop_impl.cpp
|
||||||
image2tensor_impl.cpp
|
image2tensor_impl.cpp
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_transform)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
project(mmdeploy_transform)
|
||||||
|
|
||||||
set(SRCS
|
set(SRCS
|
||||||
collect.cpp
|
collect.cpp
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(mmdeploy_opencv_utils)
|
|
||||||
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
project(mmdeploy_opencv_utils)
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/MMDeploy.cmake)
|
|
||||||
|
|
||||||
mmdeploy_add_library(${PROJECT_NAME} opencv_utils.cpp)
|
mmdeploy_add_library(${PROJECT_NAME} opencv_utils.cpp)
|
||||||
|
|
||||||
|
@ -13,5 +10,3 @@ target_link_libraries(${PROJECT_NAME}
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
|
||||||
#export_module(${PROJECT_NAME})
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ You should build csharp api first, it will generate a nuget package, or you can
|
||||||
|
|
||||||
**step 1.** Add runtime dll to the system path
|
**step 1.** Add runtime dll to the system path
|
||||||
|
|
||||||
If you built csharp api from source and didn't build static lib, you should add the built dll to your system path. The same is to opencv, spdlog, etc.
|
If you built csharp api from source and didn't build static lib, you should add the built dll to your system path. The same is to opencv, etc.
|
||||||
|
|
||||||
And don't forget to install backend dependencies. Take tensorrt backend as example, you have to install cudatoolkit, cudnn and tensorrt. The version of backend dependencies that our prebuit nuget package used will be offered in release note.
|
And don't forget to install backend dependencies. Take tensorrt backend as example, you have to install cudatoolkit, cudnn and tensorrt. The version of backend dependencies that our prebuit nuget package used will be offered in release note.
|
||||||
|
|
||||||
|
|
|
@ -61,20 +61,6 @@ You can skip this chapter if only interested in model converter.
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>
|
|
||||||
<pre><code>
|
|
||||||
git clone -b v1.9.2 https://github.com/gabime/spdlog.git
|
|
||||||
cd spdlog
|
|
||||||
export SPDLOG_DIR=${PWD}
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${SPDLOG_DIR} -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-30 ..
|
|
||||||
make install
|
|
||||||
</code></pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV<br>(>=3.0) </td>
|
<td>OpenCV<br>(>=3.0) </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -159,7 +145,7 @@ make install
|
||||||
<td>Enable codebase's postprocess modules. It MUST be set by a semicolon separated list of codebase names. The currently supported codebases are 'mmcls', 'mmdet', 'mmedit', 'mmseg', 'mmocr'. Instead of listing them one by one, you can also pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
<td>Enable codebase's postprocess modules. It MUST be set by a semicolon separated list of codebase names. The currently supported codebases are 'mmcls', 'mmdet', 'mmedit', 'mmseg', 'mmocr'. Instead of listing them one by one, you can also pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>Switch to build shared library or static library of MMDeploy SDK. Now you should build static library for android. Bug will be fixed soon.</td>
|
<td>Switch to build shared library or static library of MMDeploy SDK. Now you should build static library for android. Bug will be fixed soon.</td>
|
||||||
|
@ -177,11 +163,10 @@ MMDeploy provides a recipe as shown below for building SDK with ncnn as inferenc
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DMMDEPLOY_BUILD_SDK=ON \
|
-DMMDEPLOY_BUILD_SDK=ON \
|
||||||
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
||||||
-Dspdlog_DIR=${SPDLOG_DIR}/lib/cmake/spdlog \
|
|
||||||
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
||||||
-DMMDEPLOY_TARGET_BACKENDS=ncnn \
|
-DMMDEPLOY_TARGET_BACKENDS=ncnn \
|
||||||
-DMMDEPLOY_CODEBASES=all \
|
-DMMDEPLOY_CODEBASES=all \
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
-DMMDEPLOY_SHARED_LIBS=OFF \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
||||||
-DANDROID_ABI=arm64-v8a \
|
-DANDROID_ABI=arm64-v8a \
|
||||||
-DANDROID_PLATFORM=android-30 \
|
-DANDROID_PLATFORM=android-30 \
|
||||||
|
@ -197,7 +182,6 @@ cd ${MMDEPLOY_DIR}/build/install/example
|
||||||
mkdir -p build && cd build
|
mkdir -p build && cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
||||||
-Dspdlog_DIR=${SPDLOG_DIR}/lib/cmake/spdlog \
|
|
||||||
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
||||||
-DMMDeploy_DIR=${MMDEPLOY_DIR}/build/install/lib/cmake/MMDeploy \
|
-DMMDeploy_DIR=${MMDEPLOY_DIR}/build/install/lib/cmake/MMDeploy \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
||||||
|
|
|
@ -101,21 +101,6 @@ You can skip this chapter if you are only interested in the model converter.
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>
|
|
||||||
On Ubuntu >=18.04,
|
|
||||||
<pre><code>
|
|
||||||
sudo apt-get install libspdlog-dev
|
|
||||||
</code></pre>
|
|
||||||
On Ubuntu 16.04,
|
|
||||||
<pre><code>
|
|
||||||
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/spdlog/libspdlog-dev_0.16.3-1_amd64.deb
|
|
||||||
sudo dpkg -i libspdlog-dev_0.16.3-1_amd64.deb
|
|
||||||
</code></pre>
|
|
||||||
You can also build spdlog from its source to enjoy its latest features. But be sure to open cmake option <code>-DCMAKE_POSITION_INDEPENDENT_CODE=ON</code>.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV<br>(>=3.0) </td>
|
<td>OpenCV<br>(>=3.0) </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -346,7 +331,7 @@ Currently, <b>The Model Converter supports torchscript, but SDK doesn't</b>.
|
||||||
<td>Enable codebase's postprocess modules. You can provide a semicolon separated list of codebase names to enable them, e.g., <code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>. Or you can pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
<td>Enable codebase's postprocess modules. You can provide a semicolon separated list of codebase names to enable them, e.g., <code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>. Or you can pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>Switch to build shared library or static library of MMDeploy SDK</td>
|
<td>Switch to build shared library or static library of MMDeploy SDK</td>
|
||||||
|
|
|
@ -79,22 +79,6 @@ You can skip this chapter if you are only interested in the model converter.
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>
|
|
||||||
spdlog is a very fast, header-only/compiled, C++ logging library. You can install it like this,
|
|
||||||
<pre><code>
|
|
||||||
Invoke-WebRequest -Uri https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.zip -OutFile spdlog-1.9.2.zip
|
|
||||||
Expand-Archive spdlog-1.9.2.zip .
|
|
||||||
cd spdlog-1.9.2
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build . --target install --config Release -- /m
|
|
||||||
cd ../..
|
|
||||||
</code></pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV<br>(>=3.0) </td>
|
<td>OpenCV<br>(>=3.0) </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -274,7 +258,7 @@ $env:MMDEPLOY_DIR="$pwd"
|
||||||
<td>Enable codebase's postprocess modules. You can provide a semicolon separated list of codebase names to enable them. Or you can pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
<td>Enable codebase's postprocess modules. You can provide a semicolon separated list of codebase names to enable them. Or you can pass <code>all</code> to enable them all, i.e., <code>-DMMDEPLOY_CODEBASES=all</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>Switch to build shared library or static library of MMDeploy SDK</td>
|
<td>Switch to build shared library or static library of MMDeploy SDK</td>
|
||||||
|
|
|
@ -154,7 +154,6 @@ make -j$(nproc)
|
||||||
cmake -DMMDEPLOY_BUILD_SDK=ON \
|
cmake -DMMDEPLOY_BUILD_SDK=ON \
|
||||||
-DCMAKE_CXX_COMPILER=g++-7 \
|
-DCMAKE_CXX_COMPILER=g++-7 \
|
||||||
-DOpenCV_DIR=/path/to/OpenCV/lib/cmake/OpenCV \
|
-DOpenCV_DIR=/path/to/OpenCV/lib/cmake/OpenCV \
|
||||||
-Dspdlog_DIR=/path/to/spdlog/lib/cmake/spdlog \
|
|
||||||
-DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} \
|
-DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} \
|
||||||
-DMMDEPLOY_TARGET_BACKENDS=ort \
|
-DMMDEPLOY_TARGET_BACKENDS=ort \
|
||||||
-DMMDEPLOY_CODEBASES=mmdet ..
|
-DMMDEPLOY_CODEBASES=mmdet ..
|
||||||
|
|
|
@ -61,20 +61,6 @@ MMDeploy 的交叉编译分为两步:
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>
|
|
||||||
<pre><code>
|
|
||||||
git clone -b v1.9.2 https://github.com/gabime/spdlog.git
|
|
||||||
cd spdlog
|
|
||||||
export SPDLOG_DIR=${PWD}
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${SPDLOG_DIR} -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-30 ..
|
|
||||||
make install
|
|
||||||
</code></pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV<br>(>=3.0) </td>
|
<td>OpenCV<br>(>=3.0) </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -153,7 +139,7 @@ make install
|
||||||
<td>用来设置 SDK 后处理组件,加载 OpenMMLab 算法仓库的后处理功能. 已支持的算法仓库有'mmcls','mmdet','mmedit','mmseg'和'mmocr'. 如果选择多个codebase,中间使用分号隔开. 比如, 'mmcls', 'mmdet', 'mmedit', 'mmseg', 'mmocr'. 也可以通过 <code>all</code> 的方式, 加载所有codebase, 即 <code>-DMMDEPLOY_CODEBASES=all.</code></td>
|
<td>用来设置 SDK 后处理组件,加载 OpenMMLab 算法仓库的后处理功能. 已支持的算法仓库有'mmcls','mmdet','mmedit','mmseg'和'mmocr'. 如果选择多个codebase,中间使用分号隔开. 比如, 'mmcls', 'mmdet', 'mmedit', 'mmseg', 'mmocr'. 也可以通过 <code>all</code> 的方式, 加载所有codebase, 即 <code>-DMMDEPLOY_CODEBASES=all.</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>MMDeploy SDK 的动态库的编译开关.设置 OFF 时, 编译静态库. 目前 android 端 SDK 仅支持静态库加载, 后续会进行对动态库加载的支持.</td>
|
<td>MMDeploy SDK 的动态库的编译开关.设置 OFF 时, 编译静态库. 目前 android 端 SDK 仅支持静态库加载, 后续会进行对动态库加载的支持.</td>
|
||||||
|
@ -172,11 +158,10 @@ make install
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DMMDEPLOY_BUILD_SDK=ON \
|
-DMMDEPLOY_BUILD_SDK=ON \
|
||||||
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
||||||
-Dspdlog_DIR=${SPDLOG_DIR}/lib/cmake/spdlog \
|
|
||||||
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
||||||
-DMMDEPLOY_TARGET_BACKENDS=ncnn \
|
-DMMDEPLOY_TARGET_BACKENDS=ncnn \
|
||||||
-DMMDEPLOY_CODEBASES=all \
|
-DMMDEPLOY_CODEBASES=all \
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
-DMMDEPLOY_SHARED_LIBS=OFF \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
||||||
-DANDROID_ABI=arm64-v8a \
|
-DANDROID_ABI=arm64-v8a \
|
||||||
-DANDROID_PLATFORM=android-30 \
|
-DANDROID_PLATFORM=android-30 \
|
||||||
|
@ -192,7 +177,6 @@ cd ${MMDEPLOY_DIR}/build/install/example
|
||||||
mkdir -p build && cd build
|
mkdir -p build && cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
-DOpenCV_DIR=${OPENCV_ANDROID_SDK_DIR}/sdk/native/jni/abi-arm64-v8a \
|
||||||
-Dspdlog_DIR=${SPDLOG_DIR}/lib/cmake/spdlog \
|
|
||||||
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
-Dncnn_DIR=${NCNN_DIR}/build/install/lib/cmake/ncnn \
|
||||||
-DMMDeploy_DIR=${MMDEPLOY_DIR}/build/install/lib/cmake/MMDeploy \
|
-DMMDeploy_DIR=${MMDEPLOY_DIR}/build/install/lib/cmake/MMDeploy \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
|
||||||
|
|
|
@ -93,21 +93,6 @@ pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/${cu_ve
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>
|
|
||||||
在 Ubuntu 18.04 及以上版本
|
|
||||||
<pre><code>
|
|
||||||
sudo apt-get install libspdlog-dev
|
|
||||||
</code></pre>
|
|
||||||
在 Ubuntu 16.04,
|
|
||||||
<pre><code>
|
|
||||||
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/spdlog/libspdlog-dev_0.16.3-1_amd64.deb
|
|
||||||
sudo dpkg -i libspdlog-dev_0.16.3-1_amd64.deb
|
|
||||||
</code></pre>
|
|
||||||
您也可以使用spdlog的源码进行编译,激活它更多的特性。但是,请务必打开 <code>-DCMAKE_POSITION_INDEPENDENT_CODE=ON</code>.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV<br>(>=3.0) </td>
|
<td>OpenCV<br>(>=3.0) </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -331,7 +316,7 @@ export MMDEPLOY_DIR=$(pwd)
|
||||||
<td>用来设置 SDK 后处理组件,加载 OpenMMLab 算法仓库的后处理功能。如果选择多个 codebase,中间使用分号隔开。比如,<code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>。也可以通过 <code>-DMMDEPLOY_CODEBASES=all</code> 方式,加载所有 codebase。</td>
|
<td>用来设置 SDK 后处理组件,加载 OpenMMLab 算法仓库的后处理功能。如果选择多个 codebase,中间使用分号隔开。比如,<code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>。也可以通过 <code>-DMMDEPLOY_CODEBASES=all</code> 方式,加载所有 codebase。</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>MMDeploy SDK 的动态库的编译开关。设置 OFF 时,编译静态库</td>
|
<td>MMDeploy SDK 的动态库的编译开关。设置 OFF 时,编译静态库</td>
|
||||||
|
|
|
@ -76,21 +76,6 @@ pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/$env:cu
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>spdlog </td>
|
|
||||||
<td>spdlog是一个精巧的日志管理库。请参考如下命令安装: <br>
|
|
||||||
<pre><code>
|
|
||||||
Invoke-WebRequest -Uri https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.zip -OutFile spdlog-1.9.2.zip
|
|
||||||
Expand-Archive spdlog-1.9.2.zip .
|
|
||||||
cd spdlog-1.9.2
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -G "Visual Studio 16 2019" -A x64 -T v142 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build . --target install --config Release -- /m
|
|
||||||
cd ../..
|
|
||||||
</code></pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>OpenCV </td>
|
<td>OpenCV </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -261,7 +246,7 @@ $env:MMDEPLOY_DIR="$pwd"
|
||||||
<td>用来设置SDK后处理组件,加载 OpenMMLab 算法仓库的后处理功能。如果选择多个 codebase,中间使用分号隔开。比如,<code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>。也可以通过 <code>-DMMDEPLOY_CODEBASES=all</code> 方式,加载所有 codebase。</td>
|
<td>用来设置SDK后处理组件,加载 OpenMMLab 算法仓库的后处理功能。如果选择多个 codebase,中间使用分号隔开。比如,<code>-DMMDEPLOY_CODEBASES="mmcls;mmdet"</code>。也可以通过 <code>-DMMDEPLOY_CODEBASES=all</code> 方式,加载所有 codebase。</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>BUILD_SHARED_LIBS</td>
|
<td>MMDEPLOY_SHARED_LIBS</td>
|
||||||
<td>{ON, OFF}</td>
|
<td>{ON, OFF}</td>
|
||||||
<td>ON</td>
|
<td>ON</td>
|
||||||
<td>动态库的编译开关。设置OFF时,编译静态库</td>
|
<td>动态库的编译开关。设置OFF时,编译静态库</td>
|
||||||
|
|
|
@ -157,7 +157,6 @@ make -j$(nproc)
|
||||||
cmake -DMMDEPLOY_BUILD_SDK=ON \
|
cmake -DMMDEPLOY_BUILD_SDK=ON \
|
||||||
-DCMAKE_CXX_COMPILER=g++-7 \
|
-DCMAKE_CXX_COMPILER=g++-7 \
|
||||||
-DOpenCV_DIR=/path/to/OpenCV/lib/cmake/OpenCV \
|
-DOpenCV_DIR=/path/to/OpenCV/lib/cmake/OpenCV \
|
||||||
-Dspdlog_DIR=/path/to/spdlog/lib/cmake/spdlog \
|
|
||||||
-DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} \
|
-DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} \
|
||||||
-DMMDEPLOY_TARGET_BACKENDS=ort \
|
-DMMDEPLOY_TARGET_BACKENDS=ort \
|
||||||
-DMMDEPLOY_CODEBASES=mmdet ..
|
-DMMDEPLOY_CODEBASES=mmdet ..
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
|
||||||
project(tests)
|
project(tests)
|
||||||
|
|
||||||
if ("cuda" IN_LIST MMDEPLOY_TARGET_DEVICES)
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/cuda.cmake)
|
|
||||||
endif()
|
|
||||||
include(${CMAKE_SOURCE_DIR}/cmake/opencv.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
set(TC_SRCS test_main.cpp)
|
set(TC_SRCS test_main.cpp)
|
||||||
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/archive ARCHIVE_TC)
|
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/archive ARCHIVE_TC)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9e8e52c0488706986c76eeb4225286ac02fb1ee9
|
Loading…
Reference in New Issue