cherubicXN / hawp

Holistically-Attracted Wireframe Parsing [TPAMI'23] & [CVPR' 20]
MIT License
298 stars 52 forks source link

Fix non square input bug in get_junctions #8

Closed alwc closed 4 years ago

alwc commented 4 years ago

y should be divided by width while x should be modded by width. For examples

    >>> mat = torch.arange(0, 12)
    tensor([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])

    >>> mat.reshape(4, -1)
    tensor([[ 0,  1,  2],
            [ 3,  4,  5],
            [ 6,  7,  8],
            [ 9, 10, 11]])

    >>> height, width = mat.shape

    >>> torch.arange(0, 12) / width  # for y-coordinate
    tensor([0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3])

    >>> torch.arange(0, 12) % width  # for x-coordinate
    tensor([0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2])