pytracking系列跟踪算法的配置
(LWL,KYS,PrDiMP,DiMPandATO。。。注:配置环境为Ubuntu系统。
Windows版本配置见博客:
1、论⽂下载地址:
LWL:Learning What to Learn for Video Object Segmentation.[paper]
KYS: Know Your Surroundings: Exploiting Scene Information for Object Tracking.[paper]
PrDiMP:Probabilistic Regression for Visual Tracking.[paper]
DiMP:Learning Discriminative Model Prediction for Tracking.[paper]
ATOM: Accurate Tracking by Overlap Maximization.[paper]
2、代码下载:
3、新建虚拟环境并激活
conda create -n pytracking python=3.7.0
mysteriesactivate pytracking
4、安装pytorch
pip install torch===1.4.0 -f /whl/torch_stable.html
pip install torchvision===0.5.0 -f /whl/torch_stable.html
5、安装依赖库1
pip install matplotlib pandas tqdm
pip install opencv-python visdom tb-nightly scikit-image tikzplotlib gdown
6、安装依赖库2
pip install cython
pip install pycocotools
pip install lvis
7、安装Precise ROI pooling
1)安装ninja-build
sudo apt-get install ninja-build
如果不是sudoer账户,需要添加如下环境变量来使⽤ninja-build
export PATH="/usr/bin:/usr/lib:/usr/share:/usr/share/man:$PATH"
2)下载Precise ROI pooling库并将其拷贝到路径ltr/external/PreciseRoIPooling/
3)⽤PreciseRoIPooling/src/prroi_pooling_gpu_impl.cu替换
PreciseRoIPooling/pytorch/prroi_pool/src/prroi_pooling_gpu_impl.cu
⽤PreciseRoIPooling/src/prroi_pooling_gpu_impl.cuh替换
PreciseRoIPooling/pytorch/prroi_pool/src/prroi_pooling_gpu_impl.cuh
cp projectdir/pytracking-master/ltr/external/PreciseRoIPooling/src/prroi_pooling_gpu_impl.cu* projectdir/pytracking-master/ltr/external/PreciseRoIPooling/p
解释⼀下为什么要这么做: PreciseRoIPooling/pytorch/prroi_pool/src/prroi_pooling_gpu_impl.cuh和
PreciseRoIPooling/pytorch/prroi_pool/src/prroi_pooling_gpu_impl.cu这个两个⽂件⽤的是相对路径软连接,我们的代码不是通过琵琶名曲
git clone的形式安装的,相对路径失效,所以需要拷贝替换。⾄于为什么不⽤git clone,是因为服务器经常上不去github⽹站。
8、安装spatial-correlation-sampler (KYS tracker需要的库)
pip install spatial-correlation-sampler
海口java培训机构>dubbo一个服务多个方法9、安装jpeg4py
sudo apt-get install libturbojpeg
pip install jpeg4py
10、下载预训练模型
下载预训练模型
下载地址:
百度云下载地址:
新建networks路径保存下载的预训练模型
11、⽣成配置⽂件
运⾏:
python -c "from vironment import create_default_local_file; create_default_local_file()"
python -c "from vironment import create_default_local_file; create_default_local_file()"
运⾏之后,会⽣成pytracking/evaluation/local.py和ltr/admin/local.py两个配置⽂件,设置预训练模型路径和评价数据集路径
12、运⾏
开⼀个终端运⾏可视化服务器
activate pytracking
python -m visdom.server
开另⼀个终端运⾏代码
activate pytracking
python pytracking/run_tracker.py atom default --dataset_name otb --sequence Soccer --debug 1 --threads 0
参数解释⼀下:atom是需要运⾏的跟踪器名字
default是参数设置,在pytracking/parameter/atom路径下有很多参数可选。
otb是需要运⾏的数据集名称
Soccer是需要运⾏的视频序列名字
debug控制可视化等级
threads运⾏的线程数
python基础教程电子书百度云13、遇到错误(1)
raise Exception('Could not read file {}'.format(path))
Exception: Could not read file /data3/publicData/Datasets/OTB/OTB2015/BlurCar1/ 解决办法:
打开pytracking/utils/load_text.py更改函数:
def load_text_numpy(path, delimiter, dtype)
为如下:
def load_text_numpy(path, delimiter, dtype):
if isinstance(delimiter, (tuple, list)):
for d in delimiter:
try:
# ground_truth_rect = np.loadtxt(path, delimiter=d, dtype=dtype)
# to deal with different delimeters
import io
with open(path,'r') as f:
ground_truth_rect=np.loadtxt(io.ad().replace(',',' ')))
return ground_truth_rect
except:
pass中国自学网站
raise Exception('Could not read file {}'.format(path))
else:
ground_truth_rect = np.loadtxt(path, delimiter=delimiter, dtype=dtype)
return ground_truth_rect
14、遇到错误(2)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. ....
RuntimeError: Error building extension '_prroi_pooling'
问题原因:
pip安装的torch存在兼容性问题,⽆法⽣成_prroi_pooling库。⽤教程的conda⽅式安装即可。解决⽅法:
pip uninstall torch
pip uninstall torchvision
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
15、再次运⾏12步骤
编译成功
再次运⾏12步骤

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。