Centernet: demo.py ctdet RuntimeError: invalid hash value

Created on 17 May 2019  ·  8Comments  ·  Source: xingyizhou/CenterNet

environment:Ubuntu16.04 + python3.6 + pytorch0.4.1 + cuda9.0(no cudnn) GPU 2080 11G

I want to know how the error appears, why the code direct to pose_dla_dcn.py when I just use the cedet? The I/O informations is as follows.

(cenet) xxx@xxx:~/workspace/cenet/src$ python demo.py ctdet --demo ../images --load_model ../models/ctdet_coco_dla_2x.pth
Fix size testing.
training chunk_sizes: [32]
The output will be saved to /home/spring/workspace/cenet/src/lib/../../exp/ctdet/default
heads {'hm': 80, 'wh': 2, 'reg': 2}
Creating model...
Downloading: "http://dl.yf.io/dla/models/imagenet/dla34-ba72cf86.pth" to /home/spring/.torch/models/dla34-ba72cf86.pth
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5465/5465 [00:00<00:00, 1471048.09it/s]
Traceback (most recent call last):
File "demo.py", line 56, in
demo(opt)
File "demo.py", line 21, in demo
detector = Detector(opt)
File "/home/spring/workspace/cenet/src/lib/detectors/ctdet.py", line 22, in __init__
super(CtdetDetector, self).__init__(opt)
File "/home/spring/workspace/cenet/src/lib/detectors/base_detector.py", line 24, in __init__
self.model = create_model(opt.arch, opt.heads, opt.head_conv)
File "/home/spring/workspace/cenet/src/lib/models/model.py", line 28, in create_model
model = get_model(num_layers=num_layers, heads=heads, head_conv=head_conv)
File "/home/spring/workspace/cenet/src/lib/models/networks/pose_dla_dcn.py", line 491, in get_pose_net
head_conv=head_conv)
File "/home/spring/workspace/cenet/src/lib/models/networks/pose_dla_dcn.py", line 434, in __init__
self.base = globals()base_name
File "/home/spring/workspace/cenet/src/lib/models/networks/pose_dla_dcn.py", line 314, in dla34
model.load_pretrained_model(data='imagenet', name='dla34', hash='ba72cf86')
File "/home/spring/workspace/cenet/src/lib/models/networks/pose_dla_dcn.py", line 300, in load_pretrained_model
model_weights = model_zoo.load_url(model_url)
File "/home/spring/anaconda3/envs/cenet/lib/python3.6/site-packages/torch/utils/model_zoo.py", line 65, in load_url
_download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File "/home/spring/anaconda3/envs/cenet/lib/python3.6/site-packages/torch/utils/model_zoo.py", line 101, in _download_url_to_file
.format(hash_prefix, digest))
RuntimeError: invalid hash value (expected "ba72cf86", got "14cd8aa9060346eea8b3fb0525ff2e77ac90e9835ec83b9314845da20bd546ba")

Most helpful comment

The model in baidu cloud disk(except an 2.2G model) is:
model zoo
The Code: rqnd
Someone may need it.
链接: https://pan.baidu.com/s/1A4UjKQyWhNA78OKfnSpajA 提取码: rqnd 复制这段内容后打开百度网盘手机App,操作更方便哦

All 8 comments

May be the Network error, the pretrained model dla34-ba72cf86.pth downloaded is not correct, so the hash value occurs. Now I want to know whether it is ok not to download the pretrained model and how to close it. The code is a bit of complex before I read it closely, so hope your help now. Thank you in advance!

The model in baidu cloud disk(except an 2.2G model) is:
model zoo
The Code: rqnd
Someone may need it.
链接: https://pan.baidu.com/s/1A4UjKQyWhNA78OKfnSpajA 提取码: rqnd 复制这段内容后打开百度网盘手机App,操作更方便哦

我也感觉奇怪,跑demo的时候已经下了一个模型放在了models文件夹里面,代码里面为何还要自动下一个模型?

因为在模型创建的时候会有一个预训练的选项,可以选择关掉应该就不会自动下载了,但我没仔细读代码所以没找到。我通过将模型手动下载保存到指定位置解决了这一问题,通过ipv6可以很快下载(curl指令),不知道为什么代码运行中加载不出来。
另外在我的2080显卡上使用pytorch0.4.1和cuda9.0不能运行dla模型(提示显存不够,我看其他人也出现过类似问题),勉强运行res18能看结果但会报错,最后参照已关闭的issue中的解决方案换回了pytorch1.0和cuda10.0的环境就好了。

我也感觉奇怪,跑demo的时候已经下了一个模型放在了models文件夹里面,代码里面为何还要自动下一个模型?

It's OK to comment out the line of loading the imagenet pretrained model.

It's OK to change pose_dla_dcn.py get_pose_net function "pretrained=False".What is the role of this pretrained model?

It is used in training.

您好,请问,test和demo的时候把pretrained选项设置称false了,但是会报错Drop parameter base.fc.if you see this ......, 好像是因为下载的权重里有fc层的权重,而关掉pretrained选项后,这个fc层没有被添加进网络,这个怎么解决呢,是test和demo必须要下载预训练的dla权重吗?说不通啊。。这不是训练的时候用的吗

Was this page helpful?
0 / 5 - 0 ratings