application_vnd.jupyter.stderr_output_1.png
"""
counter = 1
for backbone in BACKBONES:
    for loss in losses:
        for freeze_boolean, freeze_tag in zip([True,False], ['frozen','nonFrozen']):
            for pretrained_state, pretrained_tag in zip(['imagenet',None], ['pretrained','nonPretrained']):
                model.tag = backbone + '_' + loss.name + '_' + freeze_tag + '_' + pretrained_tag + '_' + str(counter)
                print("*******************************  ", model.tag)
                preprocess_input = sm.get_preprocessing(backbone) # Applies the proper preprocessing for the chosen backbone
                model = sm.Unet(backbone, classes=NUM_CLASSES, activation=ACTIVATION, encoder_freeze=freeze_boolean, encoder_weights=pretrained_state) # Variar entre true y false, imagenet y none
                model.compile(optim, loss, metrics)
                # Defining callbacks for learning rate scheduling and best checkpoints saving
                checkpoint_filename = './best_' + backbone + '_' + loss.name + '_' + freeze_tag + '_' + pretrained_tag + '.h5'
                callbacks = [
                    tf.keras.callbacks.ModelCheckpoint(checkpoint_filename, save_weights_only=True, save_best_only=True, mode='min'),
                    tf.keras.callbacks.ReduceLROnPlateau()
                ]
                # TRAINING
                history = model.fit(
                    train_yarn_dataloader, 
                    validation_data=valid_yarn_dataloader, 
                    epochs=EPOCHS,  
                    callbacks=callbacks,
                )
                # SAVING THE MODEL
                df_history = pd.DataFrame(history.history)
                df_history.to_csv(model.tag + '.csv')
                model.save(model.tag + '.h5')
                counter += 1
"""