|
2 | 2 |
|
3 | 3 |
|
4 | 4 | from tensorflow.python.platform import tf_logging as logging
|
5 |
| -from tensorflow.python import debug as tf_debug |
6 | 5 |
|
7 | 6 | import research.slim.nets.nets_factory as nets_factory
|
8 | 7 | from utils.gen_tfrec import load_batch, get_dataset, load_batch_dense, load_batch_estimator
|
|
14 | 13 |
|
15 | 14 | #Open and read the yaml file:
|
16 | 15 | cwd = os.getcwd()
|
17 |
| -stream = open(os.path.join(cwd, "yaml","config","config_multiclass.yaml")) |
18 |
| -data = load(stream) |
19 |
| -stream.close() |
| 16 | +with open(os.path.join(cwd, "yaml","config","config.yaml")) as stream: |
| 17 | + data = load(stream) |
20 | 18 | #==================================#
|
21 | 19 | #=======Dataset Informations=======#
|
22 | 20 | #==================================#
|
|
64 | 62 | #==================================#
|
65 | 63 | #=======Network Informations=======#
|
66 | 64 | #==================================#
|
67 |
| -network_file = open(os.path.join(cwd, "yaml", "cnn", model_name+".yaml")) |
68 |
| -network_config = load(network_file) |
69 |
| -network_file.close() |
| 65 | +with open(os.path.join(cwd, "yaml", "cnn", model_name+".yaml")) as network_file: |
| 66 | + network_config = load(network_file) |
70 | 67 | variables_to_exclude = network_config.pop("variables_to_exclude")
|
71 | 68 | argscope_config = network_config.pop("argscope")
|
72 | 69 | if "prediction_fn" in network_config.keys():
|
@@ -173,7 +170,7 @@ def main():
|
173 | 170 | #Define max steps:
|
174 | 171 | max_step = num_epochs*num_batches_per_epoch
|
175 | 172 | #Define configuration non-distributed work:
|
176 |
| - run_config = tf.estimator.RunConfig(model_dir=train_dir, save_checkpoints_steps=num_batches_per_epoch,keep_checkpoint_max=num_epochs) |
| 173 | + run_config = tf.estimator.RunConfig(save_checkpoints_steps=num_batches_per_epoch,keep_checkpoint_max=num_epochs) |
177 | 174 | train_spec = tf.estimator.TrainSpec(input_fn=lambda:input_fn(tf.estimator.ModeKeys.TRAIN,
|
178 | 175 | dataset_dir, model_name, file_pattern,
|
179 | 176 | file_pattern_for_counting, names_to_labels,
|
|
0 commit comments