目标跟踪pytracking框架运行遇到的问题以及各种解法(cuda11.3+pytroch1.10)

pytracking网址:https://github.com/visionml/pytrackingpytracking

强烈推荐这个视频
最大的难点在于这个视频cuda是用cuda10+pytorch1.2.0,cuda10+pytorch1.2.0的朋友看这个视频就完事了,应该没啥问题。
本人用的是3090显卡,不能用cuda10,用的是cuda11.3+pytroch1.10
安装命令:conda install pytorch1.10.0 torchvision0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge
不推荐用命令conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch,我用之后pytorch格式和cuda11.3对不上。。
pytorch对应版本
除了pytorch,其他安装包按照install.sh一个个按就完事。

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

我遇到的问题

1.首先是otb数据集文件的问题,前面推荐的视频里面说了,自己debug也能解决。
2.local自己填上otb等数据集的存放位置
python -c "from pytracking.evaluation.environment import create_default_local_file; create_default_local_file()"
python -c "from ltr.admin.environment import create_default_local_file; create_default_local_file()"
创建用于配置路径的两个local.py
3.下载模型,模型地址
4./home/ubuntu/wl/pytracking/ltr/external/PreciseRoIPoolinggit里面没东西的要运行命令: submodule update --init
正常的PreciseRoIPoolinggit:
正常的PreciseRoIPoolinggit
5.报错AttributeError: module ‘torch‘ has no attribute ‘irfft‘
报错原因 : toch.rfft和torch.ifft这个函数在pytorch-1.8被移除
解决:在/home/ubuntu/wl/pytracking/pytracking/libs/fourier.py中开头添加

from torch.fft import irfft2
from torch.fft import rfft2

def rfft(x, d):
    t = rfft2(x, dim = (-d,-1))
    return torch.stack((t.real, t.imag), -1)
def irfft(x, d, signal_sizes):
    return irfft2(torch.complex(x[:,:,0], x[:,:,1]), s = signal_sizes, dim = (-d,-1))

在这里插入图片描述
然后把文件中出现的torch.rfft和torch.irfft改成rfft和irfft
这样改完之后运行atom会出现预测框不动的现象,但运行dimp和tomp正常。
6. rect = patches.Rectangle((box[0], box[1]), box[2], box[3], linewidth=1, edgecolor=col, facecolor=‘none’)出错,box和boxes格式总是对不上,原因不知道,但tomp和dimp没用到这个函数,所以没影响,只有atom用到了visual…
解决办法:/home/ubuntu/wl/pytracking/pytracking/evaluation/tracker.py640行改为以下:

def visualize(self, image, state, segmentation=None):
        self.ax.cla()
        self.ax.imshow(image)
        if segmentation is not None:
            self.ax.imshow(segmentation, alpha=0.5)

        if isinstance(state, (OrderedDict, dict)):
            boxes = [v for k, v in state.items()]
        elif isinstance(state, list):
            boxes = state
        else:
            boxes = (state,)

        box = boxes
        if len(box) == 1:
            box = boxes[0]
        col = _tracker_disp_colors[1]
        col = [float(c) / 255.0 for c in col]
        rect = patches.Rectangle((box[0], box[1]), box[2], box[3], linewidth=1, edgecolor=col, facecolor='none')
        self.ax.add_patch(rect)

7.安装环境应该先对应最近的cuda版本,如自己的30系显卡,只能按cuda11.+,自己是11.3,所以pytorch要对应11.31
安装对应的pytorch,再解决出现的问题。

运行结果:

Evaluating    1 trackers on     1 sequences
Tracker: dimp dimp50 None ,  Sequence: Soccer
Setting up a new session...
/home/ubuntu/miniconda3/envs/pytracking1/lib/python3.7/site-packages/torch/nn/functional.py:3635: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode)
Using /home/ubuntu/.cache/torch_extensions/py37_cu113 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file /home/ubuntu/.cache/torch_extensions/py37_cu113/_prroi_pooling/build.ninja...
Building extension module _prroi_pooling...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module _prroi_pooling...
/home/ubuntu/miniconda3/envs/pytracking1/lib/python3.7/site-packages/torch/nn/functional.py:3635: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode)
Visdom failed to handle a handler for {'target': 'block_list', 'eid': 'main', 'event_type': 'Click', 'image_coord': {'x': 3, 'y': 69, 'visibility': 'hidden'}, 'pane_data': {'command': 'window', 'id': 'block_list', 'title': 'Block List', 'inflate': True, 'width': None, 'height': None, 'contentID': '822e549d-772f-4463-b00a-0eafdd43c7e2', 'content': [{'type': 'checkbox', 'name': 'Help', 'value': True}, {'type': 'checkbox', 'name': 'Training Loss', 'value': False}, {'type': 'checkbox', 'name': 'Score Map', 'value': False}, {'type': 'checkbox', 'name': 'Status', 'value': True}], 'type': 'properties', 'i': 0}}: 'propertyId'
Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/pytracking1/lib/python3.7/site-packages/visdom/__init__.py", line 634, in on_message
    handler(message)
  File "/home/ubuntu/wl/pytracking/pytracking/../pytracking/utils/visdom.py", line 390, in block_list_callback_handler
    field_name = self.blocks_list[data['propertyId']]['name']
KeyError: 'propertyId'
FPS: 33.407621186015774
Done

用visdom就能看了python -m visdom.server
查看显存占比watch -n 2 -d nvidia-smi

其他:

E.T.track没有训练代码,环境用transt的环境就行:torch1.5.1,和我的cuda11.3没有对应上,但也能正常运行。
用E.T.track中的pytracking运行atom或者其他的运行不了,应该还是版本不对。。
pytracking最主要的问题还是这个报错:RuntimeError: Error building extension ‘_prroi_pooling’
其实还是pytorch的版本问题,cuda11.0可能没办法编译PreciseRolPooling,我的11.3是可以正常编译的。
或者看看些文章:

https://blog.csdn.net/laizi_laizi/article/details/124458464?spm=1001.2014.3001.5501
https://blog.csdn.net/qqsuiying/article/details/121593987

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
根据引用,当前最稳定的PyTorch版本是1.10.2,可支持的CUDA版本是10.2和11.3。因此,CUDA11.3PyTorch版本1.10.2是可以配对使用的。 你可以按照引用中提供的命令来安装适合的版本,即运行以下命令: conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch 另外,根据引用中提供的方法,你也可以指定CUDA Toolkit版本来安装PyTorch。比如,如果你要安装11.3CUDA Toolkit版本,可以运行以下命令: conda install pytorch cudatoolkit=11.3 -c pytorch 通过指定CUDA Toolkit版本,conda会自动匹配到合适版本的PyTorch。这样,你就可以将CUDA11.3PyTorch版本1.10.2成功配对使用了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [CUDA11.3以及PyTorch-GPU版本安装](https://blog.csdn.net/weixin_45763636/article/details/123169495)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [PyTorchCUDA Toolkit 及显卡驱动版本对应关系](https://blog.csdn.net/wxy2020915/article/details/126543594)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值