Parcourir la source

Bash script added to run on maxwell

Jerome Buisine il y a 5 ans
Parent
commit
7e988211ec

+ 3 - 3
README.md

@@ -36,7 +36,7 @@ python generate_data_svm.py --output xxxx --interval 0,20  --kind svdne --scenes
 Parameters explained : 
 - **output** : filename of data (which will be split into two parts, *.train* and *.test* relative to your choices).
 - **interval** : the interval of data you want to use from SVD vector.
-- **kind** : kind of data ['svd', 'sdvn', 'sdvne']; not normalize, normalize vector only and normalize together.
+- **kind** : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.
 - **scenes** : scenes choice for training dataset.
 - **zones** : zones to take for training dataset.
 - **percent** : percent of data amount of zone to take (choose randomly) of zone
@@ -100,7 +100,7 @@ python predict_noisy_image.py --interval "x,x" --model 'saved_models/xxxx.joblib
 Parameters list :
 - **model** : mode file saved to use
 - **interval** : the interval of data you want to use from SVD vector.
-- **mode** : kind of data ['svd', 'sdvn', 'sdvne']; not normalize, normalize vector only and normalize together.
+- **mode** : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.
 - **limit_detection** : number of not noisy images found to stop and return threshold (integer).
 
 ### Display model performance information
@@ -120,7 +120,7 @@ python save_model_result_in_md.py --interval "xx,xx" --model saved_models/xxxx.j
 Parameters list :
 - **model** : mode file saved to use
 - **interval** : the interval of data you want to use from SVD vector.
-- **mode** : kind of data ['svd', 'sdvn', 'sdvne']; not normalize, normalize vector only and normalize together.
+- **mode** : kind of data ['svd', 'svdn', 'svdne']; not normalize, normalize vector only and normalize together.
 
 
 Markdown file is saved using model name into **models_info** folder.

+ 58 - 0
generateAndTrain_maxwell.sh

@@ -0,0 +1,58 @@
+#! bin/bash
+
+if [ -z "$1" ]
+  then
+    echo "No argument supplied"
+    echo "Need of vector size"
+    exit 1
+fi
+
+VECTOR_SIZE=$1
+
+# selection of four scenes (only maxwell)
+scenes="A, D, G, H"
+
+for size in {"4","8","16","26","32","40"}; do
+
+  half=$(($size/2))
+  start=-$half
+  for counter in {0..4}; do
+    end=$(($start+$size))
+
+    if [ "$end" -gt "$VECTOR_SIZE" ]; then
+        start=$(($VECTOR_SIZE-$size))
+        end=$(($VECTOR_SIZE))
+    fi
+
+    if [ "$start" -lt "0" ]; then
+        start=$((0))
+        end=$(($size))
+    fi
+
+    for nb_zones in {6,8,10,12,16}; do
+
+        for mode in {"svd","svdn","svdne"}; do
+
+            for model in {"svm_model","ensemble_model","ensemble_model_v2"}; do
+
+                FILENAME="data_svm/data_maxwell_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${mode}"
+                MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${mode}"
+
+                echo $FILENAME
+                python generate_data_svm_random.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --sep ';' --rowindex '0'
+                python models/${model}_train.py --data ${FILENAME}.train --output ${MODEL_NAME}
+                python predict_seuil_expe.py --interval "${start}, ${end}" --model "./saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --limit_detection '2'
+                python save_model_result_in_md.py --interval "${start}, ${end}" --model "./saved_models/${MODEL_NAME}.joblib" --mode "${mode}"
+            done
+        done
+    done
+
+    if [ "$counter" -eq "0" ]; then
+        start=$(($start+50-$half))
+    else 
+        start=$(($start+50))
+    fi
+
+  done
+
+done

predict_noisy_image_sdv_lab.py → predict_noisy_image_svd_lab.py


+ 1 - 1
predict_seuil_expe.py

@@ -119,7 +119,7 @@ def main():
                     tmp_file_path = tmp_filename.replace('__model__', '_' + p_model_file.split('/')[1])
                     block.save(tmp_file_path)
 
-                    python_cmd = "python predict_noisy_image_sdv_lab.py --image " + tmp_file_path + \
+                    python_cmd = "python predict_noisy_image_svd_lab.py --image " + tmp_file_path + \
                                     " --interval '" + p_interval + \
                                     "' --model " + p_model_file  + \
                                     " --mode " + p_mode

+ 3 - 3
save_model_result_in_md.py

@@ -22,17 +22,17 @@ def main():
 
     if len(sys.argv) <= 1:
         print('Run with default parameters...')
-        print('python save_model_result_in_md.py --interval "0,20" --model path/to/xxxx.joblib --mode ["svdn", "svdne"]')
+        print('python save_model_result_in_md.py --interval "0,20" --model path/to/xxxx.joblib --mode ["svd", "svdn", "svdne"]')
         sys.exit(2)
     try:
         opts, args = getopt.getopt(sys.argv[1:], "ht:m:o:l", ["help=", "interval=", "model=", "mode="])
     except getopt.GetoptError:
         # print help information and exit:
-        print('python save_model_result_in_md.py --interval "xx,xx" --model path/to/xxxx.joblib --mode ["svdn", "svdne"]')
+        print('python save_model_result_in_md.py --interval "xx,xx" --model path/to/xxxx.joblib --mode ["svd", "svdn", "svdne"]')
         sys.exit(2)
     for o, a in opts:
         if o == "-h":
-            print('python save_model_result_in_md.py --interval "xx,xx" --model path/to/xxxx.joblib --mode ["svdn", "svdne"]')
+            print('python save_model_result_in_md.py --interval "xx,xx" --model path/to/xxxx.joblib --mode ["svd", "svdn", "svdne"]')
             sys.exit()
         elif o in ("-t", "--interval"):
             p_interval = list(map(int, a.split(',')))