Skip to content

Help Wanted: CI Automation Tools for Unit Tests #407

@glenn-jocher

Description

@glenn-jocher

🚀 Feature

Automated testing on every commit and on PRs to make sure that updates are not introducing bugs!

Motivation

Due to high demand and very limited resources, we are not able to manually test every commit and PR before merging with the master branch. This occasionally introduces bugs (!) which may be cloned by up to 1000 people per day currently. We need to reject problem commits and PRs before they make it into the master branch.

To solve this problem, and to better automate YOLOv5 development we want to use Continuous Integration (CI) tools (i.e. GitHub Actions) to automatically run unit tests on every new commit, and on PRs before merging.

One major challenge is requisitioning a suitable hardware backend on demand for this purpose. Our unit tests below require checking operations on train/test/detect combinations of multi-GPU, single-GPU and CPU.

git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -qr requirements.txt onnx
python3 -c "from utils.google_utils import *; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" && mv ./coco128 ../

export PYTHONPATH="$PWD" # to run *.py. files in subdirectories
for x in yolov5s yolov5m yolov5l yolov5x # models
do
  python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device 0,1  # train
  for di in 0,1 0 cpu # inference devices
  do
    python detect.py --weights $x.pt --device $di  # detect official
    python detect.py --weights runs/exp0/weights/last.pt --device $di  # detect custom
    python test.py --weights $x.pt --device $di # test official
    python test.py --weights runs/exp0/weights/last.pt --device $di # test custom
  done
  python models/yolo.py --cfg $x.yaml # inspect
  python models/export.py --weights $x.pt --img 640 --batch 1 # export
done

Alternatives

We already use Docker AutoBuild for image deployment. Docker AutoTest would seem to be a natural addition to this, but unfortunately we saw that this offers limited hardware constraints (i.e. <2GB RAM) unsuitable for running our tests, and no GPU availability either. https://docs.docker.com/docker-hub/builds/automated-testing/

Additional context

Anyone that is an expert in this area or has successfully implemented these tools in the past please let us know, as we need help here!!

Metadata

Metadata

Assignees

Labels

StaleStale and schedule for closing soonenhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions