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

Nan when using cl.ContextualBilateralLoss(use_vgg=False, loss_type='cosine').cuda() #14

Open
laulampaul opened this issue May 30, 2022 · 0 comments

Comments

@laulampaul
Copy link

When I use the codes :

def calculate_cobiloss(img,gt):
    bb = img.shape[0]
    loss = 0.
    cobiloss = cl.ContextualBilateralLoss(use_vgg=False, loss_type='cosine').cuda()
    for i in range(bb):
        imgpatches = sample_patches(img[i],10,5)
        gtpatches = sample_patches(gt[i],10,5)
        c, patch_size, patch_size, n_patches = imgpatches.shape
        imgpatches = imgpatches.reshape(1,c*patch_size*patch_size,n_patches,1)
        gtpatches = gtpatches.reshape(1,c*patch_size*patch_size,n_patches,1)
        #pdb.set_trace()
        loss = loss +  cobiloss(imgpatches,gtpatches)
    return loss/bb

After some iterations, I face the NAN problem, how can I debug ??
Thanks.

@laulampaul laulampaul changed the title Face Nan when using cl.ContextualBilateralLoss(use_vgg=False, loss_type='cosine').cuda() Nan when using cl.ContextualBilateralLoss(use_vgg=False, loss_type='cosine').cuda() Jun 1, 2022
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