Skip to content

boxes format in calculation of huber_loss #58

Closed
@zlyin

Description

@zlyin

Hi @rwightman, I'm trying to implement a custom iou loss function. But I'd like to confirm with you about the boxes format consumed by huber_loss function. Could you help me verify the format of inputs & targets args?

def huber_loss(input, target, delta: float = 1., weights: Optional[torch.Tensor] = None, size_average: bool = True):
    """
    """
    err = input - target
    abs_err = err.abs()
    quadratic = torch.clamp(abs_err, max=delta)
    linear = abs_err - quadratic
    loss = 0.5 * quadratic.pow(2) + delta * linear
    if weights is not None:
        loss *= weights
    return loss.mean() if size_average else loss.sum()

I print both of them out and found they are in the shape of [batch, height_l, width_l, 9*4], the last dim of which I think coords for bounding boxes. In other threads, you mentioned that you implementation consumes targets in YXYX format, outputs pred boxes in XYWH format. Does such theory hold here as well?

Thank you for your confirmation!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions