keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1.01k stars 330 forks source link

rules for `pyramid_level_inputs`? #2413

Open innat opened 7 months ago

innat commented 7 months ago

Current Behavior:

While trying to get P1, P2, P3 from EfficientNet, I got

backbone = EfficientNetV1B0Backbone(input_shape=(512, 512, 3))
for k, v in backbone.pyramid_level_inputs.items():
    print(k, v, backbone.get_layer(name=v).output)

P1 block1a_project_activation <KerasTensor shape=(None, 256, 256, 16) >
P2 block2b_add <KerasTensor shape=(None, 128, 128, 24) >
P3 block3b_add <KerasTensor shape=(None, 64, 64, 40) >
P4 block5c_add  <KerasTensor shape=(None, 32, 32, 112) >
P5 top_activation  <KerasTensor shape=(None, 16, 16, 1280) >

Expected Behavior:

For P5, I think it should be from block7a_project_activation, before the top activation. This will give (None, 16, 16, 320) instead of (None, 16, 16, 1280) - which can be used in EfficientDet model.

Also, the P3, P4, no hard opinion, but wouldn't it be more better to pick tensor from project_activation layers?