nearthlab / siammaskcpp Goto Github PK
View Code? Open in Web Editor NEWC++ Implementation of SiamMask
Home Page: https://github.com/foolwood/SiamMask
License: MIT License
C++ Implementation of SiamMask
Home Page: https://github.com/foolwood/SiamMask
License: MIT License
Thank you so much to show your project.But when i run this project on cpu ,it has following error:
I changed device to cpu
//torch::Device device(torch::kCUDA);
torch::Device device(torch::kCPU);
Error:
Loading SiamMask module: feature_extractor ...
Exception thrown!
Cannot initialize CUDA without ATen_cuda library. PyTorch splits its backend into two shared libraries: a CPU library and a CUDA library; this error has occurred because you are trying to use some CUDA functionality, but the CUDA library has not been loaded by the dynamic linker for some reason. The CUDA library MUST be loaded, EVEN IF you don't directly use any symbols from the CUDA library! One common culprit is a lack of -Wl,--no-as-needed in your link arguments; many dynamic linkers will delete dynamic library dependencies if you don't depend on any of their symbols. You can check if this has occurred by using ldd on your binary to see if there is a dependency on *_cuda.so library. (initCUDA at /pytorch/aten/src/ATen/detail/CUDAHooksInterface.h:63)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x7f9ff4955193 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0xadee36 (0x7f9ff5659e36 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #2: void std::call_once<at::Context::lazyInitCUDA()::{lambda()#1}>(std::once_flag&, at::Context::lazyInitCUDA()::{lambda()#1}&&)::{lambda()#2}::_FUN() + 0x2c (0x7f9ff561f63c in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #3: <unknown function> + 0xe759 (0x7f9ff054f759 in /lib/x86_64-linux-gnu/libpthread.so.0)
frame #4: <unknown function> + 0xaa4b54 (0x7f9ff561fb54 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #5: at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}::operator()() const + 0x20 (0x55ff30451de2 in ./demo)
frame #6: void std::__invoke_impl<void, at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}>(std::__invoke_other, at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}&&) + 0x20 (0x55ff3047ebfa in ./demo)
frame #7: _ZSt8__invokeIZN2at18LegacyTypeDispatch20initForTensorTypeSetEN3c1013TensorTypeSetEEUlvE0_JEENSt9result_ofIFOT_DpOT0_EE4typeES7_SA_ + 0x26 (0x55ff3047538b in ./demo)
frame #8: void std::call_once<at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}>(std::once_flag&, at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}&&)::{lambda()#1}::operator()() const + 0x23 (0x55ff3046ae07 in ./demo)
frame #9: void std::call_once<at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}>(std::once_flag&, at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}&&)::{lambda()#2}::operator()() const + 0x1f (0x55ff3046ae37 in ./demo)
frame #10: void std::call_once<at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}>(std::once_flag&, at::LegacyTypeDispatch::initForTensorTypeSet(c10::TensorTypeSet)::{lambda()#2}&&)::{lambda()#2}::_FUN() + 0xe (0x55ff3046ae48 in ./demo)
frame #11: <unknown function> + 0xe759 (0x7f9ff054f759 in /lib/x86_64-linux-gnu/libpthread.so.0)
frame #12: <unknown function> + 0xead262 (0x7f9ff5a28262 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #13: <unknown function> + 0xead78a (0x7f9ff5a2878a in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #14: at::native::to(at::Tensor const&, c10::Device, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) + 0x2a6 (0x7f9ff5a2a676 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #15: <unknown function> + 0x11f3193 (0x7f9ff5d6e193 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #16: <unknown function> + 0x2ed9352 (0x7f9ff7a54352 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #17: <unknown function> + 0x123dbea (0x7f9ff5db8bea in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #18: at::Tensor::to(c10::Device, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) const + 0x1fb (0x7f9ff566976b in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #19: <unknown function> + 0x3265a40 (0x7f9ff7de0a40 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #20: <unknown function> + 0x3267bc0 (0x7f9ff7de2bc0 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #21: <unknown function> + 0x3267fd3 (0x7f9ff7de2fd3 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #22: <unknown function> + 0x3289173 (0x7f9ff7e04173 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #23: <unknown function> + 0x328b766 (0x7f9ff7e06766 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #24: torch::jit::load(std::unique_ptr<caffe2::serialize::ReadAdapterInterface, std::default_delete<caffe2::serialize::ReadAdapterInterface> >, c10::optional<c10::Device>, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) + 0x13b (0x7f9ff7e0719b in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #25: torch::jit::load(std::string const&, c10::optional<c10::Device>, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) + 0x69 (0x7f9ff7e07349 in /home/chengye.cy/anaconda3/envs/py38/lib/python3.8/site-packages/torch/lib/libtorch.so)
frame #26: SiamMask::SiamMask(std::string const&, c10::Device const&) + 0x3d8 (0x55ff3045d056 in ./demo)
frame #27: main + 0x2b5 (0x55ff304457e4 in ./demo)
frame #28: __libc_start_main + 0xf1 (0x7f9fef9252e1 in /lib/x86_64-linux-gnu/libc.so.6)
frame #29: _start + 0x2a (0x55ff30441b6a in ./demo)
Hi,
Currently, im compile your SiamMaskCpp project using dlib, opencv, torchscript and CUDA 10.1.
When compiler linking demo excutable, i got error as the following:
ERROR
CMakeFiles/demo.dir/demo.cpp.o: In function dlib::config_reader_kernel_1<dlib::map_kernel_1<std::string, std::string, dlib::binary_search_tree_kernel_2<std::string, std::string, dlib::memory_manager_stateless_kernel_1<char>, std::less<std::string> >, dlib::memory_manager_stateless_kernel_1<char> >, dlib::map_kernel_1<std::string, void*, dlib::binary_search_tree_kernel_2<std::string, void*, dlib::memory_manager_stateless_kernel_1<char>, std::less<std::string> >, dlib::memory_manager_stateless_kernel_1<char> >, dlib::tokenizer_kernel_1>::parse_config_file(dlib::config_reader_kernel_1<dlib::map_kernel_1<std::string, std::string, dlib::binary_search_tree_kernel_2<std::string, std::string, dlib::memory_manager_stateless_kernel_1<char>, std::less<std::string> >, dlib::memory_manager_stateless_kernel_1<char> >, dlib::map_kernel_1<std::string, void*, dlib::binary_search_tree_kernel_2<std::string, void*, dlib::memory_manager_stateless_kernel_1<char>, std::less<std::string> >, dlib::memory_manager_stateless_kernel_1<char> >, dlib::tokenizer_kernel_1>&, dlib::tokenizer_kernel_1&, unsigned long&, bool) [clone .constprop.767]': demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x5e): undefined reference to
dlib::tokenizer_kernel_1::get_token(int&, std::string&)'
demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x3bd): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x3d1): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x53e): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x5c4): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x5e2): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x694): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x6b2): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN4dlib22config_reader_kernel_1INS_12map_kernel_1ISsSsNS_27binary_search_tree_kernel_2ISsSsNS_33memory_manager_stateless_kernel_1IcEESt4lessISsEEES4_EENS1_ISsPvNS2_ISsS9_S4_S6_EES4_EENS_18tokenizer_kernel_1EE17parse_config_fileERSD_RSC_Rmb.constprop.767[_ZN5State11load_configERKSs]+0x79e): undefined reference to
dlib::tokenizer_kernel_1::get_token(int&, std::string&)'
CMakeFiles/demo.dir/demo.cpp.o: In function main': demo.cpp:(.text.startup+0x9b4): undefined reference to
dlib::directory::init(std::string const&)'
CMakeFiles/demo.dir/demo.cpp.o: In function State::load_config(std::string const&)': demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x1f8): undefined reference to
dlib::tokenizer_kernel_1::numbers() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x20a): undefined reference to dlib::tokenizer_kernel_1::uppercase_letters() const' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x21c): undefined reference to
dlib::tokenizer_kernel_1::lowercase_letters() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x28d): undefined reference to dlib::tokenizer_kernel_1::uppercase_letters() const' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x29f): undefined reference to
dlib::tokenizer_kernel_1::lowercase_letters() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x2d4): undefined reference to dlib::tokenizer_kernel_1::set_identifier_token(std::string const&, std::string const&)' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x3e3): undefined reference to
dlib::tokenizer_kernel_1::get_token(int&, std::string&)'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0xe42): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0xe60): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0xfdb): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x1071): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x1094): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x1109): undefined reference to
dlib::tokenizer_kernel_1::peek_token() const'
demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x112c): undefined reference to dlib::tokenizer_kernel_1::get_token(int&, std::string&)' demo.cpp:(.text._ZN5State11load_configERKSs[_ZN5State11load_configERKSs]+0x1269): undefined reference to
dlib::tokenizer_kernel_1::get_token(int&, std::string&)'
collect2: error: ld returned 1 exit status
CMakeFiles/demo.dir/build.make:178: recipe for target 'demo' failed
make[2]: *** [demo] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/demo.dir/all' failed
make[1]: *** [CMakeFiles/demo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
OS: Ubuntu 16.04
OPENCV: 3.4.4 version (Build from source with CUDA 10.1, cuDNN: v7.6.5)
DLIB version: 19.19.0 (Build from source with CUDA 10.1, cuDNN: v7.6.5)
Cmake version: 3.16.3
-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.1
-- Found cuDNN: v7.6.5 (include: /usr/local/cuda/include, library: /usr/local/cuda/lib64/libcudnn.so)
-- Autodetected CUDA architecture(s): 6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
-- Using CMake version: 3.16.3
-- Compiling dlib version: 19.19.0
-- Enabling AVX instructions
-- Found system copy of libpng: /usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so
-- Found system copy of libjpeg: /usr/lib/x86_64-linux-gnu/libjpeg.so
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Found OpenBLAS library
-- Using OpenBLAS's built in LAPACK
-- C++11 activated.
-- Configuring done
-- Generating done
Could you please help me check it?
Or atl least, could you share to me your configuration like above?
Thank you very much!
test on the GTX1070 7fps did not reach 40fps Are there alse parameters that need to be modified
A great work! when I try to make ,and argparse.hpp :No such file.I have installed argparse in python3,could you please tell me why?
Hi,
I have been trying to run the code in this repository but from my observation the accuracy of the CPP version seems to be worse than the python version for the same input. I suspected two things:
I tried running the convert tool on the refined models in the SiamMask repository at the following link:
https://github.com/jiwoong-choi/SiamMask#converting-siammask-model-with-the-refine-module-to-torch-scripts
However, I seem to get the dumped module files to be different in size than the ones provided in the repository (https://github.com/nearthlab/SiamMaskCpp/releases/download/v1.0/SiamMask_DAVIS.tar.gz).
The output is as follows:
feature_downsampler.pt - 1039 KB
feature_extractor.pt - 54,097 KB
mask_conv_kernel.pt - 2,319 KB
mask_conv_search.pt - 2,319 KB
mask_depthwise_conv.pt - 3 KB
refine_model.pt - 10,468 KB
rpn_model.pt - 9,812 KB
Downloaded torch script modules:
feature_downsampler.pt - 1096 KB
feature_extractor.pt - 57,056 KB
mask_conv_kernel.pt - 2,360 KB
mask_conv_search.pt - 2,360 KB
mask_depthwise_conv.pt - 3 KB
refine_model.pt - 11,210 KB
rpn_model.pt - 10,428 KB
Also the fps that I get when I use these models is one-fourth of the fps that I get when I use the models referred for download in the repository. Am I doing something wrong?
Is C++ code implementation different from Python code implementation?
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.