Пример #1
0
Lr = 1e-4
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
Пример #2
0
showiter = 20
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()
Пример #3
0
paramName = 'models/'+exp_prefix+'stereo_gan'
predModel = 'models/12-3-3_stereo_gan_100000.pkl'
dnetPreModel = 'models/12-3-3_stereo_gan_dnet_100000.pkl'
lamb = 1

stereonet = StereoNet()
stereonet.cuda()
loadPretrain(stereonet,predModel)

print '---'
dnet = DNet()
dnet.cuda()
loadPretrain(dnet,dnetPreModel)

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)


criterion1 = nn.SmoothL1Loss()
# stereoOptimizer = optim.Adam(stereonet.parameters(), lr = Lr)
stereoOptimizer = optim.Adam([{'params':stereonet.preLoadedParams,'lr': stereo_lr},
								{'params':stereonet.params}], lr = stereo_lr)

criterion2 = nn.BCELoss()
dnetOptimizer = optim.Adam(dnet.parameters(), lr = dnet_lr)