File size: 4,285 Bytes
24bea5e 2373c50 24bea5e 2373c50 94b2bb6 2373c50 5414e53 2373c50 5414e53 2373c50 b161edf 2373c50 94b2bb6 2373c50 94b2bb6 2373c50 7433d38 2373c50 94b2bb6 2373c50 ff8646c 2373c50 94b2bb6 a5a1760 2373c50 5414e53 2373c50 5414e53 2373c50 5414e53 d51f9b2 5414e53 2373c50 5414e53 7433d38 5414e53 2373c50 5414e53 a12698f ff8646c 2373c50 94705a9 2373c50 94705a9 2373c50 94705a9 2373c50 9a3da79 94705a9 2373c50 94705a9 2373c50 d490bdd 94705a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# YOLOv5 Continuous Integration (CI) GitHub Actions tests
name: YOLOv5 CI
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '0 0 * * *' # runs at 00:00 UTC every day
jobs:
Benchmarks:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
model: [yolov5n]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
#- name: Cache pip
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-Benchmarks-${{ hashFiles('requirements.txt') }}
# restore-keys: ${{ runner.os }}-Benchmarks-
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt coremltools openvino-dev tensorflow-cpu --extra-index-url https://download.pytorch.org/whl/cpu
python --version
pip --version
pip list
- name: Run benchmarks
run: |
python utils/benchmarks.py --weights ${{ matrix.model }}.pt --img 320
Tests:
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9]
model: [yolov5n]
include:
- os: ubuntu-latest
python-version: '3.7' # '3.6.8' min
model: yolov5n
- os: ubuntu-latest
python-version: '3.8'
model: yolov5n
- os: ubuntu-latest
python-version: '3.10'
model: yolov5n
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dir
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
python --version
pip --version
pip list
- name: Check environment
run: |
python -c "import utils; utils.notebook_init()"
echo "RUNNER_OS is $RUNNER_OS"
echo "GITHUB_EVENT_NAME is $GITHUB_EVENT_NAME"
echo "GITHUB_WORKFLOW is $GITHUB_WORKFLOW"
echo "GITHUB_ACTOR is $GITHUB_ACTOR"
- name: Run tests
shell: bash
run: |
# export PYTHONPATH="$PWD" # to run '$ python *.py' files in subdirectories
d=cpu # device
model=${{ matrix.model }}
best=runs/train/exp/weights/best.pt
# Train
python train.py --img 64 --batch 32 --weights $model.pt --cfg $model.yaml --epochs 1 --device $d
# Val
python val.py --img 64 --batch 32 --weights $model.pt --device $d
python val.py --img 64 --batch 32 --weights $best --device $d
# Detect
python detect.py --weights $model.pt --device $d
python detect.py --weights $best --device $d
python hubconf.py # hub
# Export
# python models/tf.py --weights $model.pt # build TF model
python models/yolo.py --cfg $model.yaml # build PyTorch model
python export.py --weights $model.pt --img 64 --include torchscript # export
# Python
python - <<EOF
import torch
model = torch.hub.load('.', 'custom', path='$model', source='local')
print(model('data/images/bus.jpg'))
model = torch.hub.load('.', 'custom', path='$best', source='local')
print(model('data/images/bus.jpg'))
EOF
|