選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

81 行
2.9KB

  1. name: CI CPU testing
  2. on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. # The branches below must be a subset of the branches above
  7. branches: [ master ]
  8. schedule:
  9. - cron: '0 0 * * *' # Runs at 00:00 UTC every day
  10. jobs:
  11. cpu-tests:
  12. runs-on: ${{ matrix.os }}
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. os: [ubuntu-latest, macos-latest, windows-latest]
  17. python-version: [3.8]
  18. model: ['yolov5s'] # models to test
  19. # Timeout: https://stackoverflow.com/a/59076067/4521646
  20. timeout-minutes: 50
  21. steps:
  22. - uses: actions/checkout@v2
  23. - name: Set up Python ${{ matrix.python-version }}
  24. uses: actions/setup-python@v2
  25. with:
  26. python-version: ${{ matrix.python-version }}
  27. # Note: This uses an internal pip API and may not always work
  28. # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
  29. - name: Get pip cache
  30. id: pip-cache
  31. run: |
  32. python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
  33. - name: Cache pip
  34. uses: actions/cache@v1
  35. with:
  36. path: ${{ steps.pip-cache.outputs.dir }}
  37. key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
  38. restore-keys: |
  39. ${{ runner.os }}-${{ matrix.python-version }}-pip-
  40. - name: Install dependencies
  41. run: |
  42. python -m pip install --upgrade pip
  43. pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
  44. pip install -q onnx
  45. python --version
  46. pip --version
  47. pip list
  48. shell: bash
  49. - name: Download data
  50. run: |
  51. # curl -L -o tmp.zip https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
  52. # unzip -q tmp.zip -d ../
  53. # rm tmp.zip
  54. - name: Tests workflow
  55. run: |
  56. # export PYTHONPATH="$PWD" # to run '$ python *.py' files in subdirectories
  57. di=cpu # inference devices # define device
  58. # train
  59. python train.py --img 128 --batch 16 --weights weights/${{ matrix.model }}.pt --cfg models/${{ matrix.model }}.yaml --epochs 1 --device $di
  60. # detect
  61. python detect.py --weights weights/${{ matrix.model }}.pt --device $di
  62. python detect.py --weights runs/train/exp/weights/last.pt --device $di
  63. # test
  64. python test.py --img 128 --batch 16 --weights weights/${{ matrix.model }}.pt --device $di
  65. python test.py --img 128 --batch 16 --weights runs/train/exp/weights/last.pt --device $di
  66. python hubconf.py # hub
  67. python models/yolo.py --cfg models/${{ matrix.model }}.yaml # inspect
  68. python models/export.py --img 128 --batch 1 --weights weights/${{ matrix.model }}.pt # export
  69. shell: bash