You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_infer.sh 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # Copyright 2020 Huawei Technologies Co., Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # ============================================================================
  16. if [ $# != 3 ]
  17. then
  18. echo "Ascend: sh run_infer.sh [PLATFORM] [DATASET_PATH] [CHECKPOINT_PATH]"
  19. exit 1
  20. fi
  21. # check dataset path
  22. if [ ! -d $2 ] && [ ! -f $2 ]
  23. then
  24. echo "error: DATASET_PATH=$2 is not a directory or file"
  25. exit 1
  26. fi
  27. # check checkpoint file
  28. if [ ! -f $3 ]
  29. then
  30. echo "error: CHECKPOINT_PATH=$3 is not a file"
  31. exit 1
  32. fi
  33. # set environment
  34. BASEPATH=$(cd "`dirname $0`" || exit; pwd)
  35. export PYTHONPATH=${BASEPATH}:$PYTHONPATH
  36. export DEVICE_ID=0
  37. export RANK_ID=0
  38. export RANK_SIZE=1
  39. if [ -d "../eval" ];
  40. then
  41. rm -rf ../eval
  42. fi
  43. mkdir ../eval
  44. cd ../eval || exit
  45. # luanch
  46. python ${BASEPATH}/../eval.py \
  47. --device_target=$1 \
  48. --dataset_path=$2 \
  49. --checkpoint_path=$3 \
  50. &> infer.log & # dataset val folder path