(self, polygons, size)
Arguments:
                a list of lists of numbers.
                The first level refers to all the polygons that compose the
                object, and the second level to the polygon coordinates.
Arguments:
                a list of lists of numbers.
                The first level refers to all the polygons that compose the
                object, and the second level to the polygon coordinates.
Arguments : a list of lists of numbers . The first level refers to all the polygons that compose the object and the second level to the polygon coordinates .
def __init__(self, polygons, size):
        """
            Arguments:
                a list of lists of numbers.
                The first level refers to all the polygons that compose the
                object, and the second level to the polygon coordinates.
        """
        if isinstance(polygons, (list, tuple)):
            valid_polygons = []
            for p in polygons:
                p = torch.as_tensor(p, dtype=torch.float32)
                if len(p) >= 6:  # 3 * 2 coordinates
                    valid_polygons.append(p)
            polygons = valid_polygons

        elif isinstance(polygons, PolygonInstance):
            polygons = copy.copy(polygons.polygons)
        else:
            RuntimeError(
                "Type of argument `polygons` is not allowed:%s" % (type(polygons))
            )

        """ This crashes the training way too many times...
        for p in polygons:
            assert p[::2].min() >= 0
            assert p[::2].max() < size[0]
            assert p[1::2].min() >= 0
            assert p[1::2].max() , size[1]
        """

        self.polygons = polygons
        self.size = tuple(size)
def __init__ ( self , polygons , size ) : if isinstance ( polygons , ( list , tuple ) ) : valid_polygons = [ ] for p in polygons : p = torch . as_tensor ( p , dtype = torch . float32 ) if len ( p ) >= 6 : # 3 * 2 coordinates valid_polygons . append ( p ) polygons = valid_polygons elif isinstance ( polygons , PolygonInstance ) : polygons = copy . copy ( polygons . polygons ) else : RuntimeError ( "Type of argument `polygons` is not allowed:%s" % ( type ( polygons ) ) ) """ This crashes the training way too many times...
        for p in polygons:
            assert p[::2].min() >= 0
            assert p[::2].max() < size[0]
            assert p[1::2].min() >= 0
            assert p[1::2].max() , size[1]
        """ self . polygons = polygons self . size = tuple ( size )