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

train with update code on synthData #94

Open
backtime92 opened this issue Nov 25, 2021 · 2 comments
Open

train with update code on synthData #94

backtime92 opened this issue Nov 25, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@backtime92
Copy link
Owner

backtime92 commented Nov 25, 2021

loss1 = loss_fn(region_scores_pre, region_scores_label)

loss2 = loss_fn(affinity_scores_pre, affinity_socres_label)

Due to the frequent interruption of the company github connection, it is not convenient to update the readme.
Now synthData can be trained according to the updated repo. If the GPUs is enough, you can compare the effects of torch.sqrt(loss1+1e-8) and torch.sqrt(loss2+1e-8). The pixel value of the background is probably How many

@backtime92 backtime92 added the documentation Improvements or additions to documentation label Nov 25, 2021
@woans0104
Copy link

woans0104 commented Dec 9, 2021

Can I modify it like the code below? The end of the comment is cut off, so it is difficult to understand the meaning.

   def forward(self, region_scores_label, affinity_socres_label, region_scores_pre, affinity_scores_pre, mask):
    loss_fn = torch.nn.MSELoss(reduce=False, size_average=False)
    assert region_scores_label.size() == region_scores_pre.size() and affinity_socres_label.size() == affinity_scores_pre.size()
    loss1 = loss_fn(region_scores_pre, region_scores_label)
    loss2 = loss_fn(affinity_scores_pre, affinity_socres_label)

    loss1 = torch.sqrt(loss1 + 1e-8)
    loss2 = torch.sqrt(loss2 + 1e-8)

    loss_region = torch.mul(loss1, mask)
    loss_affinity = torch.mul(loss2, mask)

    char_loss = self.single_image_loss(loss_region, region_scores_label)
    affi_loss = self.single_image_loss(loss_affinity, affinity_socres_label)
    return char_loss + affi_loss

@yangyang-nus-lv
Copy link

Hi, may I ask why you calculate the sqrt here

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

No branches or pull requests

3 participants