sxhxliang / detectron2_backbone

detectron2 backbone: resnet18, efficientnet, hrnet, mobilenet v2, resnest, bifpn
212 stars 41 forks source link

efficientnet with FPN can not be run #13

Open lucasjinreal opened 3 years ago

lucasjinreal commented 3 years ago

efficient output shape are:

EEE:  0 torch.Size([4, 16, 512, 400])
EEE:  1 torch.Size([4, 24, 256, 200])
EEE:  2 torch.Size([4, 80, 64, 50])
EEE:  3 torch.Size([4, 112, 64, 50])

this is impossible to run on FPN......

lucasjinreal commented 3 years ago
detectron2/detectron2/modeling/backbone/fpn.py", line 142, in forward
    prev_features = lateral_features + top_down_features
RuntimeError: The size of tensor a (50) must match the size of tensor b (100) at non-singleton dimension 3

with config:


  BACKBONE:
    NAME: "build_efficientnet_fpn_backbone"
  EFFICIENTNET:
    NAME: "efficientnet_b1"
    # OUT_FEATURES: ["stride8", "stride16", "stride32"] # fpn produce 4 levels, only using 3 for now
    OUT_FEATURES: ["stride4", "stride8", "stride16", "stride32"]
  FPN:
    # IN_FEATURES: ["stride8", "stride16", "stride32"]
    IN_FEATURES: ["stride4", "stride8", "stride16", "stride32"]
    OUT_CHANNELS: 64
    REPEAT: 3
channingmonk commented 3 years ago
detectron2/detectron2/modeling/backbone/fpn.py", line 142, in forward
    prev_features = lateral_features + top_down_features
RuntimeError: The size of tensor a (50) must match the size of tensor b (100) at non-singleton dimension 3

with config:

  BACKBONE:
    NAME: "build_efficientnet_fpn_backbone"
  EFFICIENTNET:
    NAME: "efficientnet_b1"
    # OUT_FEATURES: ["stride8", "stride16", "stride32"] # fpn produce 4 levels, only using 3 for now
    OUT_FEATURES: ["stride4", "stride8", "stride16", "stride32"]
  FPN:
    # IN_FEATURES: ["stride8", "stride16", "stride32"]
    IN_FEATURES: ["stride4", "stride8", "stride16", "stride32"]
    OUT_CHANNELS: 64
    REPEAT: 3

Hi @jinfagang, Have you solved the issue? I'm facing the same problem. Thanks!

JanGlinko commented 2 years ago

Same here. Any solutions?

zhuzhu512 commented 2 years ago

我也遇到了,请问解决了吗?