omegaiota / DiffCloth

Code repository for our paper DiffCloth: Differentiable Cloth Simulation with Dry Frictional Contact
https://people.csail.mit.edu/liyifei/publication/diffcloth/
MIT License
339 stars 31 forks source link

Tirangle_K optimisation #23

Open BBBBBbruce opened 9 months ago

BBBBBbruce commented 9 months ago

Hi, Thanks for releasing the amazing work

I ran the tshirt demo, which optimises the wind and CONSTRAINT_TRIANGLE. However, the output log shows that the k_CONSTRAINT_TRIANGLE is barely moving. The reference uses 550 and with my seed, the K stuck at 1018. If I turn off the wind, the optimisation is instantly finished because the solver hit the one-iteration condition. I tried to use different initialisation bound, and I got no luck. I also tried with initial guess very close to reference, which is noticeably different from the different k, even though the loss both dropped to 0.2.

What might be the cause of k not changing?

omegaiota commented 9 months ago

It’s a good idea to try initializing from a neighborhood close to ground truth and see if optimization can progress. Can you give me more details for your experiments? What was the target k and what were the initial values you tried? What were the initial and final loss? Have you tried different step size for the optimizer?

BBBBBbruce commented 9 months ago

Thanks for the reply, to further address my question:

My question is why wind force can be optimised while stiffness cannot.

To answer your questions:

  1. I tried with initial guesses with 1019, 553, 2609, 3148, and the ground truth is 550.
  2. The losses initially 13 and further drops below 0.2, but this is caused of the wind force, since the k is barely moving. If I turn off the wind optimisation, the loss would be originated around 0.5, which should be good.
  3. I didnt try different step size for the BFGS solver because it seems like you used the default settings(I didnt find any part of code trying to modify this), where the step is generated between 1e-20 and 1e20

Also, I am not sure if the target K should be the same as reference, since for a backward problem, there should exist multiple solutions. Especially for an energy decaying system.

What confuses me is that all of my attempts have a very similar behaviour -- all of them are not trying to converge. In another words, this is saying all of my attempts could be a solution, but that is not likely the reason, so my best guess is that stiffness is not effective in this experiment.

Therefore, I also tried with the dress demo with default settings. The initial loss is 3.6 and find loss is 2.7 which takes 27 iterations. However, this experiment is to optimise the bending stiffness, but the behaviour of K are similar. K density
Initial Guess 4.5456 0.96
Final Guess 4.547 0.6468
Ground truth 2 0.01

Furthermore, as I mentioned previously, when I turned off the wind, the optimisation process is terminated at first iteration due to the one-iteration condition of BFGS. I wonder whether this implies optimisation failure? Since BFGS couldnt find the next possible guess.