prepare.sh 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. source test_tipc/utils_func.sh
  3. FILENAME=$1
  4. # MODE be one of ['lite_train_lite_infer' 'lite_train_whole_infer'
  5. # 'whole_train_whole_infer', 'whole_infer', 'klquant_whole_infer',
  6. # 'cpp_infer', 'serving_infer', 'lite_infer']
  7. MODE=$2
  8. # parse params
  9. dataline=$(cat ${FILENAME})
  10. IFS=$'\n'
  11. lines=(${dataline})
  12. # The training params
  13. model_name=$(func_parser_value "${lines[1]}")
  14. python=$(func_parser_value "${lines[2]}")
  15. if [ ${MODE} = "whole_train_whole_infer" ];then
  16. mv ./dataset/coco/download_coco.py . && rm -rf ./dataset/coco/* && mv ./download_coco.py ./dataset/coco/
  17. # prepare whole training data
  18. eval "${python} ./dataset/coco/download_coco.py"
  19. elif [ ${MODE} = "cpp_infer" ];then
  20. # download coco lite data
  21. wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/tipc/coco_tipc.tar
  22. cd ./dataset/coco/ && tar -xvf coco_tipc.tar && mv -n coco_tipc/* .
  23. rm -rf coco_tipc/ && cd ../../
  24. # download wider_face lite data
  25. wget -nc -P ./dataset/wider_face/ https://paddledet.bj.bcebos.com/data/tipc/wider_tipc.tar
  26. cd ./dataset/wider_face/ && tar -xvf wider_tipc.tar && mv -n wider_tipc/* .
  27. rm -rf wider_tipc/ && cd ../../
  28. # download spine lite data
  29. wget -nc -P ./dataset/spine_coco/ https://paddledet.bj.bcebos.com/data/tipc/spine_tipc.tar
  30. cd ./dataset/spine_coco/ && tar -xvf spine_tipc.tar && mv -n spine_tipc/* .
  31. rm -rf spine_tipc/ && cd ../../
  32. if [[ ${model_name} =~ "s2anet" ]]; then
  33. cd ./ppdet/ext_op && eval "${python} setup.py install"
  34. cd ../../
  35. fi
  36. # download mot lite data
  37. wget -nc -P ./dataset/mot/ https://paddledet.bj.bcebos.com/data/tipc/mot_tipc.tar
  38. cd ./dataset/mot/ && tar -xvf mot_tipc.tar && mv -n mot_tipc/* .
  39. rm -rf mot_tipc/ && cd ../../
  40. opencv_dir=$(func_parser_value "${lines[15]}")
  41. # prepare opencv
  42. cd ./deploy/cpp
  43. if [ ${opencv_dir} = "default" ] || [ ${opencv_dir} = "null" ]; then
  44. if [ -d "deps/opencv-3.4.16_gcc8.2_ffmpeg/" ]; then
  45. echo "################### Opencv already exists, skip downloading. ###################"
  46. else
  47. mkdir -p $(pwd)/deps && cd $(pwd)/deps
  48. wget -c https://paddledet.bj.bcebos.com/data/opencv-3.4.16_gcc8.2_ffmpeg.tar.gz
  49. tar -xvf opencv-3.4.16_gcc8.2_ffmpeg.tar.gz && cd ../
  50. echo "################### Finish downloading opencv. ###################"
  51. fi
  52. fi
  53. cd ../../
  54. elif [ ${MODE} = "benchmark_train" ];then
  55. pip install -U pip Cython
  56. pip install -r requirements.txt
  57. # prepare lite benchmark coco data
  58. wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/coco_benchmark.tar
  59. cd ./dataset/coco/ && tar -xvf coco_benchmark.tar && mv -u coco_benchmark/* .
  60. rm -rf coco_benchmark/ && cd ../../
  61. # prepare lite benchmark mot data
  62. wget -nc -P ./dataset/mot/ https://paddledet.bj.bcebos.com/data/mot_benchmark.tar
  63. cd ./dataset/mot/ && tar -xvf mot_benchmark.tar && mv -u mot_benchmark/* .
  64. rm -rf mot_benchmark/ && cd ../../
  65. else
  66. # download coco lite data
  67. wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/tipc/coco_tipc.tar
  68. cd ./dataset/coco/ && tar -xvf coco_tipc.tar && mv -n coco_tipc/* .
  69. rm -rf coco_tipc/ && cd ../../
  70. # download wider_face lite data
  71. wget -nc -P ./dataset/wider_face/ https://paddledet.bj.bcebos.com/data/tipc/wider_tipc.tar
  72. cd ./dataset/wider_face/ && tar -xvf wider_tipc.tar && mv -n wider_tipc/* .
  73. rm -rf wider_tipc/ && cd ../../
  74. # download spine_coco lite data
  75. wget -nc -P ./dataset/spine_coco/ https://paddledet.bj.bcebos.com/data/tipc/spine_tipc.tar
  76. cd ./dataset/spine_coco/ && tar -xvf spine_tipc.tar && mv -n spine_tipc/* .
  77. rm -rf spine_tipc/ && cd ../../
  78. if [[ ${model_name} =~ "s2anet" ]]; then
  79. cd ./ppdet/ext_op && eval "${python} setup.py install"
  80. cd ../../
  81. fi
  82. # download mot lite data
  83. wget -nc -P ./dataset/mot/ https://paddledet.bj.bcebos.com/data/tipc/mot_tipc.tar
  84. cd ./dataset/mot/ && tar -xvf mot_tipc.tar && mv -n mot_tipc/* .
  85. rm -rf mot_tipc/ && cd ../../
  86. fi