bingykang / Fewshot_Detection

Few-shot Object Detection via Feature Reweighting
https://arxiv.org/abs/1812.01866
526 stars 111 forks source link

RuntimeError: argument 1 (padding) must be tuple of int but got tuple of (float, float) #4

Open crh19970307 opened 4 years ago

crh19970307 commented 4 years ago

When I run

python train_meta.py cfg/metayolo.data cfg/darknet_dynamic.cfg cfg/reweighting_net.cfg darknet19_448.conv.23

A runtime error occured

2019-10-18 23:20:07 epoch 0/353, processed 0 samples, lr 0.000033
Traceback (most recent call last):
  File "train_meta.py", line 325, in <module>    train(epoch)
  File "train_meta.py", line 218, in train    output = model(data, metax, mask)  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__    result = self.forward(*input, **kwargs)  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 73, in forward    outputs = self.parallel_apply(replicas, inputs, kwargs)  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 83, in parallel_apply
    return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 67, in parallel_apply
    raise output
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/parallel_apply.py", line 42, in _worker
    output = module(*input, **kwargs)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home1/ubuntu/project/Fewshot_Detection/darknet_meta.py", line 199, in forward
    dynamic_weights = self.meta_forward(metax, mask)
  File "/home1/ubuntu/project/Fewshot_Detection/darknet_meta.py", line 122, in meta_forward
    metax = model(metax)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 282, in forward
    self.padding, self.dilation, self.groups)
  File "/home/ubuntu/home1/software/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 89, in conv2d
    torch.backends.cudnn.deterministic, torch.backends.cudnn.enabled)
RuntimeError: argument 1 (padding) must be tuple of int but got tuple of (float, float)

Do you know what's wrong? Thanks

bingykang commented 4 years ago

Sorry, there is a typo in the instruction. I actually use python 2.7 instead of python 3.6. Change the python version, this problem shall be fixed.

cwLin1 commented 4 years ago

It can be solved by changing this line in darknet_meta.py pad = (kernel_size-1)/2 if is_pad else 0 into pad = (kernel_size-1)//2 if is_pad else 0