ducha-aiki / affnet

Code and weights for local feature affine shape estimation paper "Repeatability Is Not Enough: Learning Discriminative Affine Regions via Discriminability"
MIT License
266 stars 47 forks source link

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation #28

Closed yangninghua closed 4 years ago

yangninghua commented 4 years ago

parsed options:
{'dataroot': 'dataset/6Brown', 'log_dir': './logs', 'num_workers': 8, 'pin_memory': True, 'resume': '', 'start_epoch': 0, 'epochs': 20, 'batch_size': 1024, 'test_batch_size': 1024, 'n_pairs': 1000, 'n_test_pairs': 50000, 'lr': 0.005, 'wd': 0.0001, 'no_cuda': False, 'gpu_id': '0,1', 'expname': 'AffNetFast_lr005_10M_20ep_aswap', 'seed': 0, 'log_interval': 10, 'descriptor': 'HardNet', 'loss': 'HardNegC', 'arch': 'AffNetFast', 'cuda': True}

train_AffNet_test_on_graffity.py:249: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
  var_image = torch.autograd.Variable(torch.from_numpy(img.astype(np.float32)), volatile = True)
train_AffNet_test_on_graffity.py:249: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
  var_image = torch.autograd.Variable(torch.from_numpy(img.astype(np.float32)), volatile = True)
0.5302860736846924 detection multiscale
affnet_time 0.08162307739257812
pe_time 0.038355112075805664
0.12385892868041992 affine shape iters
0.23496747016906738 detection multiscale
affnet_time 0.02823162078857422
pe_time 0.04812979698181152
0.08057141304016113 affine shape iters
Test epoch -1
Test on graf1-6, 196 tentatives 10 true matches 0.051  inl.ratio
Now native ori
0.07808423042297363 detection multiscale
affnet_time 0.025239229202270508
pe_time 0.03278350830078125
0.06878876686096191 affine shape iters
0.07655787467956543 detection multiscale
affnet_time 0.025121450424194336
pe_time 0.0314483642578125
0.0674288272857666 affine shape iters
Test epoch -1
Test on ori graf1-6, 107 tentatives 9 true matches 0.084  inl.ratio
0it [00:00, ?it/s]Traceback (most recent call last):
  File "train_AffNet_test_on_graffity.py", line 416, in <module>
    main(train_loader, test_loader, model)
  File "train_AffNet_test_on_graffity.py", line 380, in main
    train(train_loader, model, optimizer1, epoch)
  File "train_AffNet_test_on_graffity.py", line 235, in train
    loss.backward()
  File "/root/anaconda3_py3.6_torch0.4.1/lib/python3.6/site-packages/torch/tensor.py", line 102, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/root/anaconda3_py3.6_torch0.4.1/lib/python3.6/site-packages/torch/autograd/__init__.py", line 90, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
0it [00:02, ?it/s]