danieljf24/dual_encoding

训练出的压缩文件损坏

Closed this issue · 9 comments

作者你好,我在测试数据时出现了一个错误:
IOError: [Errno 20] Not a directory: '/home/VisualSearch/testCollection/runs/model_best.pth.tar/pred_errors_matrix.pth.tar'
并且无法打开压缩文件model_best.pth.tar。请问是否是我在训练时出现了什么问题?
非常感谢!

这个在哪个文件第几号报错?另外,你是否改动过测试代码tester.py?

我没有改动过tester.py
具体错误如下
Traceback (most recent call last):
File "/data/projects/untitled/tester.py", line 136, in
main()
File "/data/projects/untitled/tester.py", line 110, in main
torch.save({'errors': c2i_all_errors, 'videos': video_ids, 'captions': caption_ids}, pred_error_matrix_file)
File "/data/anaconda3/envs/pytorch/lib/python2.7/site-packages/torch/serialization.py", line 161, in save
return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol))
File "/data/anaconda3/envs/pytorch/lib/python2.7/site-packages/torch/serialization.py", line 116, in _with_file_like
f = open(f, mode)
IOError: [Errno 20] Not a directory: '/home/VisualSearch/testCollection/runs/model_best.pth.tar/pred_errors_matrix.pth.tar'

保存相似度矩阵的时候报了错,你可以注释掉line 110,这不影响测试。
你看看是否存在/home/VisualSearch/testCollection/runs/model_best.pth.tar这个文件夹,如果存在请列出下面的文件。另外,你的testCollection是不是弄错了?应该是marvvt10ktest

非常感谢!我注释掉110行之后就运行成功了。
但是我无法提取model_best.pth.tar文件下的文件。显示压缩文件格式错误。
请问这个压缩文件有什么特殊的提取方法吗?

train目录下的model_best.pth.tar是pytorch保存模型文件,test目录下的model_best.pth.tar是文件夹而不是文件。我感觉你哪里改了代码,测试的时候理论上会自动生成/home/VisualSearch/testCollection/runs/model_best.pth.tar这个文件夹,然后把相识度矩阵保存在该文件夹下

我运行tester的时候无法自动生成model_best.pth.tar是文件夹。
最开始运行时,他会显示错误:
[28 Apr 16:21:50 - tester.py:line 55] runs/model_best.pth.tar not exists.
于是我就把train目录下的model_best.pth.tar是pytorch保存模型文件复制到/home/VisualSearch/testCollection/runs下

再次运行,还是会显示:
[28 Apr 16:21:50 - tester.py:line 55] runs/model_best.pth.tar not exists.

此时,我就将52行的路径为resume = os.path.join(opt.logger_name, opt.checkpoint_name)
改为了
resume = os.path.join(ROOT_PATH,testCollection,opt.logger_name, opt.checkpoint_name)
此时就会报110行代码的错误。
我按照刚刚你说的方法,将110行注释掉,就可以运行了。

除此之外并没有修改tester的任何代码。

请问我按照以上方法运行出的tester是否正确?为何我不能自动生成test目录下的model_best.pth.tar是文件夹

https://github.com/danieljf24/dual_encoding#expected-performance 按这个你能运行吗?
另外,你不应该去改代码,而是改脚本 --logger_name 指定你model_best.pth.tar在的位置

我们可以加一个联系方式吗?qq?微信?

你把你的微信号发我邮箱吧 danieljf24@163.com