Skip to content

Commit

Permalink
Fixed monitornig criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
simonreise committed Aug 19, 2023
1 parent b5f2a9a commit e1a251e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/remote_sensing_processor/segmentation/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

# this warning usually appears on sanity check if a loaded tile is empty
warnings.filterwarnings("ignore", message="No positive samples in targets")
warnings.filterwarnings("ignore", message="exists and is not empty")
warnings.filterwarnings("ignore", message="could not find the monitored key in the returned metrics")
warnings.filterwarnings("ignore", message="Skipping val loop")

def segmentation_train(x_train, x_val, y_train, y_val, model, backbone, checkpoint, weights, model_file, epochs, batch_size, classification, num_classes, x_nodata, y_nodata, less_metrics, lr, multiprocessing):
#checking if x and y have same number of datasets
Expand Down Expand Up @@ -81,7 +84,7 @@ def segmentation_train(x_train, x_val, y_train, y_val, model, backbone, checkpoi
#training
checkpoint_callback = l.pytorch.callbacks.ModelCheckpoint(
save_top_k=1,
monitor="val_loss",
monitor="val_loss" if x_val != [None] and y_val != [None] else "train_loss",
mode="min",
dirpath=os.path.dirname(model_file),
filename=os.path.basename(os.path.splitext(model_file)[0]),
Expand Down

0 comments on commit e1a251e

Please sign in to comment.