EfficientDet.Pytorch icon indicating copy to clipboard operation
EfficientDet.Pytorch copied to clipboard

Training on custom dataset (9 classes)

Open dvlshah opened this issue 4 years ago • 3 comments

Hi,

I am facing issue in biFpn module while starting the training using pretrained d1.

File "train.py", line 238, in train() File "train.py", line 183, in train classification, regression, anchors = model(images) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/home/deval/Projects/EfficientDet/EfficientDet.Pytorch/models/efficientdet.py", line 57, in forward x = self.extract_feat(inputs) File "/home/deval/Projects/EfficientDet/EfficientDet.Pytorch/models/efficientdet.py", line 90, in extract_feat x = self.neck(x[-5:]) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/home/deval/Projects/EfficientDet/EfficientDet.Pytorch/models/bifpn.py", line 105, in forward laterals = bifpn_module(laterals) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/home/deval/Projects/EfficientDet/EfficientDet.Pytorch/models/bifpn.py", line 186, in forward pathtd[i - 1] = (w1[0, i-1]*pathtd[i - 1] + w1[1, i-1]*F.interpolate(pathtd[i], scale_factor=3, mode='nearest'))/(w1[0, i-1] + w1[1, i-1] + self.eps) RuntimeError: The size of tensor a (10) must match the size of tensor b (15) at non-singleton dimension 3

Input Size : (640,640) Num Classes : 9

The data loaded is in the same format as the COCO.

Can you please help what am I doing wrong?

dvlshah avatar Jan 03 '20 06:01 dvlshah

Am also seeing the same issue. Were you able to resolve this issue?

sampathchanda avatar Jan 06 '20 05:01 sampathchanda

I changed the scale_factor=3 to scale_factor=2. I was able to start the training. I don't know what it is used for.

dvlshah avatar Jan 06 '20 05:01 dvlshah

Not sure which version of the model file you are using, but I see that scale_factor is set as 2 already. From a quick look, scale_factor seems to be the upsampling factor for the feature maps.

I was trying to run the eval.py script. Seems like the augmentation is not set properly for the validation phase (in the version of the code I checked in). The issue I was facing is fixed in the commit: https://github.com/toandaominh1997/EfficientDet.Pytorch/commit/8a9ec2fc6db41ef3f14874703b3941acd4bd0244#diff-93102682735f61ab7d6b87aa1465caa4R38

eval.py script runs for me now. However, I see near zero performance with the provided weights. @dvlshah did you try running the eval.py script? If yes, what results are you seeing?

sampathchanda avatar Jan 06 '20 07:01 sampathchanda