Windows环境下复现LSTR调试记录

@LOVELWY

ImportError: cannot import name ‘_new_empty_tensor’ from ‘torchvision.ops’

找到报错位置misc.py

import torchvision
if float(torchvision.__version__[:3]) < 0.7:
    from torchvision.ops import _new_empty_tensor
    from torchvision.ops.misc import _output_size

利用Print()函数(torchvision.version)查看Torchvision的版本

import torchvision
print(torchvision._version_)

结果显示:

0.14.0+cu117

float(torchvision.version[:3])代码只检查前3个字符,因此它认为我的版本是0.1,故出现报错。

查找资料可注释掉相关的代码即可,这样做需要仔细查看但代码比较麻烦,想到一个办法,即将代码改成:

import torchvision
if float(torchvision.__version__[2:4]) < 7:
    from torchvision.ops import _new_empty_tensor
    from torchvision.ops.misc import _output_size

ModuleNotFoundError: No module named ‘sklearn’

沒有安裝sklearn,安装完sklearn之后依然会报错
注意要裝的不是sklearn而是scikit-learn

pip install scikit-learn -i  https://pypi.tuna.tsinghua.edu.cn/simple/

test.py: error: the following arguments are required: cfg_file

直接在编译器Pycharm运行报错,定位到报错位置:

parser = argparse.ArgumentParser(description="Test CornerNet")
    parser.add_argument("cfg_file", help="config file", type=str)

查阅资料发现parser是命令行交互的端口,所以选择使用命令行运行,运行之前更改LSTR.json文件中data的位置为测试集存储的位置。

"E:\LSTR-main\config\LSTR.json"
 "data_dir": "E:/LSTR-main/cache/",
 默认为"data_dir": "../../",

命令行运行成功

输入命令行运行语句为:

python test.py LSTR --testiter 500000 --modality eval --split testing --debug --debugDec

在这里插入图片描述

测试集效果

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值