From 94b2bb68cc5f38a9786cd1143189b9769dfefe9b Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 09:35:48 +0200 Subject: [PATCH 01/28] add GH action tests --- .github/workflows/ci-testing.yml | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/ci-testing.yml diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml new file mode 100644 index 0000000..76e14b0 --- /dev/null +++ b/.github/workflows/ci-testing.yml @@ -0,0 +1,65 @@ +name: CI CPU testing + +# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows +on: [push, pull_request] + +jobs: + pytest: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, windows-2019, macOS-10.15] + python-version: [3.7, 3.8] + + # 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 }}-${{ matrix.requires }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip- + + - name: Install dependencies + run: | + # python -m pip install --upgrade --user pip + pip install -qr requirements.txt onnx + python --version + pip --version + pip list + shell: bash + + - name: Download data + run: | + python3 -c "from utils.google_utils import *; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" && mv ./coco128 ../ + + - name: Tests + run: | + 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 + di=cpu # inference devices + 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 + python models/yolo.py --cfg $x.yaml # inspect + python models/export.py --weights $x.pt --img 640 --batch 1 # export + done + shell: bash From a0fa5f5efee77273a3f53415ed721e0fee37f790 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 09:44:53 +0200 Subject: [PATCH 02/28] requirements --- .github/workflows/ci-testing.yml | 5 +++-- requirements.txt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 76e14b0..e35d320 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -4,7 +4,7 @@ name: CI CPU testing on: [push, pull_request] jobs: - pytest: + cpu-tests: runs-on: ${{ matrix.os }} strategy: @@ -39,7 +39,8 @@ jobs: - name: Install dependencies run: | # python -m pip install --upgrade --user pip - pip install -qr requirements.txt onnx + pip install -qr requirements.txt + pip install -qr onnx python --version pip --version pip list diff --git a/requirements.txt b/requirements.txt index 0deceac..d6895ef 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,13 @@ # pip install -U -r requirements.txt Cython -numpy==1.17.3 +numpy>=1.17.3 opencv-python torch>=1.5.1 matplotlib pillow tensorboard PyYAML>=5.3 -torchvision +torchvision>=0.6 scipy tqdm git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI From 1a503f3e08ff6e5373c6549ae7506a5d0a846c9b Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 09:46:56 +0200 Subject: [PATCH 03/28] requirements --- .github/workflows/ci-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index e35d320..a3bed90 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -39,8 +39,9 @@ jobs: - name: Install dependencies run: | # python -m pip install --upgrade --user pip + pip install -q numpy # for cocoapi proper install pip install -qr requirements.txt - pip install -qr onnx + pip install -q onnx python --version pip --version pip list From a79633a876eab6e32442179e995c76eefaa5394e Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 09:50:13 +0200 Subject: [PATCH 04/28] requirements --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index a3bed90..65520b5 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -38,9 +38,9 @@ jobs: - name: Install dependencies run: | - # python -m pip install --upgrade --user pip + python -m pip install --upgrade pip pip install -q numpy # for cocoapi proper install - pip install -qr requirements.txt + pip install -qr requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html pip install -q onnx python --version pip --version From 5b46305dab4848a5b9ae5838129e8c718411b1be Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 10:29:21 +0200 Subject: [PATCH 05/28] fix tests --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 65520b5..660efe8 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, windows-2019, macOS-10.15] + os: [ubuntu-18.04, macOS-10.15] #, windows-2019 python-version: [3.7, 3.8] # Timeout: https://stackoverflow.com/a/59076067/4521646 @@ -55,8 +55,8 @@ jobs: run: | 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 di=cpu # inference devices + python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device $di # train 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 From 613b9d6d98c46985b129fc4f53fc43afbfa7e6c0 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 10:33:43 +0200 Subject: [PATCH 06/28] add badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index df4060b..c80b139 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@   +![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. ** 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. From 3bf77ca180ddaff0bba1caebfd5687489a53c565 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 11:16:12 +0200 Subject: [PATCH 07/28] lower batch-size --- .github/workflows/ci-testing.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 660efe8..659cb49 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -47,21 +47,28 @@ jobs: pip list shell: bash - - name: Download data - run: | - python3 -c "from utils.google_utils import *; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" && mv ./coco128 ../ + #- name: Download data + # run: | + # python3 -c "from utils.google_utils import *; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" && mv ./coco128 ../ - name: Tests run: | for x in yolov5s yolov5m yolov5l yolov5x # models do di=cpu # inference devices - python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device $di # train - 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 - python models/yolo.py --cfg $x.yaml # inspect - python models/export.py --weights $x.pt --img 640 --batch 1 # export + # train + python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device $di --batch-size 2 + # detect official + python detect.py --weights $x.pt --device $di --batch-size 2 + # detect custom + python detect.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 + # test official + python test.py --weights $x.pt --device $di --batch-size 2 + # test custom + python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 + # inspect + python models/yolo.py --cfg $x.yaml + # export + python models/export.py --weights $x.pt --img 640 --batch 1 done shell: bash From f0d1e099e247f6c06b02d4f7b4bd776c3af0a5f1 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 11:45:17 +0200 Subject: [PATCH 08/28] weights --- .github/workflows/ci-testing.yml | 19 ++++++++++--------- data/coco128.yaml | 4 ++-- weights/download_weights.sh | 6 ++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 659cb49..2100c1d 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -47,28 +47,29 @@ jobs: pip list shell: bash - #- name: Download data - # run: | - # python3 -c "from utils.google_utils import *; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" && mv ./coco128 ../ + - name: Download data + run: | + python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" + bash weights/download_weights.sh - name: Tests run: | - for x in yolov5s yolov5m yolov5l yolov5x # models + for name in yolov5s yolov5m yolov5l yolov5x # models do di=cpu # inference devices # train - python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device $di --batch-size 2 + python train.py --weights weights/$name.pt --cfg models/$name.yaml --epochs 1 --img 320 --device $di --batch-size 2 # detect official - python detect.py --weights $x.pt --device $di --batch-size 2 + python detect.py --weights weights/$name.pt --device $di --batch-size 2 # detect custom python detect.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 # test official - python test.py --weights $x.pt --device $di --batch-size 2 + python test.py --weights weights/$name.pt --device $di --batch-size 2 # test custom python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 # inspect - python models/yolo.py --cfg $x.yaml + python models/yolo.py --cfg models/$name.yaml # export - python models/export.py --weights $x.pt --img 640 --batch 1 + python models/export.py --weights weights/$name.pt --img 640 --batch 1 done shell: bash diff --git a/data/coco128.yaml b/data/coco128.yaml index 9f47382..d5835c6 100644 --- a/data/coco128.yaml +++ b/data/coco128.yaml @@ -8,8 +8,8 @@ # train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/] -train: ../coco128/images/train2017/ # 128 images -val: ../coco128/images/train2017/ # 128 images +train: coco128/images/train2017/ # 128 images +val: coco128/images/train2017/ # 128 images # number of classes nc: 80 diff --git a/weights/download_weights.sh b/weights/download_weights.sh index 6834ddb..206b700 100755 --- a/weights/download_weights.sh +++ b/weights/download_weights.sh @@ -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') +" From 3e6868d31840114aca250642fefc5899496bc2d0 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 11:49:28 +0200 Subject: [PATCH 09/28] args --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 2100c1d..0369670 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -60,9 +60,9 @@ jobs: # train python train.py --weights weights/$name.pt --cfg models/$name.yaml --epochs 1 --img 320 --device $di --batch-size 2 # detect official - python detect.py --weights weights/$name.pt --device $di --batch-size 2 + python detect.py --weights weights/$name.pt --device $di # detect custom - python detect.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 + python detect.py --weights runs/exp0/weights/last.pt --device $di # test official python test.py --weights weights/$name.pt --device $di --batch-size 2 # test custom From 7d8e2dd440ae8a60bb4ef841f7101b77685eb30d Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 11:56:18 +0200 Subject: [PATCH 10/28] parallel --- .github/workflows/ci-testing.yml | 43 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 0369670..526bcf3 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -12,6 +12,7 @@ jobs: 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: @@ -32,9 +33,9 @@ jobs: uses: actions/cache@v1 with: path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | - ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}-pip- + ${{ runner.os }}-${{ matrix.python-version }}-pip- - name: Install dependencies run: | @@ -50,26 +51,26 @@ jobs: - 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 + - name: Tests workflow run: | - for name in yolov5s yolov5m yolov5l yolov5x # models - do - di=cpu # inference devices - # train - python train.py --weights weights/$name.pt --cfg models/$name.yaml --epochs 1 --img 320 --device $di --batch-size 2 - # detect official - python detect.py --weights weights/$name.pt --device $di - # detect custom - python detect.py --weights runs/exp0/weights/last.pt --device $di - # test official - python test.py --weights weights/$name.pt --device $di --batch-size 2 - # test custom - python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 - # inspect - python models/yolo.py --cfg models/$name.yaml - # export - python models/export.py --weights weights/$name.pt --img 640 --batch 1 - done + 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 2 + # test custom + python test.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 From df270ea9d7f8e84f41fe4958b30c693e1d0dd298 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:03:06 +0200 Subject: [PATCH 11/28] rename eval --- test.py => eval.py | 2 +- train.py | 4 ++-- utils/utils.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename test.py => eval.py (99%) diff --git a/test.py b/eval.py similarity index 99% rename from test.py rename to eval.py index ed7e29c..4aa692e 100644 --- a/test.py +++ b/eval.py @@ -233,7 +233,7 @@ def test(data, if __name__ == '__main__': - parser = argparse.ArgumentParser(prog='test.py') + parser = argparse.ArgumentParser(prog='eval.py') parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)') parser.add_argument('--data', type=str, default='data/coco128.yaml', help='*.data path') parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') diff --git a/train.py b/train.py index 879bb2e..1c28fec 100644 --- a/train.py +++ b/train.py @@ -7,7 +7,7 @@ import torch.optim.lr_scheduler as lr_scheduler import torch.utils.data from torch.utils.tensorboard import SummaryWriter -import test # import test.py to get mAP after each epoch +import eval # import eval.py to get mAP after each epoch from models.yolo import Model from utils import google_utils from utils.datasets import * @@ -291,7 +291,7 @@ def train(hyp): ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride']) final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP - results, maps, times = test.test(opt.data, + results, maps, times = eval.test(opt.data, batch_size=batch_size, imgsz=imgsz_test, save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), diff --git a/utils/utils.py b/utils/utils.py index ce1d910..209e884 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -1087,7 +1087,7 @@ def plot_targets_txt(): # from utils.utils import *; plot_targets_txt() def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_study_txt() - # Plot study.txt generated by test.py + # Plot study.txt generated by eval.py fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True) ax = ax.ravel() From 9a880a4554e627fccd5d32ff8f3f17ee41682555 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:05:00 +0200 Subject: [PATCH 12/28] rename eval --- eval.py | 52 ++++++++++++++++++++++++++-------------------------- train.py | 16 ++++++++-------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/eval.py b/eval.py index 4aa692e..eee3cfd 100644 --- a/eval.py +++ b/eval.py @@ -5,21 +5,21 @@ from models.experimental import * from utils.datasets import * -def test(data, - weights=None, - batch_size=16, - imgsz=640, - conf_thres=0.001, - iou_thres=0.6, # for NMS - save_json=False, - single_cls=False, - augment=False, - verbose=False, - model=None, - dataloader=None, - save_dir='', - merge=False, - save_txt=False): +def evaluate(data, + weights=None, + batch_size=16, + imgsz=640, + conf_thres=0.001, + iou_thres=0.6, # for NMS + save_json=False, + single_cls=False, + augment=False, + verbose=False, + model=None, + dataloader=None, + save_dir='', + merge=False, + save_txt=False): # Initialize/load model and set device training = model is not None if training: # called by train.py @@ -254,16 +254,16 @@ if __name__ == '__main__': print(opt) if opt.task in ['val', 'test']: # run normally - test(opt.data, - opt.weights, - opt.batch_size, - opt.img_size, - opt.conf_thres, - opt.iou_thres, - opt.save_json, - opt.single_cls, - opt.augment, - opt.verbose) + evaluate(opt.data, + opt.weights, + opt.batch_size, + opt.img_size, + opt.conf_thres, + opt.iou_thres, + opt.save_json, + opt.single_cls, + opt.augment, + opt.verbose) elif opt.task == 'study': # run over a range of settings and save/plot for weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt', 'yolov3-spp.pt']: @@ -272,7 +272,7 @@ if __name__ == '__main__': y = [] # y axis for i in x: # img-size print('\nRunning %s point %s...' % (f, i)) - r, _, t = test(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) + r, _, t = evaluate(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) y.append(r + t) # results and times np.savetxt(f, y, fmt='%10.4g') # save os.system('zip -r study.zip study_*.txt') diff --git a/train.py b/train.py index 1c28fec..ad12b5d 100644 --- a/train.py +++ b/train.py @@ -291,14 +291,14 @@ def train(hyp): ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride']) final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP - results, maps, times = eval.test(opt.data, - batch_size=batch_size, - imgsz=imgsz_test, - save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), - model=ema.ema, - single_cls=opt.single_cls, - dataloader=testloader, - save_dir=log_dir) + results, maps, times = eval.evaluate(opt.data, + batch_size=batch_size, + imgsz=imgsz_test, + save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), + model=ema.ema, + single_cls=opt.single_cls, + dataloader=testloader, + save_dir=log_dir) # Write with open(results_file, 'a') as f: From da6c7cea2b75af10c1a13132c33b421f6ed9a2d7 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:06:18 +0200 Subject: [PATCH 13/28] paths --- .github/workflows/ci-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 526bcf3..cda65a9 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -58,6 +58,9 @@ jobs: - 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 From eac0dbc46a1d774ba2617b8e6affc0a3ee8c3af9 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:11:38 +0200 Subject: [PATCH 14/28] rename --- .github/workflows/ci-testing.yml | 4 ++-- README.md | 4 ++-- tutorial.ipynb | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index cda65a9..6080816 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -69,9 +69,9 @@ jobs: # 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 2 + python eval.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 2 # test custom - python test.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 + 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 diff --git a/README.md b/README.md index c80b139..0d5a38e 100755 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ This repository represents Ultralytics open-source research into future object d ** APtest denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy. -** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python test.py --data coco.yaml --img 736 --conf 0.001` -** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python test.py --data coco.yaml --img 640 --conf 0.1` +** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python eval.py --data coco.yaml --img 736 --conf 0.001` +** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python eval.py --data coco.yaml --img 640 --conf 0.1` ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation). diff --git a/tutorial.ipynb b/tutorial.ipynb index d3418cc..228a79b 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -236,7 +236,7 @@ }, "source": [ "# Run YOLOv5x on COCO val2017\n", - "!python test.py --weights yolov5x.pt --data coco.yaml --img 672" + "!python eval.py --weights yolov5x.pt --data coco.yaml --img 672" ], "execution_count": null, "outputs": [ @@ -319,7 +319,7 @@ }, "source": [ "# Run YOLOv5s on COCO test-dev2017 with argument --task test\n", - "!python test.py --weights yolov5s.pt --data ./data/coco.yaml --task test" + "!python eval.py --weights yolov5s.pt --data ./data/coco.yaml --task test" ], "execution_count": null, "outputs": [] @@ -717,7 +717,7 @@ "for x in best*\n", "do\n", " gsutil cp gs://*/*/*/$x.pt .\n", - " python test.py --weights $x.pt --data coco.yaml --img 672\n", + " python eval.py --weights $x.pt --data coco.yaml --img 672\n", "done" ], "execution_count": null, @@ -744,8 +744,8 @@ " do\n", " python detect.py --weights $x.pt --device $di # detect official\n", " python detect.py --weights runs/exp0/weights/last.pt --device $di # detect custom\n", - " python test.py --weights $x.pt --device $di # test official\n", - " python test.py --weights runs/exp0/weights/last.pt --device $di # test custom\n", + " python eval.py --weights $x.pt --device $di # test official\n", + " python eval.py --weights runs/exp0/weights/last.pt --device $di # test custom\n", " done\n", " python models/yolo.py --cfg $x.yaml # inspect\n", " python models/export.py --weights $x.pt --img 640 --batch 1 # export\n", From e8b7b86d5acfe6fda99f352c93098f9fabd241a7 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:25:55 +0200 Subject: [PATCH 15/28] lower bs --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 6080816..d1da775 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -69,9 +69,9 @@ jobs: # 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 + python eval.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 1 # test custom - python eval.py --weights runs/exp0/weights/last.pt --device $di --batch-size 2 + python eval.py --weights runs/exp0/weights/last.pt --device $di --batch-size 1 # inspect python models/yolo.py --cfg models/${{ matrix.yolo5-model }}.yaml # export From 5c73caa2debd3ba878c0551b809e2c373b73e662 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 12:28:20 +0200 Subject: [PATCH 16/28] timeout --- .github/workflows/ci-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index d1da775..1aff601 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -15,6 +15,7 @@ jobs: 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 }} From 2b8fbdafb91f086949c08a107a36c54801ad2189 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 13:57:07 +0200 Subject: [PATCH 17/28] less xOS --- .github/workflows/ci-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 1aff601..35f86d8 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -13,6 +13,9 @@ jobs: os: [ubuntu-18.04, macOS-10.15] #, windows-2019 python-version: [3.7, 3.8] yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"] + exclude: + - python-version: 3.8 + os: macOS-10.15 # Timeout: https://stackoverflow.com/a/59076067/4521646 timeout-minutes: 50 From eafe85b1d7c95aafbe384cc6857c5564a1ed6cff Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 14:03:06 +0200 Subject: [PATCH 18/28] drop xOS --- .github/workflows/ci-testing.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 35f86d8..98e228a 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,12 +10,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, macOS-10.15] #, windows-2019 + os: [ubuntu-18.04] #, macOS-10.15, windows-2019 python-version: [3.7, 3.8] yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"] - exclude: - - python-version: 3.8 - os: macOS-10.15 # Timeout: https://stackoverflow.com/a/59076067/4521646 timeout-minutes: 50 From 01289473fe0e123624b957883496dcbb82cbac62 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 16:46:57 +0200 Subject: [PATCH 19/28] git attrib --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dad4239 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# this drop notebooks from GitHub language stats +*.ipynb linguist-vendored From be55111de414e4cc6d7c08a60f94676f14b22dfe Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 19:10:32 +0200 Subject: [PATCH 20/28] paths --- .github/workflows/ci-testing.yml | 1 + data/coco128.yaml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 98e228a..5edbb1a 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -51,6 +51,7 @@ jobs: - name: Download data run: | + cd .. python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" - name: Download weights diff --git a/data/coco128.yaml b/data/coco128.yaml index d5835c6..9f47382 100644 --- a/data/coco128.yaml +++ b/data/coco128.yaml @@ -8,8 +8,8 @@ # train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/] -train: coco128/images/train2017/ # 128 images -val: coco128/images/train2017/ # 128 images +train: ../coco128/images/train2017/ # 128 images +val: ../coco128/images/train2017/ # 128 images # number of classes nc: 80 From 4500b49fa3ed92a11b662e630e2ea7f0c9a294fd Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 16 Jul 2020 19:14:23 +0200 Subject: [PATCH 21/28] paths --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 5edbb1a..5d1618d 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -51,8 +51,8 @@ jobs: - name: Download data run: | - cd .. python -c "from utils.google_utils import * ; gdrive_download('1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', 'coco128.zip')" + mv ./coco128 ../ - name: Download weights run: | From b4faccabac80f9bcf0d7c95fe2e538541d99bc9f Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Thu, 16 Jul 2020 21:08:18 +0200 Subject: [PATCH 22/28] Apply suggestions from code review --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 5d1618d..1a5ea58 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04] #, macOS-10.15, windows-2019 + os: [ubuntu-latest] #, macOS-10.15, windows-2019 python-version: [3.7, 3.8] yolo5-model: ["yolov5s", "yolov5m", "yolov5l", "yolov5x"] From dfb5d27194faa9efb8ee502504cd293341d79b5b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 16 Jul 2020 12:31:37 -0700 Subject: [PATCH 23/28] Update eval.py --- eval.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/eval.py b/eval.py index eee3cfd..d181712 100644 --- a/eval.py +++ b/eval.py @@ -5,21 +5,21 @@ from models.experimental import * from utils.datasets import * -def evaluate(data, - weights=None, - batch_size=16, - imgsz=640, - conf_thres=0.001, - iou_thres=0.6, # for NMS - save_json=False, - single_cls=False, - augment=False, - verbose=False, - model=None, - dataloader=None, - save_dir='', - merge=False, - save_txt=False): +def test(data, + weights=None, + batch_size=16, + imgsz=640, + conf_thres=0.001, + iou_thres=0.6, # for NMS + save_json=False, + single_cls=False, + augment=False, + verbose=False, + model=None, + dataloader=None, + save_dir='', + merge=False, + save_txt=False): # Initialize/load model and set device training = model is not None if training: # called by train.py From 1e831bd820f2badc4d3f18ca12576008c62c3c16 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 16 Jul 2020 13:14:29 -0700 Subject: [PATCH 24/28] Update eval.py --- eval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eval.py b/eval.py index d181712..0da0395 100644 --- a/eval.py +++ b/eval.py @@ -5,7 +5,7 @@ from models.experimental import * from utils.datasets import * -def test(data, +def evaluate(data, weights=None, batch_size=16, imgsz=640, From 4171df333c7bd0ab46f7c62778872a8f232829d3 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 16 Jul 2020 13:40:31 -0700 Subject: [PATCH 25/28] Update ci-testing.yml --- .github/workflows/ci-testing.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 1a5ea58..13100bc 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -41,7 +41,6 @@ jobs: - 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 From 670d4ff287c1b51cd2bcb536b009f468c11bc235 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 16 Jul 2020 13:44:02 -0700 Subject: [PATCH 26/28] Update ci-testing.yml --- .github/workflows/ci-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 13100bc..1a5ea58 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -41,6 +41,7 @@ jobs: - 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 From ef6f5b33a8c1a23e43bea8d661f1e90c7e0e0b68 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 17 Jul 2020 00:11:27 +0200 Subject: [PATCH 27/28] rename test --- eval.py | 24 ++++++++++++------------ train.py | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eval.py b/eval.py index 0da0395..4aa692e 100644 --- a/eval.py +++ b/eval.py @@ -5,7 +5,7 @@ from models.experimental import * from utils.datasets import * -def evaluate(data, +def test(data, weights=None, batch_size=16, imgsz=640, @@ -254,16 +254,16 @@ if __name__ == '__main__': print(opt) if opt.task in ['val', 'test']: # run normally - evaluate(opt.data, - opt.weights, - opt.batch_size, - opt.img_size, - opt.conf_thres, - opt.iou_thres, - opt.save_json, - opt.single_cls, - opt.augment, - opt.verbose) + test(opt.data, + opt.weights, + opt.batch_size, + opt.img_size, + opt.conf_thres, + opt.iou_thres, + opt.save_json, + opt.single_cls, + opt.augment, + opt.verbose) elif opt.task == 'study': # run over a range of settings and save/plot for weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt', 'yolov3-spp.pt']: @@ -272,7 +272,7 @@ if __name__ == '__main__': y = [] # y axis for i in x: # img-size print('\nRunning %s point %s...' % (f, i)) - r, _, t = evaluate(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) + r, _, t = test(opt.data, weights, opt.batch_size, i, opt.conf_thres, opt.iou_thres, opt.save_json) y.append(r + t) # results and times np.savetxt(f, y, fmt='%10.4g') # save os.system('zip -r study.zip study_*.txt') diff --git a/train.py b/train.py index ad12b5d..1c28fec 100644 --- a/train.py +++ b/train.py @@ -291,14 +291,14 @@ def train(hyp): ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride']) final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP - results, maps, times = eval.evaluate(opt.data, - batch_size=batch_size, - imgsz=imgsz_test, - save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), - model=ema.ema, - single_cls=opt.single_cls, - dataloader=testloader, - save_dir=log_dir) + results, maps, times = eval.test(opt.data, + batch_size=batch_size, + imgsz=imgsz_test, + save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), + model=ema.ema, + single_cls=opt.single_cls, + dataloader=testloader, + save_dir=log_dir) # Write with open(results_file, 'a') as f: From e8ea772384ce41a853e6e4aec4877d6951a12782 Mon Sep 17 00:00:00 2001 From: Jirka Date: Fri, 17 Jul 2020 01:16:22 +0200 Subject: [PATCH 28/28] revert test module to confuse users... --- .github/workflows/ci-testing.yml | 4 ++-- README.md | 4 ++-- eval.py => test.py | 2 +- train.py | 4 ++-- tutorial.ipynb | 10 +++++----- utils/utils.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) rename eval.py => test.py (99%) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 1a5ea58..3bfb6f2 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -71,9 +71,9 @@ jobs: # 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 1 + python test.py --weights weights/${{ matrix.yolo5-model }}.pt --device $di --batch-size 1 # test custom - python eval.py --weights runs/exp0/weights/last.pt --device $di --batch-size 1 + 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 diff --git a/README.md b/README.md index 0d5a38e..c80b139 100755 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ This repository represents Ultralytics open-source research into future object d ** APtest denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy. -** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python eval.py --data coco.yaml --img 736 --conf 0.001` -** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python eval.py --data coco.yaml --img 640 --conf 0.1` +** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python test.py --data coco.yaml --img 736 --conf 0.001` +** SpeedGPU measures end-to-end time per image averaged over 5000 COCO val2017 images using a GCP [n1-standard-16](https://cloud.google.com/compute/docs/machine-types#n1_standard_machine_types) instance with one V100 GPU, and includes image preprocessing, PyTorch FP16 image inference at --batch-size 32 --img-size 640, postprocessing and NMS. Average NMS time included in this chart is 1-2ms/img. Reproduce by `python test.py --data coco.yaml --img 640 --conf 0.1` ** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation). diff --git a/eval.py b/test.py similarity index 99% rename from eval.py rename to test.py index 4aa692e..ed7e29c 100644 --- a/eval.py +++ b/test.py @@ -233,7 +233,7 @@ def test(data, if __name__ == '__main__': - parser = argparse.ArgumentParser(prog='eval.py') + parser = argparse.ArgumentParser(prog='test.py') parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)') parser.add_argument('--data', type=str, default='data/coco128.yaml', help='*.data path') parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') diff --git a/train.py b/train.py index 1c28fec..879bb2e 100644 --- a/train.py +++ b/train.py @@ -7,7 +7,7 @@ import torch.optim.lr_scheduler as lr_scheduler import torch.utils.data from torch.utils.tensorboard import SummaryWriter -import eval # import eval.py to get mAP after each epoch +import test # import test.py to get mAP after each epoch from models.yolo import Model from utils import google_utils from utils.datasets import * @@ -291,7 +291,7 @@ def train(hyp): ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride']) final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP - results, maps, times = eval.test(opt.data, + results, maps, times = test.test(opt.data, batch_size=batch_size, imgsz=imgsz_test, save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'), diff --git a/tutorial.ipynb b/tutorial.ipynb index 228a79b..d3418cc 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -236,7 +236,7 @@ }, "source": [ "# Run YOLOv5x on COCO val2017\n", - "!python eval.py --weights yolov5x.pt --data coco.yaml --img 672" + "!python test.py --weights yolov5x.pt --data coco.yaml --img 672" ], "execution_count": null, "outputs": [ @@ -319,7 +319,7 @@ }, "source": [ "# Run YOLOv5s on COCO test-dev2017 with argument --task test\n", - "!python eval.py --weights yolov5s.pt --data ./data/coco.yaml --task test" + "!python test.py --weights yolov5s.pt --data ./data/coco.yaml --task test" ], "execution_count": null, "outputs": [] @@ -717,7 +717,7 @@ "for x in best*\n", "do\n", " gsutil cp gs://*/*/*/$x.pt .\n", - " python eval.py --weights $x.pt --data coco.yaml --img 672\n", + " python test.py --weights $x.pt --data coco.yaml --img 672\n", "done" ], "execution_count": null, @@ -744,8 +744,8 @@ " do\n", " python detect.py --weights $x.pt --device $di # detect official\n", " python detect.py --weights runs/exp0/weights/last.pt --device $di # detect custom\n", - " python eval.py --weights $x.pt --device $di # test official\n", - " python eval.py --weights runs/exp0/weights/last.pt --device $di # test custom\n", + " python test.py --weights $x.pt --device $di # test official\n", + " python test.py --weights runs/exp0/weights/last.pt --device $di # test custom\n", " done\n", " python models/yolo.py --cfg $x.yaml # inspect\n", " python models/export.py --weights $x.pt --img 640 --batch 1 # export\n", diff --git a/utils/utils.py b/utils/utils.py index 209e884..ce1d910 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -1087,7 +1087,7 @@ def plot_targets_txt(): # from utils.utils import *; plot_targets_txt() def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_study_txt() - # Plot study.txt generated by eval.py + # Plot study.txt generated by test.py fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True) ax = ax.ravel()