Skip to content

add logging for semantic segmentation models #4956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions torchvision/models/segmentation/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from torch.nn import functional as F

from ..._internally_replaced_utils import load_state_dict_from_url
from ...utils import _log_api_usage_once


class _SimpleSegmentationModel(nn.Module):
__constants__ = ["aux_classifier"]

def __init__(self, backbone: nn.Module, classifier: nn.Module, aux_classifier: Optional[nn.Module] = None) -> None:
super().__init__()
_log_api_usage_once(self)
self.backbone = backbone
self.classifier = classifier
self.aux_classifier = aux_classifier
Expand Down
2 changes: 2 additions & 0 deletions torchvision/models/segmentation/lraspp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from torch import nn, Tensor
from torch.nn import functional as F

from ...utils import _log_api_usage_once
from .. import mobilenetv3
from ..feature_extraction import create_feature_extractor
from ._utils import _load_weights
Expand Down Expand Up @@ -37,6 +38,7 @@ def __init__(
self, backbone: nn.Module, low_channels: int, high_channels: int, num_classes: int, inter_channels: int = 128
) -> None:
super().__init__()
_log_api_usage_once(self)
self.backbone = backbone
self.classifier = LRASPPHead(low_channels, high_channels, num_classes, inter_channels)

Expand Down