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

The details of calculating losses #23

Open
LiuYuZzz opened this issue Jun 24, 2020 · 2 comments
Open

The details of calculating losses #23

LiuYuZzz opened this issue Jun 24, 2020 · 2 comments

Comments

@LiuYuZzz
Copy link

LiuYuZzz commented Jun 24, 2020

For multi-obj, the input frame size is [batch_size, color channels, H, W], and the input objects mask size is [batch_size, num_objects + BG, H, W], and the questions are:

  1. When the STM module inputs the data whose batch size is greater than 1, it failed, so our work is based on batch_size =1;
  2. The network-output logit's size is [batch_size, num_objects + BG, H, W], then resize it to [batch_size*H*W, num_objects + BG], and input the new size tensor into the CrossEntropyLoss, is it right?
  3. Same as above, I calcutated loss after got the mulit-objct logit at every frame, didn't use softmax, because CrossEntropyLoss does softmax internally, , and then sum up losses from a sample of frames, and backward.
@seoungwugoh
Copy link
Owner

Hi @LiuYuZzz

  1. In our current implementation, it only works for 1 sample-per-GPU. We used batch size 4 with 4-GPU machine.
  2. You do not need to resize them just use torch.CrossEntropyLoss function (see the documentation for usage, they take indices for GT).
  3. Looks like you did it right.

For training, you do not need to make any changes inside our model. What you need to do is computing losses using training data and backward them.

@LiuYuZzz
Copy link
Author

Hi @LiuYuZzz

  1. In our current implementation, it only works for 1 sample-per-GPU. We used batch size 4 with 4-GPU machine.
  2. You do not need to resize them just use torch.CrossEntropyLoss function (see the documentation for usage, they take indices for GT).
  3. Looks like you did it right.

For training, you do not need to make any changes inside our model. What you need to do is computing losses using training data and backward them.

thanks for your reply,I got it

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