|
@@ -30,7 +30,7 @@ min_max_filename = cfg.min_max_filename_extension
|
|
|
|
|
|
# define all scenes values
|
|
# define all scenes values
|
|
scenes_list = cfg.scenes_names
|
|
scenes_list = cfg.scenes_names
|
|
-scenes_indexes = cfg.scenes_indices
|
|
|
|
|
|
+scenes_indices = cfg.scenes_indices
|
|
choices = cfg.normalization_choices
|
|
choices = cfg.normalization_choices
|
|
path = cfg.dataset_path
|
|
path = cfg.dataset_path
|
|
zones = cfg.zones_indices
|
|
zones = cfg.zones_indices
|
|
@@ -40,14 +40,18 @@ metric_choices = cfg.metric_choices_labels
|
|
|
|
|
|
max_nb_bits = 8
|
|
max_nb_bits = 8
|
|
|
|
|
|
-def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
|
|
|
|
+def display_svd_values(p_scene, p_interval, p_indices, p_zone, p_metric, p_mode, p_step, p_norm, p_ylim):
|
|
"""
|
|
"""
|
|
@brief Method which gives information about svd curves from zone of picture
|
|
@brief Method which gives information about svd curves from zone of picture
|
|
@param p_scene, scene expected to show svd values
|
|
@param p_scene, scene expected to show svd values
|
|
|
|
+ @param p_interval, interval [begin, end] of svd data to display
|
|
@param p_interval, interval [begin, end] of samples or minutes from render generation engine
|
|
@param p_interval, interval [begin, end] of samples or minutes from render generation engine
|
|
@param p_zone, zone's identifier of picture
|
|
@param p_zone, zone's identifier of picture
|
|
@param p_metric, metric computed to show
|
|
@param p_metric, metric computed to show
|
|
@param p_mode, normalization's mode
|
|
@param p_mode, normalization's mode
|
|
|
|
+ @param p_step, step of images indices
|
|
|
|
+ @param p_norm, normalization or not of selected svd data
|
|
|
|
+ @param p_ylim, ylim choice to better display of data
|
|
@return nothing
|
|
@return nothing
|
|
"""
|
|
"""
|
|
|
|
|
|
@@ -55,14 +59,15 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
# remove min max file from scenes folder
|
|
# remove min max file from scenes folder
|
|
scenes = [s for s in scenes if min_max_filename not in s]
|
|
scenes = [s for s in scenes if min_max_filename not in s]
|
|
|
|
|
|
- begin, end = p_interval
|
|
|
|
|
|
+ begin_data, end_data = p_interval
|
|
|
|
+ begin_index, end_index = p_indices
|
|
|
|
+
|
|
data_min_max_filename = os.path.join(path, p_metric + min_max_filename)
|
|
data_min_max_filename = os.path.join(path, p_metric + min_max_filename)
|
|
|
|
|
|
# go ahead each scenes
|
|
# go ahead each scenes
|
|
for id_scene, folder_scene in enumerate(scenes):
|
|
for id_scene, folder_scene in enumerate(scenes):
|
|
|
|
|
|
if p_scene == folder_scene:
|
|
if p_scene == folder_scene:
|
|
- print(folder_scene)
|
|
|
|
scene_path = os.path.join(path, folder_scene)
|
|
scene_path = os.path.join(path, folder_scene)
|
|
|
|
|
|
config_file_path = os.path.join(scene_path, config_filename)
|
|
config_file_path = os.path.join(scene_path, config_filename)
|
|
@@ -87,7 +92,7 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
zones_folder.append(current_zone)
|
|
zones_folder.append(current_zone)
|
|
|
|
|
|
zones_images_data = []
|
|
zones_images_data = []
|
|
- images_indexes = []
|
|
|
|
|
|
+ images_indices = []
|
|
|
|
|
|
zone_folder = zones_folder[p_zone]
|
|
zone_folder = zones_folder[p_zone]
|
|
|
|
|
|
@@ -112,10 +117,9 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
while len(start_index_image) > len(current_counter_index_str):
|
|
while len(start_index_image) > len(current_counter_index_str):
|
|
current_counter_index_str = "0" + current_counter_index_str
|
|
current_counter_index_str = "0" + current_counter_index_str
|
|
|
|
|
|
-
|
|
|
|
if current_counter_index % p_step == 0:
|
|
if current_counter_index % p_step == 0:
|
|
- if current_counter_index >= begin and current_counter_index <= end:
|
|
|
|
- images_indexes.append(current_counter_index_str)
|
|
|
|
|
|
+ if current_counter_index >= begin_index and current_counter_index <= end_index:
|
|
|
|
+ images_indices.append(current_counter_index_str)
|
|
|
|
|
|
if seuil_learned < int(current_counter_index) and not threshold_image_found:
|
|
if seuil_learned < int(current_counter_index) and not threshold_image_found:
|
|
|
|
|
|
@@ -124,10 +128,10 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
|
|
|
|
current_counter_index += step_counter
|
|
current_counter_index += step_counter
|
|
|
|
|
|
- # all indexes of picture to plot
|
|
|
|
- print(images_indexes)
|
|
|
|
|
|
+ # all indices of picture to plot
|
|
|
|
+ print(images_indices)
|
|
|
|
|
|
- for index in images_indexes:
|
|
|
|
|
|
+ for index in images_indices:
|
|
|
|
|
|
img_path = os.path.join(scene_path, prefix_image_name + str(index) + ".png")
|
|
img_path = os.path.join(scene_path, prefix_image_name + str(index) + ".png")
|
|
|
|
|
|
@@ -141,6 +145,9 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
# Here you can add the way you compute data
|
|
# Here you can add the way you compute data
|
|
data = get_svd_data(p_metric, block)
|
|
data = get_svd_data(p_metric, block)
|
|
|
|
|
|
|
|
+ if p_norm:
|
|
|
|
+ data = data[begin_data:end_data]
|
|
|
|
+
|
|
##################
|
|
##################
|
|
# Data mode part #
|
|
# Data mode part #
|
|
##################
|
|
##################
|
|
@@ -157,23 +164,28 @@ def display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step):
|
|
if p_mode == 'svdn':
|
|
if p_mode == 'svdn':
|
|
data = utils.normalize_arr(data)
|
|
data = utils.normalize_arr(data)
|
|
|
|
|
|
- zones_images_data.append(data)
|
|
|
|
|
|
+ if not p_norm:
|
|
|
|
+ zones_images_data.append(data[begin_data:end_data])
|
|
|
|
+ else:
|
|
|
|
+ zones_images_data.append(data)
|
|
|
|
|
|
- plt.title(p_scene + ' scene interval information ['+ str(begin) +', '+ str(end) +'], ' + p_metric + ' metric, ' + p_mode, fontsize=20)
|
|
|
|
|
|
+ plt.title(p_scene + ' scene interval information SVD['+ str(begin_data) +', '+ str(end_data) +'], from scenes indices [' + str(begin_index) + ', '+ str(end_index) + ']' + p_metric + ' metric, ' + p_mode + ', with step of ' + str(p_step) + ', svd norm ' + str(p_norm), fontsize=20)
|
|
plt.ylabel('Image samples or time (minutes) generation', fontsize=14)
|
|
plt.ylabel('Image samples or time (minutes) generation', fontsize=14)
|
|
plt.xlabel('Vector features', fontsize=16)
|
|
plt.xlabel('Vector features', fontsize=16)
|
|
|
|
|
|
for id, data in enumerate(zones_images_data):
|
|
for id, data in enumerate(zones_images_data):
|
|
|
|
|
|
- p_label = p_scene + "_" + images_indexes[id]
|
|
|
|
|
|
+ p_label = p_scene + "_" + images_indices[id]
|
|
|
|
|
|
- if images_indexes[id] == threshold_image_zone:
|
|
|
|
|
|
+ if images_indices[id] == threshold_image_zone:
|
|
plt.plot(data, label=p_label, lw=4, color='red')
|
|
plt.plot(data, label=p_label, lw=4, color='red')
|
|
else:
|
|
else:
|
|
plt.plot(data, label=p_label)
|
|
plt.plot(data, label=p_label)
|
|
|
|
|
|
plt.legend(bbox_to_anchor=(0.8, 1), loc=2, borderaxespad=0.2, fontsize=14)
|
|
plt.legend(bbox_to_anchor=(0.8, 1), loc=2, borderaxespad=0.2, fontsize=14)
|
|
- plt.ylim(0, 0.1)
|
|
|
|
|
|
+
|
|
|
|
+ start_ylim, end_ylim = p_ylim
|
|
|
|
+ plt.ylim(start_ylim, end_ylim)
|
|
|
|
|
|
plt.show()
|
|
plt.show()
|
|
|
|
|
|
@@ -182,31 +194,36 @@ def main():
|
|
|
|
|
|
# by default p_step value is 10 to enable all photos
|
|
# by default p_step value is 10 to enable all photos
|
|
p_step = 10
|
|
p_step = 10
|
|
|
|
+ p_norm = 0
|
|
|
|
+ p_ylim = (0, 1)
|
|
|
|
|
|
if len(sys.argv) <= 1:
|
|
if len(sys.argv) <= 1:
|
|
print('Run with default parameters...')
|
|
print('Run with default parameters...')
|
|
- print('python display_svd_zone_scene.py --scene A --interval "0,200" --zone 3 --metric lab --mode svdne --step 50')
|
|
|
|
|
|
+ print('python display_svd_zone_scene.py --scene A --interval "0,200" --indices "0, 900" --zone 3 --metric lab --mode svdne --step 50 --norm 0 --ylim "0, 0.1"')
|
|
sys.exit(2)
|
|
sys.exit(2)
|
|
try:
|
|
try:
|
|
- opts, args = getopt.getopt(sys.argv[1:], "hs:i:z:l:m:s", ["help=", "scene=", "interval=", "zone=", "metric=", "mode=", "step="])
|
|
|
|
|
|
+ opts, args = getopt.getopt(sys.argv[1:], "hs:i:i:z:l:m:s:n:y", ["help=", "scene=", "interval=", "indices=", "zone=", "metric=", "mode=", "step=", "norm=", "ylim="])
|
|
except getopt.GetoptError:
|
|
except getopt.GetoptError:
|
|
# print help information and exit:
|
|
# print help information and exit:
|
|
- print('python display_svd_zone_scene.py --scene A --interval "0,200" --zone 3 --metric lab --mode svdne --step 50')
|
|
|
|
|
|
+ print('python display_svd_zone_scene.py --scene A --interval "0,200" --indices "0, 900" --zone 3 --metric lab --mode svdne --step 50 --norm 0 --ylim "0, 0.1"')
|
|
sys.exit(2)
|
|
sys.exit(2)
|
|
for o, a in opts:
|
|
for o, a in opts:
|
|
if o == "-h":
|
|
if o == "-h":
|
|
- print('python display_svd_zone_scene.py --scene A --interval "0,200" --zone 3 --metric lab --mode svdne --step 50')
|
|
|
|
|
|
+ print('python display_svd_zone_scene.py --scene A --interval "0,200" --indices "0, 900" --zone 3 --metric lab --mode svdne --step 50 --norm 0 --ylim "0, 0.1"')
|
|
sys.exit()
|
|
sys.exit()
|
|
elif o in ("-s", "--scene"):
|
|
elif o in ("-s", "--scene"):
|
|
p_scene = a
|
|
p_scene = a
|
|
|
|
|
|
- if p_scene not in scenes_indexes:
|
|
|
|
|
|
+ if p_scene not in scenes_indices:
|
|
assert False, "Invalid scene choice"
|
|
assert False, "Invalid scene choice"
|
|
else:
|
|
else:
|
|
- p_scene = scenes_list[scenes_indexes.index(p_scene)]
|
|
|
|
|
|
+ p_scene = scenes_list[scenes_indices.index(p_scene)]
|
|
elif o in ("-i", "--interval"):
|
|
elif o in ("-i", "--interval"):
|
|
p_interval = list(map(int, a.split(',')))
|
|
p_interval = list(map(int, a.split(',')))
|
|
|
|
|
|
|
|
+ elif o in ("-i", "--indices"):
|
|
|
|
+ p_indices = list(map(int, a.split(',')))
|
|
|
|
+
|
|
elif o in ("-z", "--zone"):
|
|
elif o in ("-z", "--zone"):
|
|
p_zone = int(a)
|
|
p_zone = int(a)
|
|
|
|
|
|
@@ -225,10 +242,16 @@ def main():
|
|
elif o in ("-s", "--step"):
|
|
elif o in ("-s", "--step"):
|
|
p_step = int(a)
|
|
p_step = int(a)
|
|
|
|
|
|
|
|
+ elif o in ("-n", "--norm"):
|
|
|
|
+ p_norm = int(a)
|
|
|
|
+
|
|
|
|
+ elif o in ("-y", "--ylim"):
|
|
|
|
+ p_ylim = list(map(float, a.split(',')))
|
|
|
|
+
|
|
else:
|
|
else:
|
|
assert False, "unhandled option"
|
|
assert False, "unhandled option"
|
|
|
|
|
|
- display_svd_values(p_scene, p_interval, p_zone, p_metric, p_mode, p_step)
|
|
|
|
|
|
+ display_svd_values(p_scene, p_interval, p_indices, p_zone, p_metric, p_mode, p_step, p_norm, p_ylim)
|
|
|
|
|
|
if __name__== "__main__":
|
|
if __name__== "__main__":
|
|
main()
|
|
main()
|