'=====================================================================' ) ### resume latest model and solver multi_model_res, multi_model_haze, multi_model_s2, optimizer = utils.load_model( multi_model_res, multi_model_haze, multi_model_s2, optimizer, opts, epoch_st) else: ### save epoch 0 utils.save_model(multi_model_res, multi_model_haze, multi_model_s2, optimizer, opts) print(multi_model_res) num_params = utils.count_network_parameters( multi_model_res) + utils.count_network_parameters( multi_model_s2) + utils.count_network_parameters(multi_model_haze) print( '\n=====================================================================' ) print("===> Model has %d parameters" % num_params) print( '=====================================================================' ) ### initialize loss writer loss_dir = os.path.join(opts.model_dir, 'loss') loss_writer = SummaryWriter(loss_dir) ### convert to GPU
print('=====================================================================') print('===> Resuming model from epoch %d' %epoch_st) print('=====================================================================') ### resume latest model and solver model, optimizer = utils.load_model(model, optimizer, opts, epoch_st) else: ### save epoch 0 utils.save_model(model, optimizer, opts) print(model) num_params = utils.count_network_parameters(model) print('\n=====================================================================') print("===> Model has %d parameters" %num_params) print('=====================================================================') ### initialize loss writer loss_dir = os.path.join(opts.model_dir, 'loss') loss_writer = SummaryWriter(loss_dir) ### Load pretrained FlowNet2 opts.rgb_max = 1.0 opts.fp16 = False
epoch_st = epoch_list[-1] if epoch_st > 0: print( '=====================================================================' ) print('===> Resuming model from epoch %d' % epoch_st) print( '=====================================================================' ) three_dim_model, fusion_model, FlowNet, optimizer = utils.load_model( three_dim_model, fusion_model, FlowNet, optimizer, opts, epoch_st) print(three_dim_model) num_params = utils.count_network_parameters(three_dim_model) print( '\n=====================================================================' ) print("===> Model has %d parameters" % num_params) print( '=====================================================================' ) loss_dir = os.path.join(opts.model_dir, 'loss') loss_writer = SummaryWriter(loss_dir) VGG = networks.Vgg16(requires_grad=False) device = torch.device("cuda" if opts.cuda else "cpu")