當前位置: 首頁>>代碼示例>>Python>>正文


Python layers.ConvTranspose2d方法代碼示例

本文整理匯總了Python中maskrcnn_benchmark.layers.ConvTranspose2d方法的典型用法代碼示例。如果您正苦於以下問題:Python layers.ConvTranspose2d方法的具體用法?Python layers.ConvTranspose2d怎麽用?Python layers.ConvTranspose2d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maskrcnn_benchmark.layers的用法示例。


在下文中一共展示了layers.ConvTranspose2d方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from maskrcnn_benchmark import layers [as 別名]
# 或者: from maskrcnn_benchmark.layers import ConvTranspose2d [as 別名]
def __init__(self, cfg, in_channels):
        super(KeypointRCNNPredictor, self).__init__()
        input_features = in_channels
        num_keypoints = cfg.MODEL.ROI_KEYPOINT_HEAD.NUM_CLASSES
        deconv_kernel = 4
        self.kps_score_lowres = layers.ConvTranspose2d(
            input_features,
            num_keypoints,
            deconv_kernel,
            stride=2,
            padding=deconv_kernel // 2 - 1,
        )
        nn.init.kaiming_normal_(
            self.kps_score_lowres.weight, mode="fan_out", nonlinearity="relu"
        )
        nn.init.constant_(self.kps_score_lowres.bias, 0)
        self.up_scale = 2
        self.out_channels = num_keypoints 
開發者ID:Res2Net,項目名稱:Res2Net-maskrcnn,代碼行數:20,代碼來源:roi_keypoint_predictors.py

示例2: __init__

# 需要導入模塊: from maskrcnn_benchmark import layers [as 別名]
# 或者: from maskrcnn_benchmark.layers import ConvTranspose2d [as 別名]
def __init__(self, cfg, in_channels):
        super(MaskRCNNC4Predictor, self).__init__()
        num_classes = cfg.MODEL.ROI_BOX_HEAD.NUM_CLASSES
        dim_reduced = cfg.MODEL.ROI_MASK_HEAD.CONV_LAYERS[-1]
        num_inputs = in_channels

        self.conv5_mask = ConvTranspose2d(num_inputs, dim_reduced, 2, 2, 0)
        self.mask_fcn_logits = Conv2d(dim_reduced, num_classes, 1, 1, 0)

        for name, param in self.named_parameters():
            if "bias" in name:
                nn.init.constant_(param, 0)
            elif "weight" in name:
                # Caffe2 implementation uses MSRAFill, which in fact
                # corresponds to kaiming_normal_ in PyTorch
                nn.init.kaiming_normal_(param, mode="fan_out", nonlinearity="relu") 
開發者ID:Res2Net,項目名稱:Res2Net-maskrcnn,代碼行數:18,代碼來源:roi_mask_predictors.py

示例3: __init__

# 需要導入模塊: from maskrcnn_benchmark import layers [as 別名]
# 或者: from maskrcnn_benchmark.layers import ConvTranspose2d [as 別名]
def __init__(self, cfg):
        super(MaskRCNNC4Predictor, self).__init__()
        num_classes = cfg.MODEL.ROI_BOX_HEAD.NUM_CLASSES
        dim_reduced = cfg.MODEL.ROI_MASK_HEAD.CONV_LAYERS[-1]

        if cfg.MODEL.ROI_HEADS.USE_FPN:
            num_inputs = dim_reduced
        else:
            stage_index = 4
            stage2_relative_factor = 2 ** (stage_index - 1)
            res2_out_channels = cfg.MODEL.RESNETS.RES2_OUT_CHANNELS
            num_inputs = res2_out_channels * stage2_relative_factor

        self.conv5_mask = ConvTranspose2d(num_inputs, dim_reduced, 2, 2, 0)
        self.mask_fcn_logits = Conv2d(dim_reduced, num_classes, 1, 1, 0)

        for name, param in self.named_parameters():
            if "bias" in name:
                nn.init.constant_(param, 0)
            elif "weight" in name:
                # Caffe2 implementation uses MSRAFill, which in fact
                # corresponds to kaiming_normal_ in PyTorch
                nn.init.kaiming_normal_(param, mode="fan_out", nonlinearity="relu") 
開發者ID:clw5180,項目名稱:remote_sensing_object_detection_2019,代碼行數:25,代碼來源:roi_mask_predictors.py

示例4: __init__

# 需要導入模塊: from maskrcnn_benchmark import layers [as 別名]
# 或者: from maskrcnn_benchmark.layers import ConvTranspose2d [as 別名]
def __init__(self, cfg):
        super(KeypointRCNNPredictor, self).__init__()
        input_features = cfg.MODEL.ROI_KEYPOINT_HEAD.CONV_LAYERS[-1]
        num_keypoints = cfg.MODEL.ROI_KEYPOINT_HEAD.NUM_CLASSES
        deconv_kernel = 4
        self.kps_score_lowres = layers.ConvTranspose2d(
            input_features,
            num_keypoints,
            deconv_kernel,
            stride=2,
            padding=deconv_kernel // 2 - 1,
        )
        nn.init.kaiming_normal_(
            self.kps_score_lowres.weight, mode="fan_out", nonlinearity="relu"
        )
        nn.init.constant_(self.kps_score_lowres.bias, 0)
        self.up_scale = 2 
開發者ID:mlperf,項目名稱:training,代碼行數:19,代碼來源:roi_keypoint_predictors.py

示例5: __init__

# 需要導入模塊: from maskrcnn_benchmark import layers [as 別名]
# 或者: from maskrcnn_benchmark.layers import ConvTranspose2d [as 別名]
def __init__(self, num_inputs=256, dim_reduced=256, num_conv=0, no_transform1=False, first_kernel=3,
                 no_relu=False, use_leaky_relu=False):
        super(DeConvUpSampler, self).__init__()
        self.first_kernel = first_kernel
        self.no_relu = no_relu
        self.use_leaky_relu = use_leaky_relu
        if no_transform1:
            self.transform1 = EmptyBlock()
        else:
            self.transform1 = self.build_transform(num_inputs, dim_reduced, dim_reduced, num_conv)
        self.deconv1 = ConvTranspose2d(dim_reduced, dim_reduced, 2, 2, 0)
        self.transform2 = self.build_transform(dim_reduced, dim_reduced, dim_reduced, num_conv)
        self.deconv2 = ConvTranspose2d(dim_reduced, num_inputs, 2, 2, 0)

        for modules in [self.transform1.modules(), self.transform2.modules(), [self.deconv1, self.deconv2]]:
            for l in modules:
                if isinstance(l, (nn.Conv2d, nn.ConvTranspose2d)):
                    nn.init.kaiming_normal_(l.weight, mode="fan_out", nonlinearity="relu")
                    nn.init.constant_(l.bias, 0) 
開發者ID:ucas-vg,項目名稱:TinyBenchmark,代碼行數:21,代碼來源:down_up_sampler.py


注:本文中的maskrcnn_benchmark.layers.ConvTranspose2d方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。