diff --git a/undeepvo/criterion/disparity_consistency_loss.py b/undeepvo/criterion/disparity_consistency_loss.py index 3bcbca9..32761f3 100644 --- a/undeepvo/criterion/disparity_consistency_loss.py +++ b/undeepvo/criterion/disparity_consistency_loss.py @@ -22,12 +22,12 @@ def get_disparities(self, left_depth_map, right_depth_map): return left_disparity, right_disparity def generate_disparity_maps(self, left_disparity, right_disparity, left_current_depth, right_current_depth): - generated_right_disparity = kornia.warp_frame_depth(image_src=left_disparity, + generated_right_disparity = kornia.geometry.depth.warp_frame_depth(image_src=left_disparity, depth_dst=right_current_depth, src_trans_dst=self.transform_from_left_to_right, camera_matrix=self.left_camera_matrix) - generated_left_disparity = kornia.warp_frame_depth(image_src=right_disparity, + generated_left_disparity = kornia.geometry.depth.warp_frame_depth(image_src=right_disparity, depth_dst=left_current_depth, src_trans_dst=torch.inverse( self.transform_from_left_to_right), diff --git a/undeepvo/criterion/registration_loss.py b/undeepvo/criterion/registration_loss.py index 636b632..d83fdfd 100644 --- a/undeepvo/criterion/registration_loss.py +++ b/undeepvo/criterion/registration_loss.py @@ -13,14 +13,14 @@ def __init__(self, registration_lambda, camera_matrix): self.camera_matrix = camera_matrix def generate_next_image(self, current_image, next_depth, transformation_from_next_to_current): - generated_next_image = kornia.warp_frame_depth(current_image, + generated_next_image = kornia.geometry.depth.warp_frame_depth(current_image, next_depth, transformation_from_next_to_current, self.camera_matrix) return generated_next_image def generate_current_image(self, next_image, current_depth, transformation_from_current_to_next): - generated_current_image = kornia.warp_frame_depth(next_image, + generated_current_image = kornia.geometry.depth.warp_frame_depth(next_image, current_depth, transformation_from_current_to_next, self.camera_matrix) diff --git a/undeepvo/criterion/spatial_photometric_consistency_loss.py b/undeepvo/criterion/spatial_photometric_consistency_loss.py index a7611e5..4412455 100644 --- a/undeepvo/criterion/spatial_photometric_consistency_loss.py +++ b/undeepvo/criterion/spatial_photometric_consistency_loss.py @@ -16,16 +16,16 @@ def __init__(self, lambda_s, left_camera_matrix, right_camera_matrix, transform_ self.transform_from_left_to_right = transform_from_left_to_right self.l1_loss = torch.nn.L1Loss() - self.SSIM_loss = kornia.losses.SSIM(window_size=self.window_size, reduction=self.reduction, + self.SSIM_loss = kornia.losses.SSIMLoss(window_size=self.window_size, reduction=self.reduction, max_val=self.max_val) def forward(self, left_current_img, right_current_img, left_current_depth, right_current_depth): - generated_right_img = kornia.warp_frame_depth(image_src=left_current_img, + generated_right_img = kornia.geometry.depth.warp_frame_depth(image_src=left_current_img, depth_dst=right_current_depth, src_trans_dst=torch.inverse(self.transform_from_left_to_right), camera_matrix=self.left_camera_matrix) - generated_left_img = kornia.warp_frame_depth(image_src=right_current_img, + generated_left_img = kornia.geometry.depth.warp_frame_depth(image_src=right_current_img, depth_dst=left_current_depth, src_trans_dst=self.transform_from_left_to_right, camera_matrix=self.right_camera_matrix) diff --git a/undeepvo/criterion/temporal_photometric_consistency_loss.py b/undeepvo/criterion/temporal_photometric_consistency_loss.py index 09bc350..e2d462c 100644 --- a/undeepvo/criterion/temporal_photometric_consistency_loss.py +++ b/undeepvo/criterion/temporal_photometric_consistency_loss.py @@ -11,7 +11,7 @@ def __init__(self, camera_matrix, right_camera_matrix, super().__init__() self.camera_matrix = camera_matrix self.lambda_s = lambda_s - self.ssim_loss = kornia.losses.SSIM(window_size=window_size, reduction=reduction, max_val=max_val) + self.ssim_loss = kornia.losses.SSIMLoss(window_size=window_size, reduction=reduction, max_val=max_val) self.l1_loss = torch.nn.L1Loss() def calculate_loss(self, image1, image2): @@ -19,14 +19,14 @@ def calculate_loss(self, image1, image2): return loss def generate_next_image(self, current_image, next_depth, transformation_from_next_to_current): - generated_next_image = kornia.warp_frame_depth(current_image, + generated_next_image = kornia.geometry.depth.warp_frame_depth(current_image, next_depth, transformation_from_next_to_current, self.camera_matrix) return generated_next_image def generate_current_image(self, next_image, current_depth, transformation_from_current_to_next): - generated_current_image = kornia.warp_frame_depth(next_image, + generated_current_image = kornia.geometry.depth.warp_frame_depth(next_image, current_depth, transformation_from_current_to_next, self.camera_matrix) diff --git a/undeepvo/problems/unsupervised_depth_problem.py b/undeepvo/problems/unsupervised_depth_problem.py index f144017..135ccb1 100644 --- a/undeepvo/problems/unsupervised_depth_problem.py +++ b/undeepvo/problems/unsupervised_depth_problem.py @@ -123,11 +123,11 @@ def _get_synthesized_image(self): right_current_image = data_point["right_current_image"][None].to(self._device) cameras_calibration = self._dataset_manager.get_cameras_calibration(device=self._device) with torch.no_grad(): - generated_left_image = kornia.warp_frame_depth(right_current_image, + generated_left_image = kornia.geometry.depth.warp_frame_depth(right_current_image, left_current_depth, cameras_calibration.transform_from_left_to_right, cameras_calibration.left_camera_matrix) - generated_right_image = kornia.warp_frame_depth(left_current_image, + generated_right_image = kornia.geometry.depth.warp_frame_depth(left_current_image, right_current_depth, torch.inverse( cameras_calibration.transform_from_left_to_right),