From 2b743f2f9046a2e2930647d234dc7392d71efa66 Mon Sep 17 00:00:00 2001 From: aktersnurra Date: Sun, 20 Sep 2020 01:15:23 +0200 Subject: Fixed some bash scripts. --- src/tasks/train_crnn_line_ctc_model.sh | 3 +- src/tasks/train_embedding_model.sh | 4 +++ .../CharacterModel_EmnistDataset_LeNet_weights.pt | Bin 14485362 -> 0 bytes .../CharacterModel_EmnistDataset_MLP_weights.pt | Bin 17938163 -> 0 bytes ...EmnistDataset_ResidualNetworkEncoder_weights.pt | Bin 26090486 -> 0 bytes ...rModel_EmnistDataset_ResidualNetwork_weights.pt | Bin 32765213 -> 2129629 bytes ...aracterModel_EmnistDataset_SpinalVGG_weights.pt | Bin 44089479 -> 0 bytes .../weights/CharacterModel_Emnist_LeNet_weights.pt | Bin 14485342 -> 0 bytes .../weights/CharacterModel_Emnist_MLP_weights.pt | Bin 1704096 -> 0 bytes ...IamLinesDataset_LineRecurrentNetwork_weights.pt | Bin 20694308 -> 5701134 bytes src/training/experiments/line_ctc_experiment.yml | 36 ++++++++++----------- src/training/run_experiment.py | 2 +- 12 files changed, 25 insertions(+), 20 deletions(-) mode change 100644 => 100755 src/tasks/train_crnn_line_ctc_model.sh create mode 100755 src/tasks/train_embedding_model.sh delete mode 100644 src/text_recognizer/weights/CharacterModel_EmnistDataset_LeNet_weights.pt delete mode 100644 src/text_recognizer/weights/CharacterModel_EmnistDataset_MLP_weights.pt delete mode 100644 src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetworkEncoder_weights.pt delete mode 100644 src/text_recognizer/weights/CharacterModel_EmnistDataset_SpinalVGG_weights.pt delete mode 100644 src/text_recognizer/weights/CharacterModel_Emnist_LeNet_weights.pt delete mode 100644 src/text_recognizer/weights/CharacterModel_Emnist_MLP_weights.pt diff --git a/src/tasks/train_crnn_line_ctc_model.sh b/src/tasks/train_crnn_line_ctc_model.sh old mode 100644 new mode 100755 index 9831289..0f83668 --- a/src/tasks/train_crnn_line_ctc_model.sh +++ b/src/tasks/train_crnn_line_ctc_model.sh @@ -1,3 +1,4 @@ #!/bin/bash experiments_filename=${1:-training/experiments/line_ctc_experiment.yml} -exec ./prepare_experiments.sh experiments_filename=experiments_filename +OUTPUT=$(./tasks/prepare_experiments.sh $experiments_filename) +eval $OUTPUT diff --git a/src/tasks/train_embedding_model.sh b/src/tasks/train_embedding_model.sh new file mode 100755 index 0000000..85a4a6d --- /dev/null +++ b/src/tasks/train_embedding_model.sh @@ -0,0 +1,4 @@ +#!/bin/bash +experiments_filename=${1:-training/experiments/embedding_encoder.yml} +OUTPUT=$(./tasks/prepare_experiments.sh $experiments_filename) +eval $OUTPUT diff --git a/src/text_recognizer/weights/CharacterModel_EmnistDataset_LeNet_weights.pt b/src/text_recognizer/weights/CharacterModel_EmnistDataset_LeNet_weights.pt deleted file mode 100644 index 676eb44..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_EmnistDataset_LeNet_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/CharacterModel_EmnistDataset_MLP_weights.pt b/src/text_recognizer/weights/CharacterModel_EmnistDataset_MLP_weights.pt deleted file mode 100644 index 32c83cc..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_EmnistDataset_MLP_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetworkEncoder_weights.pt b/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetworkEncoder_weights.pt deleted file mode 100644 index 9f9deee..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetworkEncoder_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetwork_weights.pt b/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetwork_weights.pt index 0dc7eb5..f2a9a08 100644 Binary files a/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetwork_weights.pt and b/src/text_recognizer/weights/CharacterModel_EmnistDataset_ResidualNetwork_weights.pt differ diff --git a/src/text_recognizer/weights/CharacterModel_EmnistDataset_SpinalVGG_weights.pt b/src/text_recognizer/weights/CharacterModel_EmnistDataset_SpinalVGG_weights.pt deleted file mode 100644 index e720299..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_EmnistDataset_SpinalVGG_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/CharacterModel_Emnist_LeNet_weights.pt b/src/text_recognizer/weights/CharacterModel_Emnist_LeNet_weights.pt deleted file mode 100644 index ed73c09..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_Emnist_LeNet_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/CharacterModel_Emnist_MLP_weights.pt b/src/text_recognizer/weights/CharacterModel_Emnist_MLP_weights.pt deleted file mode 100644 index 4ec12c1..0000000 Binary files a/src/text_recognizer/weights/CharacterModel_Emnist_MLP_weights.pt and /dev/null differ diff --git a/src/text_recognizer/weights/LineCTCModel_IamLinesDataset_LineRecurrentNetwork_weights.pt b/src/text_recognizer/weights/LineCTCModel_IamLinesDataset_LineRecurrentNetwork_weights.pt index 93d34d7..c001528 100644 Binary files a/src/text_recognizer/weights/LineCTCModel_IamLinesDataset_LineRecurrentNetwork_weights.pt and b/src/text_recognizer/weights/LineCTCModel_IamLinesDataset_LineRecurrentNetwork_weights.pt differ diff --git a/src/training/experiments/line_ctc_experiment.yml b/src/training/experiments/line_ctc_experiment.yml index 432d1cc..337c830 100644 --- a/src/training/experiments/line_ctc_experiment.yml +++ b/src/training/experiments/line_ctc_experiment.yml @@ -1,7 +1,7 @@ experiment_group: Lines Experiments experiments: - train_args: - batch_size: 42 + batch_size: 64 max_epochs: &max_epochs 32 dataset: type: IamLinesDataset @@ -17,18 +17,18 @@ experiments: network: type: LineRecurrentNetwork args: + # backbone: ResidualNetwork + # backbone_args: + # in_channels: 1 + # num_classes: 64 # Embedding + # depths: [2,2] + # block_sizes: [32, 64] + # activation: selu + # stn: false backbone: ResidualNetwork backbone_args: - in_channels: 1 - num_classes: 64 # Embedding - depths: [2,2] - block_sizes: [32,64] - activation: selu - stn: false - # encoder: ResidualNetwork - # encoder_args: - # pretrained: training/experiments/CharacterModel_EmnistDataset_ResidualNetwork/0917_203601/model/best.pt - # freeze: false + pretrained: training/experiments/CharacterModel_EmnistDataset_ResidualNetwork/0920_010806/model/best.pt + freeze: false flatten: false input_size: 64 hidden_size: 64 @@ -67,20 +67,20 @@ experiments: # args: # T_max: *max_epochs swa_args: - start: 24 + start: 48 lr: 5.e-2 - callbacks: [Checkpoint, ProgressBar, WandbCallback, WandbImageLogger] # EarlyStopping] + callbacks: [Checkpoint, ProgressBar, WandbCallback, WandbImageLogger, EarlyStopping] callback_args: Checkpoint: monitor: val_loss mode: min ProgressBar: epochs: *max_epochs - # EarlyStopping: - # monitor: val_loss - # min_delta: 0.0 - # patience: 10 - # mode: min + EarlyStopping: + monitor: val_loss + min_delta: 0.0 + patience: 10 + mode: min WandbCallback: log_batch_frequency: 10 WandbImageLogger: diff --git a/src/training/run_experiment.py b/src/training/run_experiment.py index a347d9f..cc882ad 100644 --- a/src/training/run_experiment.py +++ b/src/training/run_experiment.py @@ -116,7 +116,7 @@ def load_modules_and_arguments(experiment_config: Dict) -> Tuple[Callable, Dict] # Learning rate scheduler lr_scheduler_ = None lr_scheduler_args = None - if experiment_config["lr_scheduler"] is not None: + if "lr_scheduler" in experiment_config: lr_scheduler_ = getattr( torch.optim.lr_scheduler, experiment_config["lr_scheduler"]["type"] ) -- cgit v1.2.3-70-g09d2