neptune-ai / open-solution-mapping-challenge

Open solution to the Mapping Challenge :earth_americas:
https://www.crowdai.org/challenges/mapping-challenge
MIT License
380 stars 96 forks source link

possibly inaccurate dice loss #133

Closed taraspiotr closed 6 years ago

taraspiotr commented 6 years ago

In current dice loss implementation if a class with highest number doesn't appear in target the dice loss won't run against this class because of target.max():

    for class_nr in range(1, int(target.max()) + 1):
        class_target = (target == class_nr)
        class_target.data = class_target.data.float()
        loss += dice(output[:, class_nr, :, :], class_target)
    return loss
taraspiotr commented 6 years ago

Fixed in #135