glenn-jocher commited on
Commit
2efa01d
·
unverified ·
2 Parent(s): 87475c0 e8ea772

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

Browse files
.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # this drop notebooks from GitHub language stats
2
+ *.ipynb linguist-vendored
.github/workflows/ci-testing.yml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI CPU testing
2
+
3
+ # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
4
+ on: [push, pull_request]
5
+
6
+ jobs:
7
+ cpu-tests:
8
+
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest] #, macOS-10.15, windows-2019
14
+ python-version: [3.7, 3.8]
15
+ yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"]
16
+
17
+ # Timeout: https://stackoverflow.com/a/59076067/4521646
18
+ timeout-minutes: 50
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v2
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ # Note: This uses an internal pip API and may not always work
27
+ # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
28
+ - name: Get pip cache
29
+ id: pip-cache
30
+ run: |
31
+ python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
32
+
33
+ - name: Cache pip
34
+ uses: actions/cache@v1
35
+ with:
36
+ path: ${{ steps.pip-cache.outputs.dir }}
37
+ key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
38
+ restore-keys: |
39
+ ${{ runner.os }}-${{ matrix.python-version }}-pip-
40
+
41
+ - name: Install dependencies
42
+ run: |
43
+ python -m pip install --upgrade pip
44
+ pip install -q numpy # for cocoapi proper install
45
+ pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
46
+ pip install -q onnx
47
+ python --version
48
+ pip --version
49
+ pip list
50
+ shell: bash
51
+
52
+ - name: Download data
53
+ run: |
54
+ python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')"
55
+ mv ./coco128 ../
56
+
57
+ - name: Download weights
58
+ run: |
59
+ bash weights/download_weights.sh
60
+
61
+ - name: Tests workflow
62
+ run: |
63
+ # to run *.py. files in subdirectories
64
+ export PYTHONPATH="$PWD"
65
+ # define device
66
+ di=cpu # inference devices
67
+ # train
68
+ python train.py --weights weights/${{ matrix.yolo5-model }}.pt --cfg models/${{ matrix.yolo5-model }}.yaml --epochs 1 --img 320 --device $di --batch-size 2
69
+ # detect official
70
+ python detect.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di
71
+ # detect custom
72
+ python detect.py --weights runs/exp0/weights/last.pt --device $di
73
+ # test official
74
+ python test.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 1
75
+ # test custom
76
+ python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 1
77
+ # inspect
78
+ python models/yolo.py --cfg models/${{ matrix.yolo5-model }}.yaml
79
+ # export
80
+ python models/export.py --weights weights/${{ matrix.yolo5-model }}.pt --img 640 --batch 1
81
+ shell: bash
README.md CHANGED
@@ -2,6 +2,8 @@
2
  <img src="https://user-images.githubusercontent.com/26833433/82944393-f7644d80-9f4f-11ea-8b87-1a5b04f555f1.jpg" width="1000"></a>
3
  &nbsp
4
 
 
 
5
  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.
6
 
7
  <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.
 
2
  <img src="https://user-images.githubusercontent.com/26833433/82944393-f7644d80-9f4f-11ea-8b87-1a5b04f555f1.jpg" width="1000"></a>
3
  &nbsp
4
 
5
+ ![CI CPU testing](https://github.com/ultralytics/yolov5/workflows/CI%20CPU%20testing/badge.svg)
6
+
7
  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.
8
 
9
  <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.
weights/download_weights.sh CHANGED
@@ -1,8 +1,10 @@
1
  #!/bin/bash
2
  # Download common models
3
 
4
- python3 -c "from utils.google_utils import *;
 
5
  attempt_download('weights/yolov5s.pt');
6
  attempt_download('weights/yolov5m.pt');
7
  attempt_download('weights/yolov5l.pt');
8
- attempt_download('weights/yolov5x.pt')"
 
 
1
  #!/bin/bash
2
  # Download common models
3
 
4
+ python -c "
5
+ from utils.google_utils import *;
6
  attempt_download('weights/yolov5s.pt');
7
  attempt_download('weights/yolov5m.pt');
8
  attempt_download('weights/yolov5l.pt');
9
+ attempt_download('weights/yolov5x.pt')
10
+ "