Python nn.BilinearInterpolation2d() Examples
The following are 16
code examples of nn.BilinearInterpolation2d().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
nn
, or try the search function
.
Example #1
Source File: keypoint_rcnn_heads.py From Detectron.pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #2
Source File: mask_rcnn_heads.py From Detectron.pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #3
Source File: keypoint_rcnn_heads.py From FPN-Pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #4
Source File: mask_rcnn_heads.py From FPN-Pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #5
Source File: keypoint_rcnn_heads.py From Detectron.pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #6
Source File: mask_rcnn_heads.py From Detectron.pytorch with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #7
Source File: keypoint_rcnn_heads.py From Context-aware-ZSR with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #8
Source File: mask_rcnn_heads.py From Context-aware-ZSR with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #9
Source File: keypoint_rcnn_heads.py From PANet with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #10
Source File: mask_rcnn_heads.py From PANet with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #11
Source File: keypoint_rcnn_heads.py From PMFNet with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #12
Source File: mask_rcnn_heads.py From PMFNet with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #13
Source File: keypoint_rcnn_heads.py From detectron-self-train with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #14
Source File: mask_rcnn_heads.py From detectron-self-train with MIT License | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()
Example #15
Source File: keypoint_rcnn_heads.py From DIoU-pytorch-detectron with GNU General Public License v3.0 | 5 votes |
def __init__(self, dim_in): super().__init__() self.upsample_heatmap = (cfg.KRCNN.UP_SCALE > 1) if cfg.KRCNN.USE_DECONV: # Apply ConvTranspose to the feature representation; results in 2x # upsampling self.deconv = nn.ConvTranspose2d( dim_in, cfg.KRCNN.DECONV_DIM, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2) - 1) dim_in = cfg.KRCNN.DECONV_DIM if cfg.KRCNN.USE_DECONV_OUTPUT: # Use ConvTranspose to predict heatmaps; results in 2x upsampling self.classify = nn.ConvTranspose2d( dim_in, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.DECONV_KERNEL, 2, padding=int(cfg.KRCNN.DECONV_KERNEL / 2 - 1)) else: # Use Conv to predict heatmaps; does no upsampling self.classify = nn.Conv2d(dim_in, cfg.KRCNN.NUM_KEYPOINTS, 1, 1, padding=0) if self.upsample_heatmap: # self.upsample = nn.UpsamplingBilinear2d(scale_factor=cfg.KRCNN.UP_SCALE) self.upsample = mynn.BilinearInterpolation2d( cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.NUM_KEYPOINTS, cfg.KRCNN.UP_SCALE) self._init_weights()
Example #16
Source File: mask_rcnn_heads.py From DIoU-pytorch-detectron with GNU General Public License v3.0 | 5 votes |
def __init__(self, dim_in): super().__init__() self.dim_in = dim_in n_classes = cfg.MODEL.NUM_CLASSES if cfg.MRCNN.CLS_SPECIFIC_MASK else 1 if cfg.MRCNN.USE_FC_OUTPUT: # Predict masks with a fully connected layer self.classify = nn.Linear(dim_in, n_classes * cfg.MRCNN.RESOLUTION**2) else: # Predict mask using Conv self.classify = nn.Conv2d(dim_in, n_classes, 1, 1, 0) if cfg.MRCNN.UPSAMPLE_RATIO > 1: self.upsample = mynn.BilinearInterpolation2d( n_classes, n_classes, cfg.MRCNN.UPSAMPLE_RATIO) self._init_weights()