longcw / yolo2-pytorch

YOLOv2 in PyTorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ptype = dest_src['{}.{}'.format(list_key[-2], list_key[-1])] KeyError: 'bn.num_batches_tracked'

pursu opened this issue · comments

commented

Today, I first get this code. I want to train the yolov2 at the VOC2007 dataset. Then, I get this errror.

$ python train.py voc_2007_trainval gt roidb loaded from /home/lab603/pythonproject/yolo2-pytorch-master/data/cache/voc_2007_trainval_gt_roidb.pkl
load data succ...
('0-convolutional/kernel:0', torch.Size([32, 3, 3, 3]), (3, 3, 3, 32))
('0-convolutional/gamma:0', torch.Size([32]), (32,))
('0-convolutional/biases:0', torch.Size([32]), (32,))
('0-convolutional/moving_mean:0', torch.Size([32]), (32,))
('0-convolutional/moving_variance:0', torch.Size([32]), (32,))
Traceback (most recent call last):
File "train.py", line 33, in
net.load_from_npz(cfg.pretrained_model, num_conv=18)
File "/home/lab603/pythonproject/yolo2-pytorch-master/darknet.py", line 289, in load_from_npz
ptype = dest_src['{}.{}'.format(list_key[-2], list_key[-1])]
KeyError: 'bn.num_batches_tracked'

So please. How can I solve it.

In my case, it works when I installed pytorch 0.4.0, but 0.4.1 or higher version is not.
You can install lower version as follow.

$ conda install pytorch=0.4.0 cuda90 -c pytorch
https://pytorch.org/get-started/previous-versions/

This is the example in pytorch 0.4.0 and cuda 9.0. Please install your own version.