-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
72 lines (40 loc) · 2.47 KB
/
main.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from find_geodesics import find_geodesics
from utils import *
from configs import *
from statistics import *
def main():
# Configuration loads all the parameters from the config file and overwrites
# parameters that are specified on the command line
configurations = configure()
####################################
# Compute statistics of critic values
####################################
if configurations['COMPUTE_STATISTICS_OFF'] == False:
# Compute range of critic values
maxim, minim = discriminator_value_statistics(configurations['model'], configurations['global_seed'], configurations['n_statistics'], configurations['gpu_id'], configurations['experiment_id'], configurations['optional_run_id'], configurations['tfrecord_dir'])
configurations['max_critic_value'] = maxim
configurations['min_critic_value'] = minim
configurations['max_ideal_critic_value'] = maxim
print("Maximal and minimal critic values changed from default to new values.")
print("Plotting of histograms of discriminator values and sample grids completed!\n---------------------\n")
####################################
# Training the geodesics
####################################
if configurations['TRAIN_GEODESICS_OFF'] == False:
# The following returns a dictionary of results
# key = methods: linear, mse, mse_plus_disc, vgg, vgg_plus_disc
# value = a list of two things: curves_in_sample_space and critic values along path
geodesics_dict = find_geodesics(**configurations)
print("\nPlotting the results\n")
plot_geodesic_comparison(geodesics_dict, configurations['methods'], configurations['n_pts_on_geodesic'], configurations['experiment_id'], configurations['optional_run_id'])
plot_critics(geodesics_dict, configurations['methods'], configurations['experiment_id'], configurations['optional_run_id'])
plot_sqDiff(geodesics_dict, configurations['methods'], configurations['experiment_id'], configurations['optional_run_id'])
####################################
# Video generation
####################################
if configurations['VIDEO_GENERATION_OFF'] == False:
video_generation(**configurations)
print("Successful!\n")
return None
if __name__ == "__main__":
main()