Load a pretrained DFNet model
(args, isFeatureNet=False)
| 91 | return pose_loss |
| 92 | |
| 93 | def load_exisiting_model(args, isFeatureNet=False): |
| 94 | ''' Load a pretrained DFNet model ''' |
| 95 | if isFeatureNet==False: # load the Pose Estimator F |
| 96 | if args.DFNet_s: |
| 97 | model = PoseNet3() |
| 98 | model.load_state_dict(torch.load(args.pretrain_model_path)) |
| 99 | else: |
| 100 | model = PoseNet() |
| 101 | model.load_state_dict(torch.load(args.pretrain_model_path)) |
| 102 | return model |
| 103 | else: |
| 104 | if args.DFNet_s: # load the Feature Extractor G |
| 105 | model = FeatureNet3() |
| 106 | model.load_state_dict(torch.load(args.pretrain_featurenet_path)) |
| 107 | else: |
| 108 | model=FeatureNet() |
| 109 | model.load_state_dict(torch.load(args.pretrain_featurenet_path)) |
| 110 | return model |
| 111 | |
| 112 | def prepare_batch_render(args, pose, batch_size, target_, H, W, focal, half_res=True, rand=True): |
| 113 | ''' Break batch of images into rays ''' |