(self, path, mask_type)
return Image.fromarray(np.tile(mask,(1,1,3)).astype(np.uint8))
Read Masks now only support bbox
Read Masks now only support bbox
Read Masks now only support bbox
def read_mask(self, path, mask_type):
        """
        Read Masks now only support bbox
        """
        if mask_type == 'random_bbox':
            bboxs = []
            for i in range(self.random_bbox_number):
                bbox = InpaintDataset.random_bbox(self.resize_shape, self.random_bbox_margin, self.random_bbox_shape)
                bboxs.append(bbox)
        elif mask_type == 'random_free_form':
            mask = InpaintDataset.random_ff_mask(self.random_ff_setting)
            return Image.fromarray(np.tile(mask,(1,1,3)).astype(np.uint8))
        elif 'val' in mask_type:
            mask = InpaintDataset.read_val_mask(path)
            return Image.fromarray(np.tile(mask,(1,1,3)).astype(np.uint8))
        else:
            bbox = InpaintDataset.read_bbox(path)
            bboxs = [bbox]
        #print(bboxs, self.resize_shape)
        mask = InpaintDataset.bbox2mask(bboxs, self.resize_shape)
        #print('final', mask.shape)
        return Image.fromarray(np.tile(mask,(1,1,3)).astype(np.uint8))
def read_mask ( self , path , mask_type ) : if mask_type == 'random_bbox' : bboxs = [ ] for i in range ( self . random_bbox_number ) : bbox = InpaintDataset . random_bbox ( self . resize_shape , self . random_bbox_margin , self . random_bbox_shape ) bboxs . append ( bbox ) elif mask_type == 'random_free_form' : mask = InpaintDataset . random_ff_mask ( self . random_ff_setting ) return Image . fromarray ( np . tile ( mask , ( 1 , 1 , 3 ) ) . astype ( np . uint8 ) ) elif 'val' in mask_type : mask = InpaintDataset . read_val_mask ( path ) return Image . fromarray ( np . tile ( mask , ( 1 , 1 , 3 ) ) . astype ( np . uint8 ) ) else : bbox = InpaintDataset . read_bbox ( path ) bboxs = [ bbox ] #print(bboxs, self.resize_shape) mask = InpaintDataset . bbox2mask ( bboxs , self . resize_shape ) #print('final', mask.shape) return Image . fromarray ( np . tile ( mask , ( 1 , 1 , 3 ) ) . astype ( np . uint8 ) )