|
2 | 2 | // File: lstmtraining.cpp
|
3 | 3 | // Description: Training program for LSTM-based networks.
|
4 | 4 | // Author: Ray Smith
|
5 |
| -// Created: Fri May 03 11:05:06 PST 2013 |
6 | 5 | //
|
7 | 6 | // (C) Copyright 2013, Google Inc.
|
8 | 7 | // Licensed under the Apache License, Version 2.0 (the "License");
|
|
28 | 27 | #include "tprintf.h"
|
29 | 28 | #include "unicharset_training_utils.h"
|
30 | 29 |
|
31 |
| -INT_PARAM_FLAG(debug_interval, 0, "How often to display the alignment."); |
32 |
| -STRING_PARAM_FLAG(net_spec, "", "Network specification"); |
33 |
| -INT_PARAM_FLAG(net_mode, 192, "Controls network behavior."); |
34 |
| -INT_PARAM_FLAG(perfect_sample_delay, 0, |
35 |
| - "How many imperfect samples between perfect ones."); |
36 |
| -DOUBLE_PARAM_FLAG(target_error_rate, 0.01, "Final error rate in percent."); |
37 |
| -DOUBLE_PARAM_FLAG(weight_range, 0.1, "Range of initial random weights."); |
38 |
| -DOUBLE_PARAM_FLAG(learning_rate, 10.0e-4, "Weight factor for new deltas."); |
39 |
| -DOUBLE_PARAM_FLAG(momentum, 0.5, "Decay factor for repeating deltas."); |
40 |
| -DOUBLE_PARAM_FLAG(adam_beta, 0.999, "Decay factor for repeating deltas."); |
41 |
| -INT_PARAM_FLAG(max_image_MB, 6000, "Max memory to use for images."); |
42 |
| -STRING_PARAM_FLAG(continue_from, "", "Existing model to extend"); |
43 |
| -STRING_PARAM_FLAG(model_output, "lstmtrain", "Basename for output models"); |
44 |
| -STRING_PARAM_FLAG(train_listfile, "", |
45 |
| - "File listing training files in lstmf training format."); |
46 |
| -STRING_PARAM_FLAG(eval_listfile, "", |
47 |
| - "File listing eval files in lstmf training format."); |
48 |
| -BOOL_PARAM_FLAG(stop_training, false, |
49 |
| - "Just convert the training model to a runtime model."); |
50 |
| -BOOL_PARAM_FLAG(convert_to_int, false, |
51 |
| - "Convert the recognition model to an integer model."); |
52 |
| -BOOL_PARAM_FLAG(sequential_training, false, |
53 |
| - "Use the training files sequentially instead of round-robin."); |
54 |
| -INT_PARAM_FLAG(append_index, -1, "Index in continue_from Network at which to" |
55 |
| - " attach the new network defined by net_spec"); |
56 |
| -BOOL_PARAM_FLAG(debug_network, false, |
57 |
| - "Get info on distribution of weight values"); |
58 |
| -INT_PARAM_FLAG(max_iterations, 0, "If set, exit after this many iterations"); |
59 |
| -STRING_PARAM_FLAG(traineddata, "", |
60 |
| - "Combined Dawgs/Unicharset/Recoder for language model"); |
61 |
| -STRING_PARAM_FLAG(old_traineddata, "", |
62 |
| - "When changing the character set, this specifies the old" |
63 |
| - " character set that is to be replaced"); |
64 |
| -BOOL_PARAM_FLAG(randomly_rotate, false, |
65 |
| - "Train OSD and randomly turn training samples upside-down"); |
| 30 | +static INT_PARAM_FLAG(debug_interval, 0, "How often to display the alignment."); |
| 31 | +static STRING_PARAM_FLAG(net_spec, "", "Network specification"); |
| 32 | +static INT_PARAM_FLAG(net_mode, 192, "Controls network behavior."); |
| 33 | +static INT_PARAM_FLAG(perfect_sample_delay, 0, |
| 34 | + "How many imperfect samples between perfect ones."); |
| 35 | +static DOUBLE_PARAM_FLAG(target_error_rate, 0.01, "Final error rate in percent."); |
| 36 | +static DOUBLE_PARAM_FLAG(weight_range, 0.1, "Range of initial random weights."); |
| 37 | +static DOUBLE_PARAM_FLAG(learning_rate, 10.0e-4, "Weight factor for new deltas."); |
| 38 | +static DOUBLE_PARAM_FLAG(momentum, 0.5, "Decay factor for repeating deltas."); |
| 39 | +static DOUBLE_PARAM_FLAG(adam_beta, 0.999, "Decay factor for repeating deltas."); |
| 40 | +static INT_PARAM_FLAG(max_image_MB, 6000, "Max memory to use for images."); |
| 41 | +static STRING_PARAM_FLAG(continue_from, "", "Existing model to extend"); |
| 42 | +static STRING_PARAM_FLAG(model_output, "lstmtrain", "Basename for output models"); |
| 43 | +static STRING_PARAM_FLAG(train_listfile, "", |
| 44 | + "File listing training files in lstmf training format."); |
| 45 | +static STRING_PARAM_FLAG(eval_listfile, "", |
| 46 | + "File listing eval files in lstmf training format."); |
| 47 | +static BOOL_PARAM_FLAG(stop_training, false, |
| 48 | + "Just convert the training model to a runtime model."); |
| 49 | +static BOOL_PARAM_FLAG(convert_to_int, false, |
| 50 | + "Convert the recognition model to an integer model."); |
| 51 | +static BOOL_PARAM_FLAG(sequential_training, false, |
| 52 | + "Use the training files sequentially instead of round-robin."); |
| 53 | +static INT_PARAM_FLAG(append_index, -1, "Index in continue_from Network at which to" |
| 54 | + " attach the new network defined by net_spec"); |
| 55 | +static BOOL_PARAM_FLAG(debug_network, false, |
| 56 | + "Get info on distribution of weight values"); |
| 57 | +static INT_PARAM_FLAG(max_iterations, 0, "If set, exit after this many iterations"); |
| 58 | +static STRING_PARAM_FLAG(traineddata, "", |
| 59 | + "Combined Dawgs/Unicharset/Recoder for language model"); |
| 60 | +static STRING_PARAM_FLAG(old_traineddata, "", |
| 61 | + "When changing the character set, this specifies the old" |
| 62 | + " character set that is to be replaced"); |
| 63 | +static BOOL_PARAM_FLAG(randomly_rotate, false, |
| 64 | + "Train OSD and randomly turn training samples upside-down"); |
66 | 65 |
|
67 | 66 | // Number of training images to train between calls to MaintainCheckpoints.
|
68 | 67 | const int kNumPagesPerBatch = 100;
|
|
0 commit comments