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.

94 satır
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.9 ]
  19. model: [ 'yolov5n' ] # models to test
  20. # Timeout: https://stackoverflow.com/a/59076067/4521646
  21. timeout-minutes: 60
  22. steps:
  23. - uses: actions/checkout@v3
  24. - name: Set up Python ${{ matrix.python-version }}
  25. uses: actions/setup-python@v3
  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.7
  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 # wandb # extras
  47. python --version
  48. pip --version
  49. pip list
  50. shell: bash
  51. # - name: W&B login
  52. # run: wandb login 345011b3fb26dc8337fd9b20e53857c1d403f2aa
  53. # - name: Download data
  54. # run: |
  55. # curl -L -o tmp.zip https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
  56. # unzip -q tmp.zip -d ../datasets
  57. - name: Tests workflow
  58. run: |
  59. # export PYTHONPATH="$PWD" # to run '$ python *.py' files in subdirectories
  60. d=cpu # device
  61. weights=runs/train/exp/weights/best.pt
  62. # Train
  63. python train.py --img 64 --batch 32 --weights ${{ matrix.model }}.pt --cfg ${{ matrix.model }}.yaml --epochs 1 --device $d
  64. # Val
  65. python val.py --img 64 --batch 32 --weights ${{ matrix.model }}.pt --device $d
  66. python val.py --img 64 --batch 32 --weights $weights --device $d
  67. # Detect
  68. python detect.py --weights ${{ matrix.model }}.pt --device $d
  69. python detect.py --weights $weights --device $d
  70. python hubconf.py # hub
  71. # Export
  72. python models/yolo.py --cfg ${{ matrix.model }}.yaml # build PyTorch model
  73. python models/tf.py --weights ${{ matrix.model }}.pt # build TensorFlow model
  74. python export.py --weights ${{ matrix.model }}.pt --img 64 --include torchscript onnx # export
  75. # Python
  76. python - <<EOF
  77. import torch
  78. # model = torch.hub.load('ultralytics/yolov5', 'custom', path=$weights)
  79. EOF
  80. shell: bash