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

53 lines
1.8 KiB

6 years ago
  1. #!/bin/bash
  2. # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
  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. # Script to download pycocotools and make package for CMLE jobs.
  17. #
  18. # usage:
  19. # bash object_detection/dataset_tools/create_pycocotools_package.sh \
  20. # /tmp/pycocotools
  21. set -e
  22. if [ -z "$1" ]; then
  23. echo "usage create_pycocotools_package.sh [output dir]"
  24. exit
  25. fi
  26. # Create the output directory.
  27. OUTPUT_DIR="${1%/}"
  28. SCRATCH_DIR="${OUTPUT_DIR}/raw"
  29. mkdir -p "${OUTPUT_DIR}"
  30. mkdir -p "${SCRATCH_DIR}"
  31. cd ${SCRATCH_DIR}
  32. git clone https://github.com/cocodataset/cocoapi.git
  33. cd cocoapi/PythonAPI && mv ../common ./
  34. sed "s/\.\.\/common/common/g" setup.py > setup.py.updated
  35. cp -f setup.py.updated setup.py
  36. rm setup.py.updated
  37. sed "s/\.\.\/common/common/g" pycocotools/_mask.pyx > _mask.pyx.updated
  38. cp -f _mask.pyx.updated pycocotools/_mask.pyx
  39. rm _mask.pyx.updated
  40. sed "s/import matplotlib\.pyplot as plt/import matplotlib\nmatplotlib\.use\(\'Agg\'\)\nimport matplotlib\.pyplot as plt/g" pycocotools/coco.py > coco.py.updated
  41. cp -f coco.py.updated pycocotools/coco.py
  42. rm coco.py.updated
  43. cd "${OUTPUT_DIR}"
  44. tar -czf pycocotools-2.0.tar.gz -C "${SCRATCH_DIR}/cocoapi/" PythonAPI/
  45. rm -rf ${SCRATCH_DIR}