longcw / yolo2-pytorch

YOLOv2 in PyTorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: "Unable to open object (object 'conv1s.0.0.bn.num_batches_tracked' doesn't exist)"

kevinpzy opened this issue · comments

Traceback (most recent call last):
File "demo.py", line 37, in
net_utils.load_net(trained_model, net)
File "/home/pcrane/yolo2-pytorch/utils/network.py", line 66, in load_net
param = torch.from_numpy(np.asarray(h5f[k]))
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/pcrane/anaconda3/lib/python3.6/site-packages/h5py/_hl/group.py", line 167, in getitem
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'conv1s.0.0.bn.num_batches_tracked' doesn't exist)"
12
22

Who can tell me how to solve this issue?Please!

I found this issue is caused by the pytorch. You can check this commit:
https://github.com/wuhuikx/pytorch/commit/e2b835d7176d8508876c400c68105d47949c6973

To evade this issue, I downgrade the pytorch , pytorch==py36hdf912b8_0 for anaconda. Or upgrading to the latest version may can fix this issue too, but I haven't tried it yet.

I also encountered the same problem. Have you solved it? @kevinpzy

I downgraded the pytorch version to 0.4.0 and it worked.

In FILE darknet.py Change Line 283
for i, start in enumerate(range(0, len(keys), 5)):
for i, start in enumerate(range(0, len(keys), 6)):

It is useless to load the model in the retraining, and the loaded model will be commented out.
image