Ref: https://github.com/charlesq34/frustum-pointnets/blob/master/models/model_util.py x = error = pred - gt or dist(pred,gt) 0.5 * |x|^2 if |x|<=d 0.5 * d^2 + d * (|x|-d) if |x|>d
(error, delta=1.0)
| 23 | |
| 24 | |
| 25 | def huber_loss(error, delta=1.0): |
| 26 | """ |
| 27 | Ref: https://github.com/charlesq34/frustum-pointnets/blob/master/models/model_util.py |
| 28 | x = error = pred - gt or dist(pred,gt) |
| 29 | 0.5 * |x|^2 if |x|<=d |
| 30 | 0.5 * d^2 + d * (|x|-d) if |x|>d |
| 31 | """ |
| 32 | abs_error = torch.abs(error) |
| 33 | quadratic = torch.clamp(abs_error, max=delta) |
| 34 | linear = abs_error - quadratic |
| 35 | loss = 0.5 * quadratic ** 2 + delta * linear |
| 36 | return loss |
| 37 | |
| 38 | |
| 39 | # From https://github.com/facebookresearch/detr/blob/master/util/misc.py |
nothing calls this directly
no outgoing calls
no test coverage detected