Skip to content

Commit

Permalink
Ricommenti per la dic_history
Browse files Browse the repository at this point in the history
  • Loading branch information
GiuseppeCannata committed Mar 7, 2022
1 parent afbbedb commit d3aeaca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Specify the mode to start the framework. The list of MODE value is given below:
<li>train_cDCGAN: train the conditional Generative Adversarial Network </li>
<li>evaluate_G1: calculate FID and IS scores of G<sub>1</sub> </li>
<li>evaluate_GAN: calculate FID and IS scores of all framework</li>
<li>tsne_GAN: calculate t-sne of all framework </li>
<li>tsne_GAN: calculate t-sne of all framework</li>
<li>inference_G1: inference on test set using G<sub>1</sub> </li>
<li>inference_GAN: inference on test set using all framework</li>
<li>plot_history_G1: plot history file of G<sub>1</sub> training</li>
Expand Down
1 change: 1 addition & 0 deletions data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The content of each folder is described below:
<ul>
<li>train/valid/test sets in <i>.tfrecord</i> format. These are the set to use during the training and evaluation phase</li>
<li>sets_configs.pkl that describe the carateristics about the configuration <i>(radius_key=2, flip=True, etc..)</i></li>
<li>dic_history.pkl dictonary in which we have for each sets the pair formed and the related positin in tfrecord file</li>
</ul>
These files are created by the <a href="./Dataset_configuration_generator.py"> ./Dataset_configuration_generator.py </a> script described in section 2.</li>
</ul>
Expand Down
1 change: 1 addition & 0 deletions data/Syntetich_complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ In each of configuration directory there are:
<ul>
<li> the train, valid e test sets files in .tfrecord format</li>
<li> sets_config file in pikle (.pkl) format that containg the infos on configuration. </li>
<li> dic_history.pkl dictonary in which we have for each sets the pairs formed and the related position in the tfrecord file</li>
</ul>
For the Syntetich complete, we created only one configuration called: negative_no_flip_camp_5_keypoints_2_mask_1.
The configuration and related files are created by the
Expand Down
6 changes: 5 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
pg2.evaluate_GAN(analysis_set="test_set", name_dataset=config.name_tfrecord_test,
dataset_len=config.dataset_test_len)
elif config.MODE == 'tsne_GAN':
pg2.tsne(key_image_interested="test_20") # id immagine ottenuto dalla inference
# The dic_history_key_pair refers to a specific pair.
# In this case, 'test_20', signify that we want compare the real and generated features of
# 20th pair in test set. You can write other pairs. In particular, the value that you can use are defined in
# dic_history.pkl file of your dataset configuration as keys of dictionary
pg2.tsne(dic_history_key_pair="test_20")
elif config.MODE == 'inference_G1':
pg2.inference_on_test_set_G1()
elif config.MODE == 'inference_GAN':
Expand Down
4 changes: 2 additions & 2 deletions src/pg2.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def plot_history_GAN(self):

plt.show()

def tsne(self, key_image_interested="test_20"):
def tsne(self, dic_history_key_pair="test_20"):
self.config.load_train_path_G1()
self.config.load_train_path_GAN()
tsne_path = os.path.join(self.config.OUTPUTS_DIR, "evaluation", "tsne")
Expand Down Expand Up @@ -998,4 +998,4 @@ def tsne(self, key_image_interested="test_20"):
utils.vgg16_pca_tsne_features.start(list_sets, list_perplexity,
self.G1, self.G2, self.dataset_module,
dir_to_save=tsne_path, save_fig_plot=True,
key_image_interested=key_image_interested)
key_image_interested=dic_history_key_pair)

0 comments on commit d3aeaca

Please sign in to comment.