def experiment_4(): config = get_experiment_4_config() config.logger.start() loader = ImageDataLoader(config) trainer = HyperTrainer(config=config, loader=loader) trainer.start_tunning() config.logger.end()
def experiment_0(): config = get_experiment_0_config() config.logger.start() loader = ImageDataLoader(config) input_shape = config.input_shape logging.info(f"input_shape:{input_shape}") number_of_classes = len(loader.labbel_mapper.classes_name) logging.info(f"number_of_classes:{number_of_classes}") trainer = Trainer(config=config, loader=loader) trainer.start(model=get_mobilenet( hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes), run_id="mobilenet_model") trainer.start(model=get_cnn(hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes), run_id="cnn_model") trainer = HyperTrainer(config=config, loader=loader) trainer.start_tunning() config.logger.end()
def experiment_1(trainable: bool): if trainable: config = get_experiment_1_config( experiment_name='experiment_1_trainable_true') else: config = get_experiment_1_config( experiment_name='experiment_1_trainable_false') config.logger.start() loader = ImageDataLoader(config) input_shape = config.input_shape logging.info(f"input_shape:{input_shape}") number_of_classes = len(loader.labbel_mapper.classes_name) logging.info(f"number_of_classes:{number_of_classes}") trainer = Trainer(config=config, loader=loader) trainer.start(model=get_mobilenet( hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes, trainable=trainable), run_id="mobilenet_model") trainer.start(model=get_vgg16(hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes, trainable=trainable), run_id="vgg16_model") trainer.start(model=get_densenet121( hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes, trainable=trainable), run_id="densenet121_model") trainer.start(model=get_resnet50( hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes, trainable=trainable), run_id="resnet50_model") trainer.start(model=get_cnn(hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes), run_id="cnn_model") config.logger.end()
def experiment_3_evaluate(): config = get_experiment_3_config() config.logger.start() loader = ImageDataLoader(config) input_shape = config.input_shape logging.info(f"input_shape:{input_shape}") number_of_classes = len(loader.labbel_mapper.classes_name) logging.info(f"number_of_classes:{number_of_classes}") trainer = Trainer(config=config, loader=loader) trainer.evaluate(run_id='cnn_model', test_data=loader.test_data, steps=loader.test_data_info.count) config.logger.end()
def main(): config = get_experiment_1_config() logger = Logger(config) logger.start() loader = ImageDataLoader(config) input_shape = config.input_shape logging.info(f"input_shape:{input_shape}") number_of_classes = len(loader.labbel_mapper.labels) logging.info(f"number_of_classes:{number_of_classes}") trainer = Trainer(config=config, loader=loader, logger=logger) trainer.start(model=get_cnn(hidden_activation=config.hidden_activation, output_activation=config.output_activation, input_shape=input_shape, number_of_classes=number_of_classes)) logger.end()
def get_data_loader(self): return ImageDataLoader(self.config)