qianlim / POP

Official implementation of the ICCV 2021 paper: "The Power of Points for Modeling Humans in Clothing".
https://qianlim.github.io/POP
Other
185 stars 20 forks source link

UV Coordinate #18

Closed caiyongqi closed 2 years ago

caiyongqi commented 2 years ago

https://github.com/qianlim/POP/blob/c7e045e6a701de9581ffd7cfab67475f4eb979f0/lib/utils_io.py#L35 Hi, I found that the above code seems to generate transposed UV coordinates, i.e. the UV coordinates of the first row of the image ([height, width, channel] format) grid are [0, 0], [0, 1], [0, 2], ..., [ 0, H-1].

qianlim commented 2 years ago

The current version is actually correct. This can be verified by indexing the uv positional map with the generated uv coords and visualize it.

caiyongqi commented 2 years ago
posmap_size = 5
uv_coord_map = getIdxMap_torch(torch.rand(3, posmap_size, posmap_size))
print(uv_coord_map.reshape(5, 5, 2)[0])

Result: UV coordinates for the first row of the image grid:

tensor([[0.0000, 0.0000],
        [0.0000, 0.2500],
        [0.0000, 0.5000],
        [0.0000, 0.7500],
        [0.0000, 1.0000]])

Correct UV grid: image

The code below seems to fix the problem, the UV coordinates are then used for grid_sample (line 88, network.py), but the input to the shape deocder does not use this corrected UV coordinates: https://github.com/qianlim/POP/blob/c7e045e6a701de9581ffd7cfab67475f4eb979f0/lib/utils_model.py#L202

qianlim commented 2 years ago

Seems you are right! Did you check if the performance changes after fixing this?

caiyongqi commented 2 years ago

Seems you are right! Did you check if the performance changes after fixing this?

There shouldn't be a drop in performance, as is correct in grid_sample. Thank you!