(self, instances, size, mode="poly")
Arguments:
            instances: two types
                (1) polygon
                (2) binary mask
            size: (width, height)
            mode: 'poly', 'mask'. if mode is 'mask', convert mask of any format to binary mask
Arguments:
            instances: two types
                (1) polygon
                (2) binary mask
            size: (width, height)
            mode: 'poly', 'mask'. if mode is 'mask', convert mask of any format to binary mask
Arguments : instances : two types ( 1 ) polygon ( 2 ) binary mask size : ( width height ) mode : poly mask . if mode is mask convert mask of any format to binary mask
def __init__(self, instances, size, mode="poly"):
        """
        Arguments:
            instances: two types
                (1) polygon
                (2) binary mask
            size: (width, height)
            mode: 'poly', 'mask'. if mode is 'mask', convert mask of any format to binary mask
        """

        assert isinstance(size, (list, tuple))
        assert len(size) == 2
        if isinstance(size[0], torch.Tensor):
            assert isinstance(size[1], torch.Tensor)
            size = size[0].item(), size[1].item()

        assert isinstance(size[0], (int, float))
        assert isinstance(size[1], (int, float))

        if mode == "poly":
            self.instances = PolygonList(instances, size)
        elif mode == "mask":
            self.instances = BinaryMaskList(instances, size)
        else:
            raise NotImplementedError("Unknown mode: %s" % str(mode))

        self.mode = mode
        self.size = tuple(size)
def __init__ ( self , instances , size , mode = "poly" ) : assert isinstance ( size , ( list , tuple ) ) assert len ( size ) == 2 if isinstance ( size [ 0 ] , torch . Tensor ) : assert isinstance ( size [ 1 ] , torch . Tensor ) size = size [ 0 ] . item ( ) , size [ 1 ] . item ( ) assert isinstance ( size [ 0 ] , ( int , float ) ) assert isinstance ( size [ 1 ] , ( int , float ) ) if mode == "poly" : self . instances = PolygonList ( instances , size ) elif mode == "mask" : self . instances = BinaryMaskList ( instances , size ) else : raise NotImplementedError ( "Unknown mode: %s" % str ( mode ) ) self . mode = mode self . size = tuple ( size )