cvlab-stonybrook / DM-Count

Code for NeurIPS 2020 paper: Distribution Matching for Crowd Counting.
MIT License
218 stars 52 forks source link

Is OT loss only applicable while training is implemented on square images #17

Closed Xinxinatg closed 3 years ago

Xinxinatg commented 3 years ago

Hi I notice that in the process of training, the images will be cropped into images of square shape. Just wondering is it possible that the OT loss can be implemented on the rectangle images during training? Thanks for your time in advance!

Boyu-Wang commented 3 years ago

We didn't try it on rectangle images. In theory, the shape of the image doesn't affect the OT loss. OT loss should work for rectangle images. You are welcome to try it on rectangle images. You need to modify the distance computation. For square images, we normalize the x,y coordinates from [-1 to 1] and compute the distance. For rectangle images, since the height and width are no longer the same, you need to normalize the x,y coordinates accordingly.

Xinxinatg commented 3 years ago

Thanks a lot for your reply! Just another quick question, are other losses like tv_loss can be calculated on rectangle images as well?

Boyu-Wang commented 3 years ago

Yes. TV_loss will work for rectangle images as well. TV_loss is just L1 loss on normalized density maps.