Kaynağa Gözat

Merge pull request #426 from Borda/tests/add-gh-action

add GH action CPU tests
5.0
Glenn Jocher GitHub 4 yıl önce
ebeveyn
işleme
2efa01db0e
Veri tabanında bu imza için bilinen anahtar bulunamadı GPC Anahtar Kimliği: 4AEE18F83AFDEB23
4 değiştirilmiş dosya ile 89 ekleme ve 2 silme
  1. +2
    -0
      .gitattributes
  2. +81
    -0
      .github/workflows/ci-testing.yml
  3. +2
    -0
      README.md
  4. +4
    -2
      weights/download_weights.sh

+ 2
- 0
.gitattributes Dosyayı Görüntüle

@@ -0,0 +1,2 @@
# this drop notebooks from GitHub language stats
*.ipynb linguist-vendored

+ 81
- 0
.github/workflows/ci-testing.yml Dosyayı Görüntüle

@@ -0,0 +1,81 @@
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-latest] #, macOS-10.15, windows-2019
python-version: [3.7, 3.8]
yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"]

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 50
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')"
mv ./coco128 ../

- 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 test.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 1
# test custom
python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 1
# 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

+ 2
- 0
README.md Dosyayı Görüntüle

@@ -2,6 +2,8 @@
<img src="https://user-images.githubusercontent.com/26833433/82944393-f7644d80-9f4f-11ea-8b87-1a5b04f555f1.jpg" width="1000"></a>
&nbsp

![CI CPU testing](https://github.com/ultralytics/yolov5/workflows/CI%20CPU%20testing/badge.svg)

This repository represents Ultralytics open-source research into future object detection methods, and incorporates our lessons learned and best practices evolved over training thousands of models on custom client datasets with our previous YOLO repository https://github.com/ultralytics/yolov3. **All code and models are under active development, and are subject to modification or deletion without notice.** Use at your own risk.

<img src="https://user-images.githubusercontent.com/26833433/85340570-30360a80-b49b-11ea-87cf-bdf33d53ae15.png" width="1000">** GPU Speed measures end-to-end time per image averaged over 5000 COCO val2017 images using a V100 GPU with batch size 8, and includes image preprocessing, PyTorch FP16 inference, postprocessing and NMS.

+ 4
- 2
weights/download_weights.sh Dosyayı Görüntüle

@@ -1,8 +1,10 @@
#!/bin/bash
# Download common models

python3 -c "from utils.google_utils import *;
python -c "
from utils.google_utils import *;
attempt_download('weights/yolov5s.pt');
attempt_download('weights/yolov5m.pt');
attempt_download('weights/yolov5l.pt');
attempt_download('weights/yolov5x.pt')"
attempt_download('weights/yolov5x.pt')
"

Yükleniyor…
İptal
Kaydet