generateAndTrainSVM.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #! bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need of vector size"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need of model output name"
  12. exit 1
  13. fi
  14. VECTOR_SIZE=$1
  15. INPUT_MODEL_NAME=$2
  16. # selection of six scenes
  17. scenes="A, B, C, D, E, G"
  18. for size in {"4","8","16","26","32","40"}; do
  19. start=0
  20. for counter in {0..4}; do
  21. end=$(($start+$size))
  22. if [ "$end" -gt "$VECTOR_SIZE" ]; then
  23. start=$(($VECTOR_SIZE-$size))
  24. end=$(($VECTOR_SIZE))
  25. fi
  26. for zones in {"1, 3, 7, 9","0, 2, 7, 8, 9","2, 6, 8, 10, 13, 15","1, 2, 4, 7, 9, 10, 13, 15"}; do
  27. zones_str="${zones//, /-}"
  28. for metric in {"lab","mscn"}; do
  29. for mode in {"svd","svdn","svdne"}; do
  30. FILENAME="data/data_${mode}_${metric}_N${size}_B${start}_E${end}_zones${zones_str}"
  31. MODEL_NAME="saved_models/${INPUT_MODEL_NAME}_${mode}_${metric}_N${size}_B${start}_E${end}_zones_${zones_str}"
  32. echo $FILENAME
  33. python generate_data_model.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --metric ${metric} --scenes "${scenes}" --zones "${zones}" --percent 1 --sep ';' --rowindex '0'
  34. python svm_model_train.py --data ${FILENAME}.train --output ${MODEL_NAME} &
  35. done
  36. done
  37. done
  38. start=$(($start+50))
  39. done
  40. done