This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from torch import nn | |
| from torchvision.models import resnet, mobilenet, efficientnet | |
| from torchvision.models.feature_extraction import create_feature_extractor | |
| class _Extractor(nn.Module): | |
| def __init__(self, backbone, node_names): | |
| super().__init__() | |
| self.feat_extractor = create_feature_extractor(backbone, node_names) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from torch import nn | |
| class SeparableConv2d(nn.Sequential): | |
| def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, norm_layer=None, activation=None): | |
| super().__init__() | |
| if norm_layer is None: | |
| norm_layer = nn.BatchNorm2d | |
| if activation is None: | |
| activation = nn.ReLU6 |
NewerOlder