Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Make old backbones deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanwharris committed Jun 7, 2021
1 parent e62fc9b commit ff04f4d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed issue with `KorniaParallelTransforms` to assure to share the random state between transforms ([#351](https://github.com/PyTorchLightning/lightning-flash/pull/351))
- Change resize interpolation default mode to nearest ([#352](https://github.com/PyTorchLightning/lightning-flash/pull/352))

### Deprecated

- Deprecated `SemanticSegmentation` backbone names `torchvision/fcn_resnet50` and `torchvision/fcn_resnet101`, use `fc_resnet50` and `fcn_resnet101` instead ([#370](https://github.com/PyTorchLightning/lightning-flash/pull/370))


## [0.3.0] - 2021-05-20

Expand Down
25 changes: 25 additions & 0 deletions flash/image/segmentation/backbones.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from functools import partial

import torch.nn as nn
from deprecate import deprecated
from pytorch_lightning.utilities import _BOLTS_AVAILABLE, rank_zero_warn

from flash.core.registry import FlashRegistry
Expand Down Expand Up @@ -57,6 +58,30 @@ def _fn_fcn_deeplabv3(model_name: str, num_classes: int, pretrained: bool = True
type=_type
)

SEMANTIC_SEGMENTATION_BACKBONES(
fn=deprecated(
target=None,
stream=partial(warnings.warn, category=UserWarning),
deprecated_in="0.3.1",
remove_in="0.4.0",
template_mgs="The 'torchvision/fcn_resnet50' backbone has been deprecated since v%(deprecated_in)s in "
"favor of 'fcn_resnet50'. It will be removed in v%(remove_in)s.",
)(SEMANTIC_SEGMENTATION_BACKBONES.get("fcn_resnet50")),
name="torchvision/fcn_resnet50",
)

SEMANTIC_SEGMENTATION_BACKBONES(
fn=deprecated(
target=None,
stream=partial(warnings.warn, category=UserWarning),
deprecated_in="0.3.1",
remove_in="0.4.0",
template_mgs="The 'torchvision/fcn_resnet101' backbone has been deprecated since v%(deprecated_in)s in "
"favor of 'fcn_resnet101'. It will be removed in v%(remove_in)s.",
)(SEMANTIC_SEGMENTATION_BACKBONES.get("fcn_resnet101")),
name="torchvision/fcn_resnet101",
)

def _fn_lraspp(model_name: str, num_classes: int, pretrained: bool = True, **kwargs) -> nn.Module:
model: nn.Module = getattr(segmentation, model_name, None)(pretrained, **kwargs)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
torch>=1.7
torchmetrics
pytorch-lightning>=1.3.1
pyDeprecate
PyYAML>=5.1
numpy
pandas
Expand Down

0 comments on commit ff04f4d

Please sign in to comment.