donnyyou / torchcv

TorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision
https://pytorchcv.com
Apache License 2.0
2.25k stars 378 forks source link

TypeError with PyTorch 1.2 #80

Open adityaarun1 opened 5 years ago

adityaarun1 commented 5 years ago

Hi,

When running Faster R-CNN, I am getting the following error:

2019-08-27 23:24:51,231 INFO    [controller.py, 28] Training start...
Traceback (most recent call last):
  File "main.py", line 181, in <module>
    Controller.train(runner)
  File "/ssd_scratch/cvit/aditya/torchcv/runner/tools/controller.py", line 37, in train
    runner.train()
  File "/ssd_scratch/cvit/aditya/torchcv/runner/det/faster_rcnn.py", line 85, in train
    out_dict = self.det_net(data_dict)
  File "/home/aditya.a/Libraries/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/ssd_scratch/cvit/aditya/torchcv/model/det/nets/faster_rcnn.py", line 74, in forward
    x = self.backbone(data_dict['img'])
  File "/home/aditya.a/Libraries/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aditya.a/Libraries/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/home/aditya.a/Libraries/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aditya.a/Libraries/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 338, in forward
    self.padding, self.dilation, self.groups)
TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not DataContainer

Any idea how to fix this? I am on PyTorch 1.2, and Python 3.7

donnyyou commented 5 years ago

I will fix it in this week.

donnyyou commented 5 years ago

The data type that the loader returns is DataContainer. A minor fix will work!

lemuriandezapada commented 5 years ago

Yes, I also found that particular issue strange Basically the loader returns DataContainer and then you try to pass this object to the model, and it naturally just crashes