(backbone, features, use_pretrained, groups=1, expand=False, exportable=True, hooks=None,
use_vit_only=False, use_readout="ignore", in_features=[96, 256, 512, 1024])
| 34 | ) |
| 35 | |
| 36 | def _make_encoder(backbone, features, use_pretrained, groups=1, expand=False, exportable=True, hooks=None, |
| 37 | use_vit_only=False, use_readout="ignore", in_features=[96, 256, 512, 1024]): |
| 38 | if backbone == "beitl16_512": |
| 39 | pretrained = _make_pretrained_beitl16_512( |
| 40 | use_pretrained, hooks=hooks, use_readout=use_readout |
| 41 | ) |
| 42 | scratch = _make_scratch( |
| 43 | [256, 512, 1024, 1024], features, groups=groups, expand=expand |
| 44 | ) # BEiT_512-L (backbone) |
| 45 | elif backbone == "beitl16_384": |
| 46 | pretrained = _make_pretrained_beitl16_384( |
| 47 | use_pretrained, hooks=hooks, use_readout=use_readout |
| 48 | ) |
| 49 | scratch = _make_scratch( |
| 50 | [256, 512, 1024, 1024], features, groups=groups, expand=expand |
| 51 | ) # BEiT_384-L (backbone) |
| 52 | elif backbone == "beitb16_384": |
| 53 | pretrained = _make_pretrained_beitb16_384( |
| 54 | use_pretrained, hooks=hooks, use_readout=use_readout |
| 55 | ) |
| 56 | scratch = _make_scratch( |
| 57 | [96, 192, 384, 768], features, groups=groups, expand=expand |
| 58 | ) # BEiT_384-B (backbone) |
| 59 | elif backbone == "swin2l24_384": |
| 60 | pretrained = _make_pretrained_swin2l24_384( |
| 61 | use_pretrained, hooks=hooks |
| 62 | ) |
| 63 | scratch = _make_scratch( |
| 64 | [192, 384, 768, 1536], features, groups=groups, expand=expand |
| 65 | ) # Swin2-L/12to24 (backbone) |
| 66 | elif backbone == "swin2b24_384": |
| 67 | pretrained = _make_pretrained_swin2b24_384( |
| 68 | use_pretrained, hooks=hooks |
| 69 | ) |
| 70 | scratch = _make_scratch( |
| 71 | [128, 256, 512, 1024], features, groups=groups, expand=expand |
| 72 | ) # Swin2-B/12to24 (backbone) |
| 73 | elif backbone == "swin2t16_256": |
| 74 | pretrained = _make_pretrained_swin2t16_256( |
| 75 | use_pretrained, hooks=hooks |
| 76 | ) |
| 77 | scratch = _make_scratch( |
| 78 | [96, 192, 384, 768], features, groups=groups, expand=expand |
| 79 | ) # Swin2-T/16 (backbone) |
| 80 | elif backbone == "swinl12_384": |
| 81 | pretrained = _make_pretrained_swinl12_384( |
| 82 | use_pretrained, hooks=hooks |
| 83 | ) |
| 84 | scratch = _make_scratch( |
| 85 | [192, 384, 768, 1536], features, groups=groups, expand=expand |
| 86 | ) # Swin-L/12 (backbone) |
| 87 | elif backbone == "next_vit_large_6m": |
| 88 | pretrained = _make_pretrained_next_vit_large_6m(hooks=hooks) |
| 89 | scratch = _make_scratch( |
| 90 | in_features, features, groups=groups, expand=expand |
| 91 | ) # Next-ViT-L on ImageNet-1K-6M (backbone) |
| 92 | elif backbone == "levit_384": |
| 93 | pretrained = _make_pretrained_levit_384( |
no test coverage detected