diff --git a/.gitignore b/.gitignore index 209deaf..10597eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ code/*.pyc code/__pycache__ +*.py[cod] +*$py.class + +# Editors +.vscode/ +.idea/ + +# Windows +Thumbs.db diff --git a/code/exp_configurations.py b/code/exp_configurations.py index 08f0497..aa57180 100644 --- a/code/exp_configurations.py +++ b/code/exp_configurations.py @@ -36,8 +36,8 @@ 'LR', 'Epoch'] -conf_baseline = {'dataset': ['cfw32x32',], - 'classifier': ['allcnn', ], +conf_baseline = {'dataset': ['cfw32x32'], + 'classifier': ['allcnn'], 'regularizer': [(1e-4, None)], 'LR': [LR], 'Epoch': [EPOCH]} @@ -81,8 +81,8 @@ 'classifier': ['allcnn', 'resnet'], 'target_shape': [(20, 19, 2), (28, 27, 1), (14, 11, 2), (18, 17, 1), (9, 6, 1), (6, 9, 1)], 'sensing_mode': ['tensor'], - 'linear_sensing': [True,], - 'end_to_end': [True,], + 'linear_sensing': [True], + 'end_to_end': [True], 'mean_update': [False], 'augmentation': [True], 'regularizer': [(1e-4, None)], @@ -98,8 +98,8 @@ 'classifier': ['allcnn'], 'target_shape': [(20, 19, 2), (28, 27, 1), (14, 11, 2), (18, 17, 1), (9, 6, 1), (6, 9, 1)], 'sensing_mode': ['tensor'], - 'linear_sensing': [True,], - 'end_to_end': [True,], + 'linear_sensing': [True], + 'end_to_end': [True], 'mean_update': [False], 'augmentation': [True], 'regularizer': [(1e-4, None)], @@ -117,7 +117,7 @@ 'target_shape': [(20, 19, 2), (28, 27, 1), (14, 11, 2), (18, 17, 1), (9, 6, 1), (6, 9, 1)], 'sensing_mode': ['tensor'], 'linear_sensing': [True, False], - 'end_to_end': [True,], + 'end_to_end': [True], 'mean_update': [False], 'augmentation': [True], 'regularizer': [(1e-4, None)], @@ -133,8 +133,8 @@ 'classifier': ['allcnn'], 'target_shape': [(28, 27, 1), (18, 17, 1), (9, 6, 1)], 'sensing_mode': ['tensor'], - 'linear_sensing': [True,], - 'end_to_end': [True,], + 'linear_sensing': [True], + 'end_to_end': [True], 'mean_update': [False], 'augmentation': [True], 'regularizer': [(1e-4, None)], diff --git a/code/train.py b/code/train.py index 7410741..084a901 100644 --- a/code/train.py +++ b/code/train.py @@ -19,17 +19,16 @@ def save_result(output, path): fid.close() def main(argv): - try: - opts, args = getopt.getopt(argv,"h", ['index=' ]) - + opts, args = getopt.getopt(argv, "h", ['index=']) + except getopt.GetoptError: sys.exit(2) - - for opt, arg in opts: + + for opt, arg in opts: if opt == '--index': index = int(arg) - + baseline_configurations = Utility.create_configuration([Conf.baseline_var_names], [Conf.conf_baseline]) experiment_configurations = Utility.create_configuration([Conf.hyperparameters]*5, [Conf.conf_vector, @@ -47,13 +46,15 @@ def main(argv): output = Runners.train_baseline(baseline_configurations[index]) filename = '_'.join([str(v) for v in baseline_configurations[index]]) + '.pickle' filename = os.path.join(Conf.BASELINE_DIR, filename) - + else: - output = Runners.train_sensing(experiment_configurations[index-len(baseline_configurations)]) - filename = '_'.join([str(v) for v in experiment_configurations[index-len(baseline_configurations)]]) + '.pickle' + output = Runners.train_sensing(experiment_configurations[index - len(baseline_configurations)]) + filename = '_'.join( + [str(v) for v in experiment_configurations[index - len(baseline_configurations)]]) + '.pickle' filename = os.path.join(Conf.OUTPUT_DIR, filename) - + save_result(output, filename) - + + if __name__ == "__main__": main(sys.argv[1:])