Parcourir la source

Add of notebook analysis data

Jérôme BUISINE il y a 5 ans
Parent
commit
6ca84d364a

+ 26 - 0
analysis/save_img_block.py

@@ -0,0 +1,26 @@
+from ipfml import processing, utils
+from skimage import transform
+import numpy as np
+import matplotlib.pyplot as plt
+import os
+
+from PIL import Image
+
+data_folder = "../fichiersSVD_light"
+
+scene   = 'Cuisine01'
+mean_svd_values = []
+indices = ["00050", "00300", "01200"]
+id_block = 10
+
+def get_block_image(image_path):
+    image = Image.open(image_path)
+    blocks = processing.divide_in_blocks(image, (200, 200))
+    return blocks[id_block]
+
+for index in indices:
+    path = os.path.join(data_folder, scene + '/cuisine01_' + index + '.png')
+    img_block = get_block_image(path)
+    img_block.save(scene + '_' + str(index) + '_' + str(id_block) + '.png')
+
+

Fichier diff supprimé car celui-ci est trop grand
+ 395 - 0
analysis/svd_reconstruction_analysis.ipynb


Fichier diff supprimé car celui-ci est trop grand
+ 205 - 0
analysis/svd_scenes_analysis.ipynb


Fichier diff supprimé car celui-ci est trop grand
+ 221 - 0
analysis/svd_zones_analysis.ipynb


+ 6 - 2
display_simulation_curves.py

@@ -73,8 +73,12 @@ def display_curves(folder_path, model_name):
 
             # draw vertical line from (70,100) to (70, 250)
             plt.plot([counter_index, counter_index], [-2, 2], 'k-', lw=2, color='red')
-            plt.ylabel('Not noisy / Noisy', fontsize=18)
-            plt.xlabel('Time in minutes / Samples per pixel', fontsize=16)
+
+            if index % 4 == 0:
+                plt.ylabel('Not noisy / Noisy', fontsize=20)
+
+            if index >= 12:
+                plt.xlabel('Samples per pixel', fontsize=20)
 
             x_labels = [id * step_value + start_index for id, val in enumerate(row[5:]) if id % label_freq == 0]
 

+ 20 - 12
display_svd_data_scene.py

@@ -13,6 +13,7 @@ import numpy as np
 import random
 import time
 import json
+import math
 
 from PIL import Image
 from ipfml import processing, metrics, utils
@@ -20,9 +21,10 @@ import ipfml.iqa.fr as fr_iqa
 
 from skimage import color
 
+import matplotlib as mpl
 import matplotlib.pyplot as plt
-from modules.utils.data import get_svd_data
 
+from modules.utils.data import get_svd_data
 from modules.utils import config as cfg
 
 # getting configuration information
@@ -140,6 +142,8 @@ def display_svd_values(p_scene, p_interval, p_indices, p_metric, p_mode, p_step,
                 if p_norm:
                     svd_values = svd_values[begin_data:end_data]
 
+                #svd_values = np.asarray([math.log(x) for x in svd_values])
+
                 # update min max values
                 min_value = svd_values.min()
                 max_value = svd_values.max()
@@ -186,31 +190,35 @@ def display_svd_values(p_scene, p_interval, p_indices, p_metric, p_mode, p_step,
 
 
             # display all data using matplotlib (configure plt)
-            fig = plt.figure(figsize=(30, 22))
+            #fig = plt.figure(figsize=(30, 22))
+            fig, ax = plt.subplots(figsize=(30, 22))
+            ax.set_facecolor('#F9F9F9')
+            #fig.patch.set_facecolor('#F9F9F9')
 
-            plt.rc('xtick', labelsize=22)
-            plt.rc('ytick', labelsize=22)
+            ax.tick_params(labelsize=22)
+            #plt.rc('xtick', labelsize=22)
+            #plt.rc('ytick', labelsize=22)
 
-            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=24)
-            plt.ylabel('Component values', fontsize=24)
-            plt.xlabel('Vector features', fontsize=24)
+            #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=24)
+            ax.set_ylabel('Component values', fontsize=30)
+            ax.set_xlabel('Vector features', fontsize=30)
 
             for id, data in enumerate(images_data):
 
                 p_label = p_scene + '_' + str(images_indices[id])
 
                 if images_indices[id] == threshold_image_zone:
-                    plt.plot(data, label=p_label + " (threshold mean)", lw=4, color='red')
+                    ax.plot(data, label=p_label + " (threshold mean)", lw=4, color='red')
                 else:
-                    plt.plot(data, label=p_label)
+                    ax.plot(data, label=p_label)
 
-            plt.legend(bbox_to_anchor=(0.65, 0.98), loc=2, borderaxespad=0.2, fontsize=22)
+            plt.legend(bbox_to_anchor=(0.65, 0.98), loc=2, borderaxespad=0.2, fontsize=24)
 
             start_ylim, end_ylim = p_ylim
-            plt.ylim(start_ylim, end_ylim)
+            #ax.set_ylim(start_ylim, end_ylim)
 
             plot_name = p_scene + '_' + p_metric + '_' + str(p_step) + '_' + p_mode + '_' + str(p_norm) + '.png'
-            plt.savefig(plot_name)
+            plt.savefig(plot_name, facecolor=ax.get_facecolor())
 
 def main():
 

+ 16 - 0
fichiersSVD_light/Cuisine01/test_cut.py

@@ -0,0 +1,16 @@
+from PIL import Image
+import numpy as np
+
+image_path_noisy = 'cuisine01_00400.png'
+image_path_ref = 'cuisine01_01200.png'
+
+image_noisy = np.asarray(Image.open(image_path_noisy))
+image_ref = np.asarray(Image.open(image_path_ref))
+
+first_part = image_noisy[:, 0:400]
+second_part = image_ref[:, 400:800]
+
+final_image = Image.fromarray(np.concatenate((first_part, second_part), axis=1))
+
+final_image.show()
+

BIN
fichiersSVD_light/SdbDroite/sceneSDB_Droite.zip