CRAFT-Reimplementation icon indicating copy to clipboard operation
CRAFT-Reimplementation copied to clipboard

train with update code on synthData

Open backtime92 opened this issue 4 years ago • 2 comments

https://github.com/backtime92/CRAFT-Reimplementation/blob/fbaa63aebd61c2b290752102cdef4758891b1fb7/loss/mseloss.py#L43 https://github.com/backtime92/CRAFT-Reimplementation/blob/fbaa63aebd61c2b290752102cdef4758891b1fb7/loss/mseloss.py#L44

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 avatar Nov 25 '21 12:11 backtime92

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

woans0104 avatar Dec 09 '21 04:12 woans0104

Hi, may I ask why you calculate the sqrt here

yayagege avatar Dec 22 '21 07:12 yayagege