def __init__(self, exterior, label=None):
<EOL>from imgaug.augmentables.kps import Keypoint<EOL>if isinstance(exterior, list):<EOL><INDENT>if not exterior:<EOL><INDENT>self.exterior = np.zeros((<NUM_LIT:0>, <NUM_LIT:2>), dtype=np.float32)<EOL><DEDENT>elif isinstance(exterior[<NUM_LIT:0>], Keypoint):<EOL><INDENT>self.exterior = np.float32([[point.x, point.y] for point in exterior])<EOL><DEDENT>else:<EOL><INDENT>self.exterior = np.float32([[point[<NUM_LIT:0>], point[<NUM_LIT:1>]] for point in exterior])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ia.do_assert(ia.is_np_array(exterior),<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (exterior,))<EOL>ia.do_assert(exterior.ndim == <NUM_LIT:2> and exterior.shape[<NUM_LIT:1>] == <NUM_LIT:2>,<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (<EOL>exterior.shape,))<EOL>self.exterior = np.float32(exterior)<EOL><DEDENT>if len(self.exterior) >= <NUM_LIT:2> and np.allclose(self.exterior[<NUM_LIT:0>, :], self.exterior[-<NUM_LIT:1>, :]):<EOL><INDENT>self.exterior = self.exterior[:-<NUM_LIT:1>]<EOL><DEDENT>self.label = label<EOL>
Create a new Polygon instance.