summaryrefslogtreecommitdiff
path: root/src/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/tasks')
-rwxr-xr-xsrc/tasks/create_emnist_lines_datasets.sh4
-rwxr-xr-xsrc/tasks/create_iam_paragraphs.sh2
-rwxr-xr-xsrc/tasks/download_emnist.sh3
-rwxr-xr-xsrc/tasks/download_iam.sh2
-rwxr-xr-xsrc/tasks/prepare_experiments.sh2
-rwxr-xr-xsrc/tasks/train.sh67
-rw-r--r--src/tasks/train_crnn_line_ctc_model.sh3
7 files changed, 79 insertions, 4 deletions
diff --git a/src/tasks/create_emnist_lines_datasets.sh b/src/tasks/create_emnist_lines_datasets.sh
new file mode 100755
index 0000000..0940549
--- /dev/null
+++ b/src/tasks/create_emnist_lines_datasets.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+command="python text_recognizer/datasets/emnist_lines_dataset.py --max_length 34 --min_overlap 0.0 --max_overlap 0.33 --num_train 100000 --num_test 10000"
+echo $command
+eval $command
diff --git a/src/tasks/create_iam_paragraphs.sh b/src/tasks/create_iam_paragraphs.sh
new file mode 100755
index 0000000..9063d44
--- /dev/null
+++ b/src/tasks/create_iam_paragraphs.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+poetry run create-iam-paragraphs
diff --git a/src/tasks/download_emnist.sh b/src/tasks/download_emnist.sh
new file mode 100755
index 0000000..d142324
--- /dev/null
+++ b/src/tasks/download_emnist.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+poetry run download-emnist
+poetry run create-emnist-support-files
diff --git a/src/tasks/download_iam.sh b/src/tasks/download_iam.sh
new file mode 100755
index 0000000..4bf011c
--- /dev/null
+++ b/src/tasks/download_iam.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+poetry run download-iam
diff --git a/src/tasks/prepare_experiments.sh b/src/tasks/prepare_experiments.sh
index 9b91daa..f2787b3 100755
--- a/src/tasks/prepare_experiments.sh
+++ b/src/tasks/prepare_experiments.sh
@@ -1,3 +1,3 @@
#!/bin/bash
experiments_filename=${1:-training/experiments/sample_experiment.yml}
-python training/prepare_experiments.py --experiments_filename $experiments_filename
+poetry run prepare-experiments --experiments_filename $experiments_filename
diff --git a/src/tasks/train.sh b/src/tasks/train.sh
new file mode 100755
index 0000000..71a68be
--- /dev/null
+++ b/src/tasks/train.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Add checkpoint and resume experiment
+usage() {
+ cat << EOF
+ usage: ./tasks/train_crnn_line_ctc_model.sh
+ -f | --experiment_config Name of the experiment config.
+ -c | --checkpoint (Optional) The experiment name to continue from.
+ -p | --pretrained_weights (Optional) Path to pretrained weights.
+ -n | --notrain (Optional) Evaluates a trained model.
+ -t | --test (Optional) If set, evaluates the model on test set.
+ -v | --verbose (Optional) Sets the verbosity.
+ -h | --help Shows this message.
+EOF
+exit 1
+}
+
+experiment_config=""
+checkpoint=""
+pretrained_weights=""
+notrain=""
+test=""
+verbose=""
+train_command=""
+
+while getopts 'f:c:p:nthv' flag; do
+ case "${flag}" in
+ f) experiment_config="${OPTARG}" ;;
+ c) checkpoint="${OPTARG}" ;;
+ p) pretrained_weights="${OPTARG}" ;;
+ n) notrain="--notrain" ;;
+ t) test="--test" ;;
+ v) verbose="${verbose}v" ;;
+ h) usage ;;
+ *) error "Unexpected option ${flag}" ;;
+ esac
+done
+
+
+if [ -z ${experiment_config} ];
+then
+ echo "experiment_config not specified!"
+ usage
+ exit 1
+fi
+
+experiments_filename="training/experiments/${experiment_config}"
+train_command=$(./tasks/prepare_experiments.sh $experiments_filename)
+
+if [ ${checkpoint} ];
+then
+ train_command="${train_command} --checkpoint $checkpoint"
+fi
+
+if [ ${pretrained_weights} ];
+then
+ train_command="${train_command} --pretrained_weights $pretrained_weights"
+fi
+
+if [ ${verbose} ];
+then
+ train_command="${train_command} -$verbose"
+fi
+
+train_command="${train_command} $test $notrain"
+echo $train_command
+eval $train_command
diff --git a/src/tasks/train_crnn_line_ctc_model.sh b/src/tasks/train_crnn_line_ctc_model.sh
deleted file mode 100644
index 9831289..0000000
--- a/src/tasks/train_crnn_line_ctc_model.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-experiments_filename=${1:-training/experiments/line_ctc_experiment.yml}
-exec ./prepare_experiments.sh experiments_filename=experiments_filename