snapshot = 10000 paramName = 'models/'+exp_prefix+'stereo_2' predModel = 'models/9-3_stereo_2_100000.pkl' lossfilename = exp_prefix+'loss' SceneTurn = 5 ImgHeight = 320 ImgWidth = 640 stereonet = StereoNet() stereonet.cuda() loadPretrain(stereonet,predModel) normalize = Normalize(mean=[0.485, 0.456, 0.406],std=[0.229, 0.224, 0.225]) sceneDataset = SceneflowDataset(transform=Compose([ RandomCrop(size=(ImgHeight,ImgWidth)), RandomHSV((10,80,80)), ToTensor(), normalize])) kittiDataset = KittiDataset(transform=Compose([ RandomCrop(size=(ImgHeight,ImgWidth)), RandomHSV((7,50,50)), ToTensor(), normalize]), surfix='train') sceneDataloader = DataLoader(sceneDataset, batch_size=batch, shuffle=True, num_workers=4) kittiDataloader = DataLoader(kittiDataset, batch_size=batch, shuffle=True, num_workers=4) sceneiter = iter(sceneDataloader) kittiiter = iter(kittiDataloader) criterion = nn.SmoothL1Loss() # stereoOptimizer = optim.Adam(stereonet.parameters(), lr = Lr) stereoOptimizer = optim.Adam([{'params':stereonet.preLoadedParams,'lr':Lr},
loadPretrain(stereonet, predModel) print '---' dnet = DNet() dnet.cuda() loadPretrain(dnet, dnetPreModel) dnet2 = DNet2() dnet2.cuda() loadPretrain(dnet2, dnetPreModel) normalize = Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) sceneDataset = SceneflowDataset(filename='val.txt', transform=Compose([ RandomCrop(size=(320, 640)), RandomHSV((7, 37, 37)), ToTensor(), normalize ])) dataloader = DataLoader(sceneDataset, batch_size=batch, shuffle=True, num_workers=2) criterion1 = nn.SmoothL1Loss() criterion2 = nn.BCELoss() label = torch.FloatTensor(batch) real_label = 1 fake_label = 0 label = Variable(label)
batch = 1 trainstep = 100000 showiter = 20 snapshot = 10000 paramName = 'models/' + exp_prefix + 'stereo_2' predModel = 'models/9-2-2_stereo_2_50000.pkl' lossfilename = exp_prefix + 'loss' stereonet = StereoNet() stereonet.cuda() # loadPretrain(stereonet,predModel) normalize = Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) sceneDataset = SceneflowDataset(transform=Compose([ RandomCrop(size=(320, 640)), RandomHSV((7, 37, 37)), ToTensor(), normalize ])) dataloader = DataLoader(sceneDataset, batch_size=batch, shuffle=True, num_workers=8) criterion = nn.SmoothL1Loss() # stereoOptimizer = optim.Adam(stereonet.parameters(), lr = Lr) stereoOptimizer = optim.Adam([{ 'params': stereonet.preLoadedParams, 'lr': Lr }, { 'params': stereonet.params }],
# paramName = 'models/'+exp_prefix+'stereo_2' predModel = 'models/12-3-4_stereo_gan_80000.pkl' dataset = 'scene' stereonet = StereoNet() stereonet.cuda() loadPretrain(stereonet, predModel) normalize = Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) if dataset == 'scene': sceneDataset = SceneflowDataset(filename='val.txt', transform=Compose([ RandomCrop(size=(320, 640)), RandomHSV((0, 0, 0)), ToTensor(), normalize ])) else: sceneDataset = KittiDataset(transform=Compose([ RandomCrop(size=(320, 640)), RandomHSV((0, 0, 0)), ToTensor(), normalize ])) dataloader = DataLoader(sceneDataset, batch_size=1, shuffle=True, num_workers=8) # criterion = nn.SmoothL1Loss()