Parcourir la source

Update of simulation script for keras models

Jérôme BUISINE il y a 5 ans
Parent
commit
8a42eb5742

+ 5 - 1
generate_data_model_corr_random.py

@@ -56,6 +56,7 @@ def construct_new_line(path_seuil, indices, line, choice, norm):
     line_data = np.array(line.split(';'))
     seuil = line_data[0]
     metrics = line_data[indices]
+    metrics = metrics.astype('float32')
 
     # TODO : check if it's always necessary to do that (loss of information for svd)
     if norm:
@@ -368,8 +369,11 @@ def main():
             os.makedirs(custom_min_max_folder)
 
         min_max_folder_path = os.path.join(os.path.dirname(__file__), custom_min_max_folder)
-        min_max_filename_path = os.path.join(min_max_folder_path, p_custom)
 
+        min_max_current_filename = p_filename.replace(cfg.output_data_folder + '/', '').replace('deep_keras_', '') + min_max_filename
+        min_max_filename_path = os.path.join(min_max_folder_path, min_max_current_filename)
+
+        print(min_max_filename_path)
         with open(min_max_filename_path, 'w') as f:
             f.write(str(min_value_interval) + '\n')
             f.write(str(max_value_interval) + '\n')

+ 1 - 1
modules/utils/config.py

@@ -37,5 +37,5 @@ zones_indices                   = np.arange(16)
 
 metric_choices_labels           = ['lab', 'mscn', 'low_bits_2', 'low_bits_3', 'low_bits_4', 'low_bits_5', 'low_bits_6','low_bits_4_shifted_2', 'sub_blocks_stats', 'sub_blocks_area', 'sub_blocks_stats_reduced', 'sub_blocks_area_normed', 'mscn_var_4', 'mscn_var_16', 'mscn_var_64', 'mscn_var_16_max', 'mscn_var_64_max']
 
-keras_epochs                    = 500
+keras_epochs                    = 10
 keras_batch                     = 32

+ 5 - 5
run_maxwell_simulation_keras_corr_custom.sh

@@ -4,7 +4,7 @@
 simulate_models="simulate_models_keras_corr.csv"
 
 start_index=0
-end_index=24
+size=24
 
 # selection of four scenes (only maxwell)
 scenes="A, D, G, H"
@@ -20,20 +20,20 @@ for label in {"0","1"}; do
                     MODEL_NAME="deep_keras_N${size}_B${start_index}_E${size}_nb_zones_${nb_zones}_${metric}_${mode}_corr_L${label}_H${highest}"
 
 
-                    CUSTOM_MIN_MAX_FILENAME="N${size}_B${start_index}_E${end_index}_nb_zones_${nb_zones}_${metric}_${mode}_corr_L${label}_H${highest}_min_max"
+                    CUSTOM_MIN_MAX_FILENAME="N${size}_B${start_index}_E${size}_nb_zones_${nb_zones}_${metric}_${mode}_corr_L${label}_H${highest}_min_max_values"
 
                     echo ${MODEL_NAME}
 
                     if grep -xq "${MODEL_NAME}" "${simulate_models}"; then
                         echo "Run simulation for model ${MODEL_NAME}"
 
-                        python generate_data_model_corr_random.py --output ${FILENAME} --n ${size} --highest ${highest} --label ${label} --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 10 --random 1
+                        python generate_data_model_corr_random.py --output ${FILENAME} --n ${size} --highest ${highest} --label ${label} --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 10 --random 1 --custom 1
 
                         python deep_network_keras_svd.py --data ${FILENAME} --output ${MODEL_NAME} --size ${size}
 
-                        python predict_seuil_expe_maxwell_curve.py --interval "${start_index},${end_index}" --model "saved_models/${MODEL_NAME}.json" --mode "${mode}" --metric ${metric} --limit_detection '2' --custom ${CUSTOM_MIN_MAX_FILENAME}
+                        python predict_seuil_expe_maxwell_curve.py --interval "${start_index},${size}" --model "saved_models/${MODEL_NAME}.json" --mode "${mode}" --metric ${metric} --limit_detection '2' --custom ${CUSTOM_MIN_MAX_FILENAME}
 
-                        python save_model_result_in_md_maxwell.py --interval "${start_index},${end_index}" --model "saved_models/${MODEL_NAME}.json" --mode "${mode}" --metric ${metric}
+                        python save_model_result_in_md_maxwell.py --interval "${start_index},${size}" --model "saved_models/${MODEL_NAME}.json" --mode "${mode}" --metric ${metric}
 
                     fi
                 done