File size: 2,918 Bytes
94b2bb6
 
 
 
 
 
a0fa5f5
94b2bb6
 
 
 
 
5b46305
94b2bb6
7d8e2dd
94b2bb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d8e2dd
94b2bb6
7d8e2dd
94b2bb6
 
 
a79633a
1a503f3
a79633a
1a503f3
94b2bb6
 
 
 
 
f0d1e09
 
 
7d8e2dd
 
 
f0d1e09
94b2bb6
7d8e2dd
94b2bb6
da6c7ce
 
 
7d8e2dd
 
 
 
 
 
 
 
eac0dbc
7d8e2dd
eac0dbc
7d8e2dd
 
 
 
94b2bb6
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
name: CI CPU testing

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: [push, pull_request]

jobs:
  cpu-tests:

    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-18.04, macOS-10.15]  #, windows-2019
        python-version: [3.7, 3.8]
        yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"]

    # Timeout: https://stackoverflow.com/a/59076067/4521646
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    # Note: This uses an internal pip API and may not always work
    # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
    - name: Get pip cache
      id: pip-cache
      run: |
        python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"

    - name: Cache pip
      uses: actions/cache@v1
      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 dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -q numpy  # for cocoapi proper install
        pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
        pip install -q onnx
        python --version
        pip --version
        pip list
      shell: bash

    - name: Download data
      run: |
        python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')"

    - name: Download weights
      run: |
        bash weights/download_weights.sh

    - name: Tests workflow
      run: |
        # to run *.py. files in subdirectories
        export PYTHONPATH="$PWD"
        # define device
        di=cpu # inference devices
        # train
        python train.py --weights weights/${{ matrix.yolo5-model }}.pt --cfg models/${{ matrix.yolo5-model }}.yaml --epochs 1 --img 320 --device $di --batch-size 2
        # detect official
        python detect.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di
        # detect custom
        python detect.py --weights runs/exp0/weights/last.pt --device $di
        # test official
        python eval.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 2
        # test custom
        python eval.py --weights runs/exp0/weights/last.pt --device $di  --batch-size 2
        # inspect
        python models/yolo.py --cfg models/${{ matrix.yolo5-model }}.yaml
        # export
        python models/export.py --weights weights/${{ matrix.yolo5-model }}.pt --img 640 --batch 1
      shell: bash