Skip to content
Snippets Groups Projects
Commit 6faa33d1 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Included option to validate model on training set

parent a0d12623
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ config = {
# (ttratio * tvratio) * 100 % will be used as for training
# (1 - ttratio * tvratio) * 100 % will be used for validation
# used if split_mode='random' and split_mode='scene'
'tvratio': 0.95,
'tvratio': 0.8,
# the date to split the scenes
# format: 'yyyymmdd'
......@@ -106,6 +106,7 @@ config = {
# the validation set, the test set is empty
# used if split_mode='date'
'date': 'yyyymmdd',
'dateformat': '%Y%m%d',
# define the batch size
# determines how many samples of the dataset are processed until the
......@@ -216,14 +217,14 @@ config = {
# whether to early stop training if the accuracy on the validation set
# does not increase more than delta over patience epochs
'early_stop': False,
'early_stop': True,
'mode': 'max',
'delta': 0,
'patience': 10,
# define the number of epochs: the number of maximum iterations over
# the whole training dataset
'epochs': 10,
'epochs': 200,
# define the number of threads
'nthreads': os.cpu_count(),
......@@ -244,9 +245,10 @@ config = {
# these options are only used for evaluating a trained model using
# main.eval.py
# whether to evaluate the model on the validation set or test set
# the dataset to evaluate the model on
# test=False means evaluating on the validation set
# test=True means evaluationg on the test set
# test=True means evaluating on the test set
# test=None means evaluating on the training set
'test': False,
# whether to compute and plot the confusion matrix
......@@ -261,13 +263,13 @@ config = {
# split_mode="date"
'predict_scene': True,
# whether to save plots of (input, ground truth, prediction) of the
# samples from the validation/test dataset to disk
# whether to save plots of (input, ground truth, prediction) of the samples
# from the validation/test dataset to disk, applies if predict_scene=False
# output path is: pysegcnn/main/_samples/
'plot_samples': False,
# whether to save plots of (input, ground truth, prediction) for each scene
# to disk
# in the validation/test dataset to disk, applies if predict_scene=True
# output path is: pysegcnn/main/_samples/
'plot_scenes': True,
......
......@@ -10,7 +10,7 @@ import os
# locals
from pysegcnn.core.trainer import NetworkTrainer
from pysegcnn.core.predict import predict_samples, predict_scenes
from pysegcnn.core.config import config, HERE
from pysegcnn.main.config import config, HERE
from pysegcnn.core.graphics import plot_confusion_matrix, plot_loss
......@@ -23,8 +23,12 @@ if __name__ == '__main__':
# plot loss and accuracy
plot_loss(trainer.loss_state, outpath=os.path.join(HERE, '_graphics/'))
# check whether to evaluate the model on the validation set or the test set
ds = trainer.test_ds if trainer.test else trainer.valid_ds
# check whether to evaluate the model on the training set, validation set
# or the test set
if trainer.test is None:
ds = trainer.train_ds
else:
ds = trainer.test_ds if trainer.test else trainer.valid_ds
# whether to predict each sample or each scene individually
if trainer.predict_scene:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment