longcw / yolo2-pytorch

YOLOv2 in PyTorch
1.54k stars 421 forks source link

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

Open kevinpzy opened 5 years ago

kevinpzy commented 5 years ago

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

kevinpzy commented 5 years ago

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

bandontseng commented 5 years ago

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.

mqchen1993 commented 5 years ago

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

wenhaotang commented 5 years ago

I downgraded the pytorch version to 0.4.0 and it worked.

maxenceliu commented 5 years ago

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)):

zhuang5252 commented 1 year ago

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