Finding coordinates of room corners from layout contours

I am trying to find room corner coordinates based on contours which I obtained from a room layout estimation network such as this one: GitHub - liamw96/pytorch.room.layout: room layout estimation pytorch project

An example of how my contours look like:

I am thinking if some heuristics based logic can be used. My main goal is to overlay a floor texture with right perspective using homography transform as next step but for that would need a set of good coordinates using these contours.

One initial idea I have is to start traversing contours and keep track of change in slope of line and if it exceeds a threshold consider it as corner. But it seems quite brute force and most wouldn’t generalise.

Any ideas or suggestions highly appreciated. Thanks!

facing same issue can you help me if you got any solution?