def remove_out_of_image(self, fully=True, partly=False):
polys_clean = [<EOL>poly for poly in self.polygons<EOL>if not poly.is_out_of_image(self.shape, fully=fully, partly=partly)<EOL>]<EOL>return PolygonsOnImage(polys_clean, shape=self.shape)<EOL>
Remove all polygons that are fully or partially outside of the image.

Parameters
----------
fully : bool, optional
    Whether to remove polygons that are fully outside of the image.

partly : bool, optional
    Whether to remove polygons that are partially outside of the image.

Returns
-------
imgaug.PolygonsOnImage
    Reduced set of polygons, with those that were fully/partially
    outside of the image removed.