示例#1
0
文件: model.py 项目: etheleon/DSB2018
    def __init__(self, cfg, in_channels, out_channels):
        super(CropRoi, self).__init__()
        self.num_scales = len(cfg.rpn_scales)
        self.scales = cfg.rpn_scales
        self.crop_size = cfg.crop_size

        self.convs = nn.ModuleList()
        for l in range(self.num_scales):
            if self.scales[l] == 1:
                self.convs.append(
                    nn.Sequential(
                        nn.Conv2d(in_channels,
                                  out_channels // self.num_scales,
                                  kernel_size=3,
                                  padding=1), ))
            else:
                self.convs.append(
                    nn.Sequential(
                        nn.Conv2d(in_channels,
                                  out_channels // self.num_scales,
                                  kernel_size=3,
                                  padding=1),
                        nn.Upsample(scale_factor=self.scales[l],
                                    mode='bilinear'),
                    ))

        self.crop = Crop(self.crop_size, self.crop_size, 1)
示例#2
0
    def __init__(self, cfg, crop_size):
        super(CropRoi_1layer, self).__init__()
        self.num_scales = len(cfg.rpn_scales)
        self.crop_size = crop_size
        self.sizes = cfg.rpn_base_sizes
        self.scales = cfg.rpn_scales

        self.crops = Crop(self.crop_size, self.crop_size, 1 / self.scales[0])
示例#3
0
文件: model.py 项目: etheleon/DSB2018
    def __init__(self, cfg):
        super(CropRoi, self).__init__()
        self.num_heads = cfg.rpn_num_heads
        self.pool_size = cfg.pool_size
        self.size_thresholds = cfg.rcnn_select_size_thresholds

        self.crops = nn.ModuleList()
        for i in range(cfg.rpn_num_heads):
            self.crops.append(
                Crop(cfg.pool_size, cfg.pool_size, 1 / cfg.rpn_strides[i]))
示例#4
0
    def __init__(self, cfg, crop_size):
        super(CropRoi, self).__init__()
        self.num_scales = len(cfg.rpn_scales)
        self.crop_size = crop_size
        self.sizes = cfg.rpn_base_sizes
        self.scales = cfg.rpn_scales

        self.crops = nn.ModuleList()
        for l in range(self.num_scales):
            self.crops.append(Crop(self.crop_size, self.crop_size, 1 / self.scales[l]))
示例#5
0
    def __init__(self, cfg, crop_size):
        super(CropRoi, self).__init__()
        self.num_scales = len(cfg.rpn_scales)
        self.crop_size = crop_size
        self.sizes = cfg.rpn_base_sizes
        self.sizes = torch.from_numpy(np.array(self.sizes, np.float32))
        self.sizes = self.sizes.cuda() if USE_CUDA else self.sizes
        self.scales = cfg.rpn_scales

        self.crops = nn.ModuleList()
        for l in range(self.num_scales):
            self.crops.append(
                Crop(self.crop_size, self.crop_size, 1 / self.scales[l])
            )