def train( self, data_augmentation, num_epochs=5, epoch_length=32, learning_rate=1e-5, num_rois=32, use_gpu=False, ): """Fit deep learning model.""" # Initialize paths when creating the results folder base_path = self.__generate_results_path("training") annotate_path = base_path + "/annotate.txt" weights_output_path = base_path + "/flowchart_3b_model.hdf5" config_output_filename = base_path + "/config.pickle" # Create folder training folder os.mkdir(base_path) # Instance Trainer trainer = Trainer(base_path, use_gpu) # Recover data from dataset trainer.recover_data(self.dataset_path, annotate_path, generate_annotate=True) # Configure trainer trainer.configure( data_augmentation, self.num_rois, weights_output_path, self.weights_input_path, num_epochs=num_epochs, epoch_length=epoch_length, learning_rate=learning_rate, ) trainer.save_config(config_output_filename) trainer.train()