def from_config_file(config_file): c = Config() config = configparser.ConfigParser() config.read(config_file) for k, v in config['mask_rcnn'].items(): setattr(c, k.upper(), literal_eval(v)) c.__init__() return c
def __init__(self, channel = 3): assert channel == 1 or channel == 3 or channel == 4, "The channel must be 1, 3 or 4! Given: {}".format(channel) self.IMAGE_CHANNEL_COUNT = channel if channel == 1 or channel == 3: return elif channel == 4: self.MEAN_PIXEL = np.append(self.MEAN_PIXEL, 10) #elif channel == 1: #self.MEAN_PIXEL = [np.sum(self.MEAN_PIXEL) / 3] Config.__init__(self)
def __init__(self, dataset_name, classnames): # Give the configuration a recognizable name self.dataset_name = dataset_name self.NAME = dataset_name self.CLASS_NAMES = classnames self.ALL_CLASS_NAMES = ['BG'] + self.CLASS_NAMES # Number of classes (including background) self.NUM_CLASSES = len(self.ALL_CLASS_NAMES) self.map_name_to_id = {} Config.__init__(self)
def load_network(self): config = Config() config.NAME = 'predict' config.NUM_CLASSES = 1 + 1 config.IMAGES_PER_GPU = 1 config.GPU_COUNT = 1 additional_info = json.load(open(self.config_path)) for i,j in additional_info.items(): try: setattr(config,i,eval(j)) except: setattr(config,i,j) config.__init__() from mrcnn import model as modellib self.model = modellib.MaskRCNN(mode="inference", model_dir='./',config=config)
def __init__(self, taxonomy): # Number of classes (including background) self.NUM_CLASSES = 1 + len(taxonomy) # Background + objects Config.__init__(self) # run __init__ from Config
def __init__(self,num_class): Config.__init__(self,num_class)
def __init__(self, class_names): self.NUM_CLASSES = len(class_names) Config.__init__(self)
def __init__(self, batch_size): Config.__init__(self) self.BATCH_SIZE = batch_size