lzx1413 / PytorchSSD

pytorch version of SSD and it's enhanced methods such as RFBSSD,FSSD and RefineDet
MIT License
708 stars 237 forks source link

When set -s to 512 the SSD_vgg and FSSD_vgg can't run correctly #6

Closed auroua closed 6 years ago

auroua commented 6 years ago

When I set -s to 300, there is nothing error reported, but when I set -s to 512 , the -v to SSD_vgg: the error info is

Traceback (most recent call last):
  File "/home/aurora/workspaces12/PytorchSSD/train_ssds.py", line 434, in <module>
    train()
  File "/home/aurora/workspaces12/PytorchSSD/train_ssds.py", line 291, in train
    loss_l, loss_c = criterion(out, priors, targets)
  File "/usr/software/anaconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aurora/workspaces12/PytorchSSD/layers/modules/multibox_loss.py", line 86, in forward
    pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
  File "/usr/software/anaconda3/lib/python3.5/site-packages/torch/autograd/variable.py", line 433, in expand_as
    return self.expand(tensor.size())
RuntimeError: The expanded size of the tensor (32256) must match the existing size (32756) at non-singleton dimension 1. at /home/aurora/workspaces12/backup/pytorch/torch/lib/THC/generic/THCTensor.c:340
Exception ignored in: <bound method DataLoaderIter.__del__ of <torch.utils.data.dataloader.DataLoaderIter object at 0x7fbca40ab2e8>>

When set -v to FSSD_vgg, the error info is

Traceback (most recent call last):
  File "/home/aurora/workspaces12/PytorchSSD/train_ssds.py", line 107, in <module>
    net = build_net(img_dim, num_classes)
  File "/home/aurora/workspaces12/PytorchSSD/models/FSSD_vgg.py", line 205, in build_net
    head = multibox(fea_channels, mbox[str(size)], num_classes), num_classes=num_classes)
  File "/home/aurora/workspaces12/PytorchSSD/models/FSSD_vgg.py", line 180, in multibox
    assert len(fea_channels) == len(cfg)
AssertionError

I changed the fea_channels to fea_channels = [512, 512, 256, 256, 256, 256, 256], and the error info is

Loading base network...
Initializing weights...
Loading Dataset...
Training FSSD_vgg on VOC0712
Traceback (most recent call last):
  File "/home/aurora/workspaces12/PytorchSSD/train_ssds.py", line 434, in <module>
    train()
  File "/home/aurora/workspaces12/PytorchSSD/train_ssds.py", line 288, in train
    out = net(images)
  File "/usr/software/anaconda3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/aurora/workspaces12/PytorchSSD/models/FSSD_vgg.py", line 106, in forward
    concat_fea = torch.cat(transformed_features,1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 38 and 64 in dimension 2 at /home/aurora/workspaces12/backup/pytorch/torch/lib/THC/generic/THCTensorMath.cu:111
Exception ignored in: <bound method DataLoaderIter.__del__ of <torch.utils.data.dataloader.DataLoaderIter object at 0x7f24b402c198>>
lzx1413 commented 6 years ago

We have not tested 512 yet, you have to do some change to the model definition file like the RFB_SSD models. I will update the 512 version in a few days.