Skip to content

Backward anomaly problem #5

Description

@ikourbane

Thank you very much for your work, I found an anomaly when I try to differentiate it and do the backward step, your Net has many in-place operations which makes it impossible to calculate the gradients. If anyone encounters the same problem replace the first few lines in the forward function to:

    def forward(self, img):

        blurred_img_r = self.gaussian_filter_vertical(self.gaussian_filter_horizontal(img[:, 0:1]))
        blurred_img_g = self.gaussian_filter_vertical(self.gaussian_filter_horizontal(img[:, 1:2]))
        blurred_img_b = self.gaussian_filter_vertical(self.gaussian_filter_horizontal(img[:, 2:3]))

        grad_x_r = self.sobel_filter_horizontal(blurred_img_r)
        grad_y_r = self.sobel_filter_vertical(blurred_img_r)
        grad_x_g = self.sobel_filter_horizontal(blurred_img_g)
        grad_y_g = self.sobel_filter_vertical(blurred_img_g)
        grad_x_b = self.sobel_filter_horizontal(blurred_img_b)
        grad_y_b = self.sobel_filter_vertical(blurred_img_b)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions