tusen-ai / RangeDet

Paper and Codes for “RangeDet: In Defense of Range View for LiDAR-based 3D Object Detection” (ICCV2021)
Apache License 2.0
188 stars 16 forks source link

Question about cls loss #22

Closed ged0606 closed 2 years ago

ged0606 commented 2 years ago

Hi, thanks for you great work.

I implement RangeDet in pytorch, but when i train pedestrian category, the cls loss seems too small, cls loss is two order of magnitude small to reg loss. Does it correct?

Varifocal loss is used as presented in the papar.

@weighted_loss
def varifocal_loss(pred,
                   target,
                   alpha=1.0,
                   gamma=2.0):
    # pred and target should be of the same size
    assert pred.size() == target.size()

    bce = F.relu(pred) - pred * target
    bce = bce + torch.log(1.0 + torch.exp(-1.0 * pred.abs()))

    positive_mask = (target > 0.0)
    loss_positive = bce * target * positive_mask
    negative_mask = (target <= 0.0)
    pred_score = pred.sigmoid()
    loss_negative = bce * alpha * pred_score.pow(gamma) * negative_mask

    loss = loss_positive + loss_negative

    return loss

Looking forward to your reply!

ldkong1205 commented 2 years ago

Hi @ged0606 , would you like to kindly share your PyTorch code for RangeDet so we can work on this together? I am also interested in this work and want to extend it to semantic segmentation. Thank you very much!

ged0606 commented 2 years ago

Hi @ged0606 , would you like to kindly share your PyTorch code for RangeDet so we can work on this together? I am also interested in this work and want to extend it to semantic segmentation. Thank you very much!

The pytorch code is belong to my company, sorry that I can't share out.

Abyssaledge commented 2 years ago

I believe it's correct. BTW, you can adopt the Varialfocal Loss in mmdetection, which is equivalent to our implementation and verified effective myself.

ldkong1205 commented 2 years ago

Hi @ged0606 , would you like to kindly share your PyTorch code for RangeDet so we can work on this together? I am also interested in this work and want to extend it to semantic segmentation. Thank you very much!

The pytorch code is belong to my company, sorry that I can't share out.

Understood 👍

ged0606 commented 2 years ago

Thanks, I will try it :)