def __init__(self, batchNorm=True, lastRelu=False, resBlock=True, maxdisp=-1, input_channel=3): super(FADNet, self).__init__() self.input_channel = input_channel self.batchNorm = batchNorm self.lastRelu = lastRelu self.maxdisp = maxdisp self.resBlock = resBlock # First Block (DispNetC) self.dispnetc = DispNetC(self.batchNorm, maxdisp=self.maxdisp, input_channel=input_channel) # warp layer and channelnorm layer self.channelnorm = ChannelNorm() self.resample1 = Resample2d() # Second Block (DispNetRes), input is 11 channels(img0, img1, img1->img0, flow, diff-mag) in_planes = 3 * 3 + 1 + 1 self.dispnetres = DispNetRes(in_planes, self.batchNorm, lastRelu=self.lastRelu, maxdisp=self.maxdisp, input_channel=input_channel) self.relu = nn.ReLU(inplace=False)
def __init__(self, batchNorm=False, lastRelu=True, resBlock=True, maxdisp=-1, input_channel=3): super(DispNetCS, self).__init__() self.input_channel = input_channel self.batchNorm = batchNorm self.resBlock = resBlock self.lastRelu = lastRelu self.maxdisp = maxdisp # First Block (DispNetC) self.dispnetc = DispNetC(batchNorm=self.batchNorm, resBlock=self.resBlock, maxdisp=self.maxdisp, input_channel=input_channel) # Second and third Block (DispNetS), input is 6+3+1+1=11 self.dispnets1 = DispNetS(11, batchNorm=self.batchNorm, resBlock=self.resBlock, maxdisp=self.maxdisp, input_channel=3) # warp layer and channelnorm layer self.channelnorm = ChannelNorm() self.resample1 = Resample2d() self.relu = nn.ReLU(inplace=False)
def __init__(self, batchNorm=False, lastRelu=True, input_channel=3, maxdisp=-1): super(DToNNet, self).__init__() self.input_channel = input_channel self.batchNorm = batchNorm self.lastRelu = lastRelu self.maxdisp = maxdisp #self.dn_transformer = Disp2Norm(16, 768, 384, {"fx":1050, "fy":1050}) # First Block (DispNetC) self.dispnetc = DispNetC(batchNorm = self.batchNorm, input_channel=input_channel) # Second and third Block (DispNetS), input is 6+3+1+1=11 self.normnets = NormNetS(input_channel=3+3+3+1) self.fx = None self.fy = None
def __init__(self, batchNorm=False, lastRelu=True, input_channel=3, maxdisp=-1): super(DNFusionNet, self).__init__() self.input_channel = input_channel self.batchNorm = batchNorm self.lastRelu = lastRelu self.maxdisp = maxdisp # First Block (DispNetC) self.dispnetc = DispNetC(self.batchNorm, input_channel=input_channel, get_features=True) # Second and third Block (DispNetS), input is 6+3+1+1=11 self.normnetdf = NormNetDF(input_channel=3 + 3 + 1) self.fx = None self.fy = None
from dataloader import KITTI_submission_loader2012 as DA test_left_img, test_right_img = DA.dataloader(args.datapath) devices = [int(item) for item in args.devices.split(',')] ngpus = len(devices) if args.model == 'stackhourglass': model = stackhourglass(args.maxdisp) elif args.model == 'basic': model = basic(args.maxdisp) elif args.model == 'dispnetcres': model = DispNetCSRes(ngpus, False, True) elif args.model == 'dispnetc': model = DispNetC(ngpus, False, True) else: print('no model') model = nn.DataParallel(model, device_ids=devices) model.cuda() if args.loadmodel is not None: state_dict = torch.load(args.loadmodel) model.load_state_dict(state_dict['state_dict']) print('Number of model parameters: {}'.format(sum([p.data.nelement() for p in model.parameters()]))) def test(imgL,imgR, imgsize): model.eval() #imgL = imgL.unsqueeze(0)