Skip to content

[BUG] feature_info.channels() is not match #2370

Open
@brianhou0208

Description

@brianhou0208

Describe the bug
These models return feature_info.channels() is not match

  • ecaresnet50d_pruned
  • ecaresnet101d_pruned
  • efficientnet_b1_pruned
  • efficientnet_b2_pruned
  • efficientnet_b3_pruned

To Reproduce

import timm
import torch

model_list = [
    ["ecaresnet50d_pruned", 224],
    ["ecaresnet101d_pruned", 224],
    ["efficientnet_b1_pruned", 224],
    ["efficientnet_b2_pruned", 224],
    ["efficientnet_b3_pruned", 224]
]

if __name__ == "__main__":
    for model_name, img_size in model_list:
        x = torch.rand(1, 3, 224, 224)
        model = timm.create_model(f"{model_name}", features_only=True).eval()
        y = model(x)
        print(model_name)
        print(f"    Feature shape: {[f.detach().numpy().shape[1:] for f in y]}")
        print(f"    Feature channels: {model.feature_info.channels()}")
        print()
ecaresnet50d_pruned
    Feature shape: [(64, 112, 112), (19, 56, 56), (171, 28, 28), (818, 14, 14), (2022, 7, 7)]
    Feature channels: [64, 256, 512, 1024, 2048]

ecaresnet101d_pruned
    Feature shape: [(64, 112, 112), (26, 56, 56), (142, 28, 28), (278, 14, 14), (2042, 7, 7)]
    Feature channels: [64, 256, 512, 1024, 2048]

efficientnet_b1_pruned
    Feature shape: [(16, 112, 112), (12, 56, 56), (35, 28, 28), (67, 14, 14), (320, 7, 7)]
    Feature channels: [16, 24, 40, 112, 320]

efficientnet_b2_pruned
    Feature shape: [(16, 112, 112), (17, 56, 56), (42, 28, 28), (116, 14, 14), (352, 7, 7)]
    Feature channels: [16, 24, 48, 120, 352]

efficientnet_b3_pruned
    Feature shape: [(24, 112, 112), (12, 56, 56), (40, 28, 28), (120, 14, 14), (384, 7, 7)]
    Feature channels: [24, 32, 48, 136, 384]

Expected behavior

  • ecaresnet50d_pruned feature channels (64, 19, 171, 818, 2022)
  • ecaresnet101d_pruned feature channels (64, 26, 142, 278, 2042)
  • efficientnet_b1_pruned feature channels (16, 12, 35, 67, 320)
  • efficientnet_b2_pruned feature channels (16, 17, 42, 116, 352)
  • efficientnet_b3_pruned feature channels (24, 12, 40, 120, 384)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions