yijingru / BBAVectors-Oriented-Object-Detection

[WACV2021] Oriented Object Detection in Aerial Images with Box Boundary-Aware Vectors
MIT License
469 stars 88 forks source link

Shape error on Custom Data #101

Open Arka161 opened 3 years ago

Arka161 commented 3 years ago

Hello,

I am trying to train using custom data. I get shape errors, both with and without Batch Normalization in the file mentioned in the README.

My command:

python main.py --data_dir <data_dir> --num_epoch 20 --batch_size 4 --dataset dota --phase train

Output:

  File "C:\BBA\BBAVectors-Oriented-Object-Detection-master\loss.py", line 88, in forward
    pos_loss = torch.log(pred) * torch.pow(1 - pred, 2) * pos_inds
RuntimeError: The size of tensor a (15) must match the size of tensor b (11) at non-singleton dimension 1

My dataset is in the DOTA format, both in directories and filenames. Is there anything else I should do? Thanks

Arka161 commented 3 years ago

This happens for all file shapes. 32 x 32, 576 x 576, 64 x 64, etc.

yijingru commented 3 years ago

You may output all tensors' shapes in loss.py:88 to locate the error.

luozy-usc commented 3 years ago

I also encounter this problem, the input images are in the shape of 512*512. I guess this kind of problem has something to do with the processing of gt. Have you solved this problem?

Following is my tensor shapes in loss.py:88: pred shape: torch.Size([4, 15, 152, 152]) pos_inds shape: torch.Size([4, 11, 152, 152])

It seems like the problem is that the positive objects in the gt cannot match to the prediction?

luozy-usc commented 3 years ago

I think I have solved this problem, the reason is that we need to change the class number in /home/zhiyao/workspace/BBAVectors-Oriented-Object-Detection/main.py line35 from 15 to 11.