-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsettings.py
More file actions
48 lines (40 loc) · 2.62 KB
/
settings.py
File metadata and controls
48 lines (40 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# encoding: utf-8
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
# Flags train settings
flags.DEFINE_integer('batch_size', 100, 'the number of images in a batch.')
flags.DEFINE_string('tfcsv', 'data/train_csv.txt', 'path to tf csv file for training.')
flags.DEFINE_string('testcsv', 'data/test_csv.txt', 'path to tf csv file for testing.')
flags.DEFINE_string('predictcsv', 'data/predict_csv.txt', 'path to tf csv file to predict.')
tf.app.flags.DEFINE_string('train_dir', 'train', "Directory where to write event logs and checkpoint")
tf.app.flags.DEFINE_integer('num_classes', 101, "Number of classes")
tf.app.flags.DEFINE_integer('max_steps', 10000000, "Number of batches to run.")
tf.app.flags.DEFINE_integer('num_threads', 4, "Number of threads")
tf.app.flags.DEFINE_string('subset', 'train', "Either 'train' or 'validation'.")
tf.app.flags.DEFINE_float('batchnorm_moving_average_decay', 0.9997, "decay rate of batchnorm.")
tf.app.flags.DEFINE_float('moving_average_decay', 0.9999, "decay rate of movieng average.")
tf.app.flags.DEFINE_integer('num_examples_per_epoch_for_train', 500, "the number of examples per epoch train.")
# FLags train images settings
tf.app.flags.DEFINE_integer('image_h_org', 64, "original image height")
tf.app.flags.DEFINE_integer('image_w_org', 64, "original image weight")
tf.app.flags.DEFINE_integer('image_c_org', 3, "original image weight")
# FLags train inputs settings
tf.app.flags.DEFINE_integer('scale_h', 250, "scale image height")
tf.app.flags.DEFINE_integer('scale_w', 250, "scale image weight")
tf.app.flags.DEFINE_integer('input_h', 229, "input image height")
tf.app.flags.DEFINE_integer('input_w', 229, "input image weight")
tf.app.flags.DEFINE_integer('input_c', 3, "input image weight")
tf.app.flags.DEFINE_integer('crop_h', 200, "crop image height")
tf.app.flags.DEFINE_integer('crop_w', 200, "crop image weight")
# Flags governing the hardware employed for running TensorFlow.
tf.app.flags.DEFINE_integer('num_gpus', 1, "How many GPUs to use.")
tf.app.flags.DEFINE_boolean('log_device_placement', False, "Whether to log device placement.")
# Flags governing the type of training.
tf.app.flags.DEFINE_boolean('fine_tune', False, "is fine tune")
tf.app.flags.DEFINE_string('pretrained_model_checkpoint_path', '', "pretrained model's checkpoint path")
tf.app.flags.DEFINE_float('initial_learning_rate', 0.001, "Initial learning rate.")
tf.app.flags.DEFINE_float('num_epochs_per_decay', 30.0, "Epochs after which learning rate decays.")
tf.app.flags.DEFINE_float('learning_rate_decay_factor', 0.16, "Learning rate decay factor.")
# GPU
tf.app.flags.DEFINE_float('gpu_memory_fraction', 0.7, "gpu memory fraction.")