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},
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 }], lr=Lr)