cvlab-stonybrook / DM-Count

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

excellent work #21

Open purse1996 opened 3 years ago

purse1996 commented 3 years ago

I think the idea is very novel and the result is very good. I want to follow your work and use Optimal Transport in another task. But a problem occurs in the training. When training, the ot_obj_values is always negative(loss is -412.95532348025495), and the wd is relatively small (eg. 5.207008814930322), which is quite different from DM-count.

Could it be the reason for the regularization parameter of reg? Could you give me some suggestions?

Best wishes! Thank you very much.

harryliew commented 3 years ago

@purse1996 Thanks for your interest!

ot_obj_values correspond to the second term in the dual form of OT, Eq. (4) in our paper. It's possible that ot_obj_values are negative, and we cannot tell how training goes based solely on ot_obj_values. Instead, wd is the Wasserstein distance, and the smaller the better. As long as wd is small, you don't need to care about ot_obj_values.

It's worth noting that the scale of wd and ot_obj_values are related to the image size and whether the coordinates are normalized or not. If the coordinates are not normalized, then wd and ot_obj_values could be large. In this case, you can use a large reg, such as 10. If they are normalized, then wd and ot_obj_vlaues should be relatively small, and accordingly, you should use a small reg, such as 0.1.

Hope this helps!

purse1996 commented 3 years ago

Thank you for your advice. Very help. I will try your suggestions and do experiments.

purse1996 commented 3 years ago

Thank you for your advice. I do some experiments and meet another problem. In my experiment, the smaller the reg parameter, the better the result, such as 0.01 of reg with unnormalized coordinates. I think the reason is that I want to generate sharper OT matrices. https://pythonot.github.io/_modules/ot/bregman.html#sinkhorn. But when reg is small, the wd is very small (e-15) and even equal to zero. But if I increase the reg, the result gets worse. So I'm very confused. Could you give me some suggestions? Thank you very much!