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

Loss confusion #2

Closed
jaideep11061982 opened this issue May 22, 2021 · 9 comments
Closed

Loss confusion #2

jaideep11061982 opened this issue May 22, 2021 · 9 comments

Comments

@jaideep11061982
Copy link

in SEDPosNegloss

could u help explain what is happening here.
Why do we assign zero mask in case of sec label >0

<!--StartFragment--> y_ones_mask = torch.ones_like(y_sec_true, requires_grad=False) y_zeros_mask = torch.ones_like(y_sec_true, requires_grad=False) *self.secondary_factor y_secondary_mask = torch.where(y_sec_true &gt; 0.0, y_zeros_mask, y_ones_mask)<!--EndFragment-->

@ryanwongsa
Copy link
Owner

The loss function that I used in the competition just turned out to be cross entropy. Since I tried different things none of them produced better results that it so you probably can just use the built in Pytorch CE loss.

@jaideep11061982
Copy link
Author

jaideep11061982 commented May 22, 2021

1)we have got secondary classes also so how u converted CE loss to work for this?

  1. what are shapes returned below

    bs, c, s = x.shape  
    mixup_lambda = self.mixup_augmenter.get_lambda(batch_size=bs*c, device=x.device)
    
     bs_al, s_al, c_al = all_labels.shape  
    all_labels = do_mixup(all_labels.reshape(bs_al*s_al,c_al), mixup_lambda).reshape((bs_al*s_al)//2,1,c_al)
    
  i know mixup will  mix in odd and even elements together

@ryanwongsa
Copy link
Owner

ryanwongsa commented May 22, 2021

1)we have got secondary classes also so how u converted CE loss to work for this?

It is a multi-label classification problem. So it is BCE loss for each of the outputs.

  1. what are shapes returned below ...

If you see the code audioset_tagging_cnn, it contained the original implementation. I just adapted it to my use case. It has been a while since I have looked at the code but if you debug through the code you can see the shapes.

@jaideep11061982
Copy link
Author

jaideep11061982 commented May 24, 2021 via email

@ryanwongsa
Copy link
Owner

Sorry, if you are talking about the BirdCLEF 2021 competition, I currently don't have the time to focus on a new competition.

@jaideep11061982
Copy link
Author

jaideep11061982 commented May 24, 2021 via email

@ryanwongsa
Copy link
Owner

I am not sure which kernel you are referring to as I didn't use 20 second clips. I used 30 second durations.

I suggest debugging through Arai's notebook to get a better understanding of how attention works with the SED network as once you understand that then you will understand how to use larger durations. Alternatively go through the original author's paper for more details.

@jaideep11061982
Copy link
Author

jaideep11061982 commented May 25, 2021 via email

@ryanwongsa
Copy link
Owner

Questions relating to current Kaggle competitions should be posted on Kaggle: https://www.kaggle.com/c/birdclef-2021/discussion?sort=recent-comments

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

2 participants