pytracking 配置过程 ubuntu18.04

下载代码

git clone https://github.com/visionml/pytracking.git

创建环境 https://github.com/visionml/pytracking/blob/master/INSTALL.md

conda create --name pytracking python=3.7
conda activate pytracking

conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
conda install matplotlib pandas tqdm
pip install opencv-python visdom tb-nightly scikit-image tikzplotlib gdown

conda install cython
pip install pycocotools
pip install lvis

sudo apt-get install ninja-build

pip install spatial-correlation-sampler
sudo apt-get install libturbojpeg
pip install jpeg4py 

# Environment settings for pytracking. Saved at pytracking/evaluation/local.py
python -c "from pytracking.evaluation.environment import create_default_local_file; create_default_local_file()"

# Environment settings for ltr. Saved at ltr/admin/local.py
python -c "from ltr.admin.environment import create_default_local_file; create_default_local_file()"

# Download the default network for DiMP-50 and DiMP-18
gdown https://drive.google.com/uc\?id\=1qgachgqks2UGjKx-GdO1qylBDdB1f9KN -O pytracking/networks/dimp50.pth
gdown https://drive.google.com/uc\?id\=1MAjrRJDCbL0DSjUKFyDkUuYS1-cYBNjk -O pytracking/networks/dimp18.pth

# Download the default network for ATOM
gdown https://drive.google.com/uc\?id\=1VNyr-Ds0khjM0zaq6lU-xfY74-iWxBvU -O pytracking/networks/atom_default.pth

# Download the default network for ECO
gdown https://drive.google.com/uc\?id\=1aWC4waLv_te-BULoy0k-n_zS-ONms21S -O pytracking/networks/resnet18_vggmconv1.pth

可以自己离线下载模型文件,下载模型权重,下载好的文件不要解压,直接重命名,去掉.tar

https://drive.google.com/drive/folders/1WVhJqvdu-_JG1U-V0IqfxTUa1SBPnL0O

(链接来自https://blog.csdn.net/PNAN222/article/details/91049022)

模型文件放在 pytracking/networks/

python -C 发生错误:ModuleNotFoundError: No module named 'ltr.external.PreciseRoIPooling.pytorch'

https://github.com/visionml/pytracking/issues/144

 

测试视频文件

cd pytracking
python run_webcam.py dimp dimp50

这里改为

cd pytracking
python run_webcam.py atom default a.mp4 #在pycharm参数中配置即可

pytracking 配置过程 ubuntu18.04_第1张图片

中间安装pip install spatial-correlation-sampler的问题,解决办法 export CUDA_HOME=/usr/local/cuda-10.0

(pytracking) cody@cody:~$ pip install spatial-correlation-sampler 
Collecting spatial-correlation-sampler
  Using cached spatial_correlation_sampler-0.2.1.tar.gz (8.2 kB)
Requirement already satisfied: torch>=1.1 in ./anaconda3/envs/pytracking/lib/python3.7/site-packages (from spatial-correlation-sampler) (1.3.1)
Requirement already satisfied: numpy in ./anaconda3/envs/pytracking/lib/python3.7/site-packages (from spatial-correlation-sampler) (1.19.1)
Building wheels for collected packages: spatial-correlation-sampler
  Building wheel for spatial-correlation-sampler (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/cody/anaconda3/envs/pytracking/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-xy9vb1gz
       cwd: /tmp/pip-install-r145eod1/spatial-correlation-sampler/
  Complete output (19 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/spatial_correlation_sampler
  copying Correlation_Module/spatial_correlation_sampler/spatial_correlation_sampler.py -> build/lib.linux-x86_64-3.7/spatial_correlation_sampler
  copying Correlation_Module/spatial_correlation_sampler/__init__.py -> build/lib.linux-x86_64-3.7/spatial_correlation_sampler
  running build_ext
  building 'spatial_correlation_sampler_backend' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/Correlation_Module
  gcc -pthread -B /home/cody/anaconda3/envs/pytracking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation.cpp -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation.o -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  gcc -pthread -B /home/cody/anaconda3/envs/pytracking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation_sampler.cpp -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation_sampler.o -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  :/usr/local/cuda-10.0/bin/nvcc -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation_cuda_kernel.cu -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation_cuda_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_61,code=sm_61 -std=c++11
  unable to execute ':/usr/local/cuda-10.0/bin/nvcc': No such file or directory
  error: command ':/usr/local/cuda-10.0/bin/nvcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for spatial-correlation-sampler
  Running setup.py clean for spatial-correlation-sampler
Failed to build spatial-correlation-sampler
Installing collected packages: spatial-correlation-sampler
    Running setup.py install for spatial-correlation-sampler ... error
    ERROR: Command errored out with exit status 1:
     command: /home/cody/anaconda3/envs/pytracking/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p345xhjc/install-record.txt --single-version-externally-managed --compile --install-headers /home/cody/anaconda3/envs/pytracking/include/python3.7m/spatial-correlation-sampler
         cwd: /tmp/pip-install-r145eod1/spatial-correlation-sampler/
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/spatial_correlation_sampler
    copying Correlation_Module/spatial_correlation_sampler/spatial_correlation_sampler.py -> build/lib.linux-x86_64-3.7/spatial_correlation_sampler
    copying Correlation_Module/spatial_correlation_sampler/__init__.py -> build/lib.linux-x86_64-3.7/spatial_correlation_sampler
    running build_ext
    building 'spatial_correlation_sampler_backend' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/Correlation_Module
    gcc -pthread -B /home/cody/anaconda3/envs/pytracking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation.cpp -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation.o -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    gcc -pthread -B /home/cody/anaconda3/envs/pytracking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation_sampler.cpp -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation_sampler.o -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    :/usr/local/cuda-10.0/bin/nvcc -DUSE_CUDA -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/TH -I/home/cody/anaconda3/envs/pytracking/lib/python3.7/site-packages/torch/include/THC -I:/usr/local/cuda-10.0/include -I/home/cody/anaconda3/envs/pytracking/include/python3.7m -c Correlation_Module/correlation_cuda_kernel.cu -o build/temp.linux-x86_64-3.7/Correlation_Module/correlation_cuda_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_61,code=sm_61 -std=c++11
    unable to execute ':/usr/local/cuda-10.0/bin/nvcc': No such file or directory
    error: command ':/usr/local/cuda-10.0/bin/nvcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/cody/anaconda3/envs/pytracking/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r145eod1/spatial-correlation-sampler/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p345xhjc/install-record.txt --single-version-externally-managed --compile --install-headers /home/cody/anaconda3/envs/pytracking/include/python3.7m/spatial-correlation-sampler Check the logs for full command output.

(pytracking) cody@cody:~$ export CUDA_HOME=/usr/local/cuda-10.0


(pytracking) cody@cody:~$ pip install spatial-correlation-sampler 
Collecting spatial-correlation-sampler
  Using cached spatial_correlation_sampler-0.2.1.tar.gz (8.2 kB)
Requirement already satisfied: torch>=1.1 in ./anaconda3/envs/pytracking/lib/python3.7/site-packages (from spatial-correlation-sampler) (1.3.1)
Requirement already satisfied: numpy in ./anaconda3/envs/pytracking/lib/python3.7/site-packages (from spatial-correlation-sampler) (1.19.1)
Building wheels for collected packages: spatial-correlation-sampler
  Building wheel for spatial-correlation-sampler (setup.py) ... done
  Created wheel for spatial-correlation-sampler: filename=spatial_correlation_sampler-0.2.1-cp37-cp37m-linux_x86_64.whl size=2027391 sha256=c2ff30e4d81d581d9455937f88317bdaf6054734765491ee5fd6771ecef4851c
  Stored in directory: /home/cody/.cache/pip/wheels/c3/0e/10/4b97e589249d5fdfff11f472fc432de58713b25e10b3579ecd
Successfully built spatial-correlation-sampler
Installing collected packages: spatial-correlation-sampler
Successfully installed spatial-correlation-sampler-0.2.1

 

 

你可能感兴趣的:(目标跟踪,深度学习)