generateAndTrain_maxwell_custom.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #! bin/bash
  2. # result file name
  3. result_file_path="results/models_comparisons.csv"
  4. # selection of four scenes (only maxwell)
  5. scenes="A,D,G,H"
  6. # only one model for the moment
  7. model="rfe_svm_model"
  8. # check feature param
  9. if [ -z "$1" ]
  10. then
  11. echo "No argument supplied"
  12. echo "Need of feature information"
  13. exit 1
  14. fi
  15. # accept feature param
  16. feature=$1
  17. if [ -z "$2" ]
  18. then
  19. echo "No argument supplied"
  20. echo "Need of kind of data to use"
  21. exit 1
  22. fi
  23. feature=$1
  24. data=$2
  25. # get size depends on feature
  26. declare -A featuresSize
  27. featuresSize=( ["filters_statistics"]="26" ["svd"]="200" ["filters_statistics_sobel"]="27" ["svd_sobel"]="201")
  28. size=${featuresSize[${feature}]}
  29. # interval of data
  30. start=0
  31. end=$size
  32. for nb_zones in {10,11,12}; do
  33. for mode in {"svd","svdn","svdne"}; do
  34. FILENAME="data/${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}"
  35. MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}"
  36. CUSTOM_MIN_MAX_FILENAME="N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}_min_max"
  37. # echo $FILENAME
  38. # only compute if necessary (perhaps server will fall.. Just in case)
  39. if grep -q "${MODEL_NAME}" "${result_file_path}"; then
  40. echo "${MODEL_NAME} results already generated..."
  41. else
  42. python generate/generate_data_model_random_${data}.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --feature ${feature} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 10 --random 1 --custom ${CUSTOM_MIN_MAX_FILENAME}
  43. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  44. python others/save_model_result.py --data ${FILENAME} --model "saved_models/${MODEL_NAME}.joblib" --choice ${model} --feature ${feature} --mode ${mode} --zones ${nb_zones}
  45. fi
  46. done
  47. done