Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code #86

Open
YIXIN-M opened this issue May 8, 2024 · 0 comments
Open

Code #86

YIXIN-M opened this issue May 8, 2024 · 0 comments

Comments

@YIXIN-M
Copy link

YIXIN-M commented May 8, 2024

"""
def l1_loss_weight(network_output, gt):
image = gt.detach().cpu().numpy().transpose((1, 2, 0))
rgb_raw_gray = np.dot(image[..., :3], [0.2989, 0.5870, 0.1140])
sobelx = cv2.Sobel(rgb_raw_gray, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(rgb_raw_gray, cv2.CV_64F, 0, 1, ksize=5)
sobel_merge = np.sqrt(sobelx * sobelx + sobely * sobely) + 1e-10
sobel_merge = np.exp(sobel_merge)
sobel_merge /= np.max(sobel_merge)
sobel_merge = torch.from_numpy(sobel_merge)[None, ...].to(gt.device)

return torch.abs((network_output - gt) * sobel_merge).mean()

def l2_loss(network_output, gt):
return ((network_output - gt) ** 2).mean()
"""
Have these two functions( l1_loss_weight and l2_loss)not been called in the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant