prepare.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. source test_tipc/common_func.sh
  3. set -o errexit
  4. set -o nounset
  5. FILENAME=$1
  6. # $MODE must be one of ('lite_train_lite_infer' 'lite_train_whole_infer' 'whole_train_whole_infer', 'whole_infer')
  7. MODE=$2
  8. dataline=$(cat ${FILENAME})
  9. # Parse params
  10. IFS=$'\n'
  11. lines=(${dataline})
  12. task_name=$(parse_first_value "${lines[1]}")
  13. model_name=$(parse_second_value "${lines[1]}")
  14. # Download pretrained weights
  15. if [ ${MODE} = 'whole_infer' ]; then
  16. :
  17. fi
  18. # Download datasets
  19. DATA_DIR='./test_tipc/data/'
  20. mkdir -p "${DATA_DIR}"
  21. if [[ ${MODE} == 'lite_train_lite_infer' \
  22. || ${MODE} == 'lite_train_whole_infer' \
  23. || ${MODE} == 'whole_infer' ]]; then
  24. if [[ ${task_name} == 'cd' ]]; then
  25. download_and_unzip_dataset "${DATA_DIR}" airchange https://paddlers.bj.bcebos.com/datasets/airchange.zip
  26. elif [[ ${task_name} == 'clas' ]]; then
  27. download_and_unzip_dataset "${DATA_DIR}" ucmerced https://paddlers.bj.bcebos.com/datasets/ucmerced.zip
  28. elif [[ ${task_name} == 'det' ]]; then
  29. download_and_unzip_dataset "${DATA_DIR}" sarship https://paddlers.bj.bcebos.com/datasets/sarship.zip
  30. elif [[ ${task_name} == 'res' ]]; then
  31. download_and_unzip_dataset "${DATA_DIR}" rssr https://paddlers.bj.bcebos.com/datasets/rssr_mini.zip
  32. elif [[ ${task_name} == 'seg' ]]; then
  33. download_and_unzip_dataset "${DATA_DIR}" rsseg https://paddlers.bj.bcebos.com/datasets/rsseg_rgb.zip
  34. fi
  35. elif [[ ${MODE} == 'whole_train_whole_infer' ]]; then
  36. if [[ ${task_name} == 'cd' ]]; then
  37. rm -rf "${DATA_DIR}/levircd"
  38. download_and_unzip_dataset "${DATA_DIR}" raw_levircd https://paddlers.bj.bcebos.com/datasets/raw/LEVIR-CD.zip \
  39. && python tools/prepare_dataset/prepare_levircd.py \
  40. --in_dataset_dir "${DATA_DIR}/raw_levircd" \
  41. --out_dataset_dir "${DATA_DIR}/levircd" \
  42. --crop_size 256 \
  43. --crop_stride 256
  44. elif [[ ${task_name} == 'clas' ]]; then
  45. download_and_unzip_dataset "${DATA_DIR}" ucmerced https://paddlers.bj.bcebos.com/datasets/ucmerced.zip
  46. elif [[ ${task_name} == 'det' ]]; then
  47. rm -rf "${DATA_DIR}/rsod"
  48. download_and_unzip_dataset "${DATA_DIR}" raw_rsod https://paddlers.bj.bcebos.com/datasets/raw/RSOD.zip
  49. python tools/prepare_dataset/prepare_rsod.py \
  50. --in_dataset_dir "${DATA_DIR}/raw_rsod" \
  51. --out_dataset_dir "${DATA_DIR}/rsod" \
  52. --seed 114514
  53. elif [[ ${task_name} == 'res' ]]; then
  54. download_and_unzip_dataset "${DATA_DIR}" rssr https://paddlers.bj.bcebos.com/datasets/rssr.zip
  55. elif [[ ${task_name} == 'seg' ]]; then
  56. download_and_unzip_dataset "${DATA_DIR}" rsseg https://paddlers.bj.bcebos.com/datasets/rsseg_rgb.zip
  57. fi
  58. fi