Thanks for sharing your code. I tried on a different dataset but it didn't work (please see the second sample in my pull request ). Any idea? Is there a specific preprocessing step one should do?
The aligned shape looks strange compared to the original:
Original

Result
