Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

91 Zeilen
3.4KB

  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@v1
  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. - name: Install dependencies
  42. run: |
  43. python -m pip install --upgrade pip
  44. pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
  45. pip install -q onnx tensorflow-cpu # for export
  46. python --version
  47. pip --version
  48. pip list
  49. shell: bash
  50. - name: Download data
  51. run: |
  52. # curl -L -o tmp.zip https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
  53. # unzip -q tmp.zip -d ../
  54. # rm tmp.zip
  55. - name: Tests workflow
  56. run: |
  57. # export PYTHONPATH="$PWD" # to run '$ python *.py' files in subdirectories
  58. di=cpu # device
  59. # Train
  60. python train.py --img 64 --batch 32 --weights ${{ matrix.model }}.pt --cfg ${{ matrix.model }}.yaml --epochs 1 --device $di
  61. # Val
  62. python val.py --img 64 --batch 32 --weights ${{ matrix.model }}.pt --device $di
  63. python val.py --img 64 --batch 32 --weights runs/train/exp/weights/last.pt --device $di
  64. # Detect
  65. python detect.py --weights ${{ matrix.model }}.pt --device $di
  66. python detect.py --weights runs/train/exp/weights/last.pt --device $di
  67. python hubconf.py # hub
  68. # Export
  69. python models/yolo.py --cfg ${{ matrix.model }}.yaml # build PyTorch model
  70. python models/tf.py --weights ${{ matrix.model }}.pt # build TensorFlow model
  71. python export.py --img 64 --batch 1 --weights ${{ matrix.model }}.pt --include torchscript onnx # export
  72. # Python
  73. python - <<EOF
  74. import torch
  75. # Known issue, urllib.error.HTTPError: HTTP Error 403: rate limit exceeded, will be resolved in torch==1.10.0
  76. # model = torch.hub.load('ultralytics/yolov5', 'custom', path='runs/train/exp/weights/last.pt')
  77. EOF
  78. shell: bash