|
|
@ -179,13 +179,13 @@ def _filter_fn(state_dict):
|
|
|
|
|
|
|
|
|
|
|
|
def _create_vgg(variant: str, pretrained: bool, **kwargs: Any) -> VGG:
|
|
|
|
def _create_vgg(variant: str, pretrained: bool, **kwargs: Any) -> VGG:
|
|
|
|
cfg = variant.split('_')[0]
|
|
|
|
cfg = variant.split('_')[0]
|
|
|
|
# NOTE: VGG is one of the only models with stride==1 features, so indices are offset from other models
|
|
|
|
# NOTE: VGG is one of few models with stride==1 features w/ 6 out_indices [0..5]
|
|
|
|
out_indices = kwargs.get('out_indices', (0, 1, 2, 3, 4, 5))
|
|
|
|
kwargs.setdefault('out_indices', (0, 1, 2, 3, 4, 5))
|
|
|
|
model = build_model_with_cfg(
|
|
|
|
model = build_model_with_cfg(
|
|
|
|
VGG, variant, pretrained,
|
|
|
|
VGG, variant, pretrained,
|
|
|
|
default_cfg=default_cfgs[variant],
|
|
|
|
default_cfg=default_cfgs[variant],
|
|
|
|
model_cfg=cfgs[cfg],
|
|
|
|
model_cfg=cfgs[cfg],
|
|
|
|
feature_cfg=dict(flatten_sequential=True, out_indices=out_indices),
|
|
|
|
feature_cfg=dict(flatten_sequential=True),
|
|
|
|
pretrained_filter_fn=_filter_fn,
|
|
|
|
pretrained_filter_fn=_filter_fn,
|
|
|
|
**kwargs)
|
|
|
|
**kwargs)
|
|
|
|
return model
|
|
|
|
return model
|
|
|
|