Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

92 lines
3.5KB

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