wykvictor / apriltag-gpu Goto Github PK
View Code? Open in Web Editor NEWAccelerating tag tracking algorithm "apriltag" using CUDA
License: GNU Lesser General Public License v2.1
Accelerating tag tracking algorithm "apriltag" using CUDA
License: GNU Lesser General Public License v2.1
请问您有发布linux下的版本吗
Hello,
After using the original AprilTag library I tried switching to this one, as the computation time was to big.
I installed OpenCV 3.1 with Cuda support, as well as Cuda 8.0. I am running Ubuntu 16.04 and this seems to be the only version available. The Cuda installation seems to work, according to the Cuda samples device query, see below.
The Issue is, that the GPU doesn't seem to be used. Wenn running it, it detects the AprilTag, but only one CPU core is utilized and the GPU is pretty much idle.
The computation per image takes around 350ms, which is similar to the original AprilTag library.
I implemented it in ROS and have therefore added a few things to the CMakeList.txt file. My usage of it is based on the demo code provided in the package.
I also included the modified CMakeList file, if there is an error there.
Is there maybe an option I did not consider or something else I might have gotten wrong?
Thank you for the help and if any further information is needed please let me know.
deviceQuery output:
/bin/x86_64/linux/release/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 770"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 3.0
Total amount of global memory: 1999 MBytes (2095906816 bytes)
( 8) Multiprocessors, (192) CUDA Cores/MP: 1536 CUDA Cores
GPU Max Clock rate: 1202 MHz (1.20 GHz)
Memory Clock rate: 3505 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 524288 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GTX 770
Result = PASS
CMakeList.txt file:
cmake_minimum_required(VERSION 2.8.3)
project(apriltag_gpu)
add_definitions(-std=c++14 -I /usr/include/eigen3/ -I /usr/local/cuda-8.0/include/)
find_package(catkin REQUIRED)
option(USE_PROFILE "Enable Profile codes, default to true" 1)
option(USE_CUDA "Use CUDA, default to true" 1)
option(USE_OPENMP "Use OpenMP, default to true" 1)
if (USE_PROFILE)
add_definitions(-DPROFILE)
endif()
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-8.0/)
find_package(CUDA REQUIRED)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Xcompiler=\"/FS\" --gpu-architecture=compute_30 --gpu-code=compute_30,sm_30")
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE} -O3")
add_definitions(-DHAVE_CUDA) # used in src code to control workflow
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
set(OpenCV_DIR /usr/local/share/OpenCV/)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
set(DEPENDENCIES ${OpenCV_LIBS})
link_directories(${OpenCV_LIB_DIR}) # we can put some libs in it for linking
find_package(OpenMP REQUIRED)
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
MATH(EXPR N "${N}/2")
else()
set(N 2)
endif()
MESSAGE(STATUS "Using OpenMP with ${N} threads")
add_definitions(-DHAVE_OPENMP=${N})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message("CMAKE_CXX_FLAGS in OpenMP: ${CMAKE_CXX_FLAGS}")
if (APPLE OR UNIX)
add_compile_options(-std=c++14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -Wsign-compare -frounding-math -fPIC")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "/Gs ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
endif()
if (MSVC)
add_subdirectory(windows)
include_directories(windows)
set(DEPENDENCIES ${DEPENDENCIES} windows_port)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819") # skip the unicode warnings
endif()
catkin_package(
INCLUDE_DIRS include
# LIBRARIES
CATKIN_DEPENDS
DEPENDS
)
include_directories(
SYSTEM
include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
)
add_subdirectory(src)
set(${PROJECT_NAME}_SOURCES
src/Edge.cc
src/FloatImage.cc
src/Gaussian.cc
src/GLine2D.cc
src/GLineSegment2D.cc
src/GrayModel.cc
src/Homography33.cc
src/MathUtil.cc
src/Quad.cc
src/Segment.cc
src/TagDetection.cc
src/TagDetector.cc
src/TagFamily.cc
src/UnionFindSimple.cc
)
add_library(${PROJECT_NAME}_lib
${${PROJECT_NAME}_SOURCES}
)
target_link_libraries(
${PROJECT_NAME}_lib
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
add_executable(demo src/main/apriltags_demo.cpp)
target_link_libraries(demo ${catkin_LIBRARIES} ${PROJECT_NAME}_lib)
add_dependencies(demo ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.