You are completely right, but unfortunate the link will not help me as it is talking about boxes, I think it is easy to generate mask from the coordinates if they will shape a box
But my case the coordinates will create an arbitrary shape for example a star shape so this approach which is prposed in this link will not help me, I need to use something like cv2.fillpoly but in pytorch to keep tracing gradient.