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.

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