Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

82 rindas
2.9KB

  1. name: CI CPU testing
  2. # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
  3. on: [push, pull_request]
  4. jobs:
  5. cpu-tests:
  6. runs-on: ${{ matrix.os }}
  7. strategy:
  8. fail-fast: false
  9. matrix:
  10. os: [ubuntu-latest] #, macOS-10.15, windows-2019
  11. python-version: [3.7, 3.8]
  12. yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"]
  13. # Timeout: https://stackoverflow.com/a/59076067/4521646
  14. timeout-minutes: 50
  15. steps:
  16. - uses: actions/checkout@v2
  17. - name: Set up Python ${{ matrix.python-version }}
  18. uses: actions/setup-python@v2
  19. with:
  20. python-version: ${{ matrix.python-version }}
  21. # Note: This uses an internal pip API and may not always work
  22. # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
  23. - name: Get pip cache
  24. id: pip-cache
  25. run: |
  26. python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
  27. - name: Cache pip
  28. uses: actions/cache@v1
  29. with:
  30. path: ${{ steps.pip-cache.outputs.dir }}
  31. key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
  32. restore-keys: |
  33. ${{ runner.os }}-${{ matrix.python-version }}-pip-
  34. - name: Install dependencies
  35. run: |
  36. python -m pip install --upgrade pip
  37. pip install -q numpy # for cocoapi proper install
  38. pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
  39. pip install -q onnx
  40. python --version
  41. pip --version
  42. pip list
  43. shell: bash
  44. - name: Download data
  45. run: |
  46. python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')"
  47. mv ./coco128 ../
  48. - name: Download weights
  49. run: |
  50. bash weights/download_weights.sh
  51. - name: Tests workflow
  52. run: |
  53. # to run *.py. files in subdirectories
  54. export PYTHONPATH="$PWD"
  55. # define device
  56. di=cpu # inference devices
  57. # train
  58. python train.py --weights weights/${{ matrix.yolo5-model }}.pt --cfg models/${{ matrix.yolo5-model }}.yaml --epochs 1 --img 320 --device $di --batch-size 2
  59. # detect official
  60. python detect.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di
  61. # detect custom
  62. python detect.py --weights runs/exp0/weights/last.pt --device $di
  63. # test official
  64. python eval.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 1
  65. # test custom
  66. python eval.py --weights runs/exp0/weights/last.pt --device $di --batch-size 1
  67. # inspect
  68. python models/yolo.py --cfg models/${{ matrix.yolo5-model }}.yaml
  69. # export
  70. python models/export.py --weights weights/${{ matrix.yolo5-model }}.pt --img 640 --batch 1
  71. shell: bash