revert test module to confuse users...
Browse files- .github/workflows/ci-testing.yml +2 -2
- README.md +2 -2
- eval.py β test.py +1 -1
- train.py +2 -2
- tutorial.ipynb +5 -5
- utils/utils.py +1 -1
.github/workflows/ci-testing.yml
CHANGED
@@ -71,9 +71,9 @@ jobs:
|
|
71 |
# detect custom
|
72 |
python detect.py --weights runs/exp0/weights/last.pt --device $di
|
73 |
# test official
|
74 |
-
python
|
75 |
# test custom
|
76 |
-
python
|
77 |
# inspect
|
78 |
python models/yolo.py --cfg models/${{ matrix.yolo5-model }}.yaml
|
79 |
# export
|
|
|
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
|
README.md
CHANGED
@@ -27,8 +27,8 @@ This repository represents Ultralytics open-source research into future object d
|
|
27 |
|
28 |
|
29 |
** AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy.
|
30 |
-
** All AP numbers are for single-model single-scale without ensemble or test-time augmentation. Reproduce by `python
|
31 |
-
** Speed<sub>GPU</sub> 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
|
32 |
** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).
|
33 |
|
34 |
|
|
|
27 |
|
28 |
|
29 |
** AP<sup>test</sup> denotes COCO [test-dev2017](http://cocodataset.org/#upload) server results, all other AP results in the table denote val2017 accuracy.
|
30 |
+
** 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`
|
31 |
+
** Speed<sub>GPU</sub> 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`
|
32 |
** All checkpoints are trained to 300 epochs with default settings and hyperparameters (no autoaugmentation).
|
33 |
|
34 |
|
eval.py β test.py
RENAMED
@@ -233,7 +233,7 @@ def test(data,
|
|
233 |
|
234 |
|
235 |
if __name__ == '__main__':
|
236 |
-
parser = argparse.ArgumentParser(prog='
|
237 |
parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
|
238 |
parser.add_argument('--data', type=str, default='data/coco128.yaml', help='*.data path')
|
239 |
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
|
|
|
233 |
|
234 |
|
235 |
if __name__ == '__main__':
|
236 |
+
parser = argparse.ArgumentParser(prog='test.py')
|
237 |
parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
|
238 |
parser.add_argument('--data', type=str, default='data/coco128.yaml', help='*.data path')
|
239 |
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
|
train.py
CHANGED
@@ -7,7 +7,7 @@ import torch.optim.lr_scheduler as lr_scheduler
|
|
7 |
import torch.utils.data
|
8 |
from torch.utils.tensorboard import SummaryWriter
|
9 |
|
10 |
-
import
|
11 |
from models.yolo import Model
|
12 |
from utils import google_utils
|
13 |
from utils.datasets import *
|
@@ -291,7 +291,7 @@ def train(hyp):
|
|
291 |
ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride'])
|
292 |
final_epoch = epoch + 1 == epochs
|
293 |
if not opt.notest or final_epoch: # Calculate mAP
|
294 |
-
results, maps, times =
|
295 |
batch_size=batch_size,
|
296 |
imgsz=imgsz_test,
|
297 |
save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'),
|
|
|
7 |
import torch.utils.data
|
8 |
from torch.utils.tensorboard import SummaryWriter
|
9 |
|
10 |
+
import test # import test.py to get mAP after each epoch
|
11 |
from models.yolo import Model
|
12 |
from utils import google_utils
|
13 |
from utils.datasets import *
|
|
|
291 |
ema.update_attr(model, include=['md', 'nc', 'hyp', 'gr', 'names', 'stride'])
|
292 |
final_epoch = epoch + 1 == epochs
|
293 |
if not opt.notest or final_epoch: # Calculate mAP
|
294 |
+
results, maps, times = test.test(opt.data,
|
295 |
batch_size=batch_size,
|
296 |
imgsz=imgsz_test,
|
297 |
save_json=final_epoch and opt.data.endswith(os.sep + 'coco.yaml'),
|
tutorial.ipynb
CHANGED
@@ -236,7 +236,7 @@
|
|
236 |
},
|
237 |
"source": [
|
238 |
"# Run YOLOv5x on COCO val2017\n",
|
239 |
-
"!python
|
240 |
],
|
241 |
"execution_count": null,
|
242 |
"outputs": [
|
@@ -319,7 +319,7 @@
|
|
319 |
},
|
320 |
"source": [
|
321 |
"# Run YOLOv5s on COCO test-dev2017 with argument --task test\n",
|
322 |
-
"!python
|
323 |
],
|
324 |
"execution_count": null,
|
325 |
"outputs": []
|
@@ -717,7 +717,7 @@
|
|
717 |
"for x in best*\n",
|
718 |
"do\n",
|
719 |
" gsutil cp gs://*/*/*/$x.pt .\n",
|
720 |
-
" python
|
721 |
"done"
|
722 |
],
|
723 |
"execution_count": null,
|
@@ -744,8 +744,8 @@
|
|
744 |
" do\n",
|
745 |
" python detect.py --weights $x.pt --device $di # detect official\n",
|
746 |
" python detect.py --weights runs/exp0/weights/last.pt --device $di # detect custom\n",
|
747 |
-
" python
|
748 |
-
" python
|
749 |
" done\n",
|
750 |
" python models/yolo.py --cfg $x.yaml # inspect\n",
|
751 |
" python models/export.py --weights $x.pt --img 640 --batch 1 # export\n",
|
|
|
236 |
},
|
237 |
"source": [
|
238 |
"# Run YOLOv5x on COCO val2017\n",
|
239 |
+
"!python test.py --weights yolov5x.pt --data coco.yaml --img 672"
|
240 |
],
|
241 |
"execution_count": null,
|
242 |
"outputs": [
|
|
|
319 |
},
|
320 |
"source": [
|
321 |
"# Run YOLOv5s on COCO test-dev2017 with argument --task test\n",
|
322 |
+
"!python test.py --weights yolov5s.pt --data ./data/coco.yaml --task test"
|
323 |
],
|
324 |
"execution_count": null,
|
325 |
"outputs": []
|
|
|
717 |
"for x in best*\n",
|
718 |
"do\n",
|
719 |
" gsutil cp gs://*/*/*/$x.pt .\n",
|
720 |
+
" python test.py --weights $x.pt --data coco.yaml --img 672\n",
|
721 |
"done"
|
722 |
],
|
723 |
"execution_count": null,
|
|
|
744 |
" do\n",
|
745 |
" python detect.py --weights $x.pt --device $di # detect official\n",
|
746 |
" python detect.py --weights runs/exp0/weights/last.pt --device $di # detect custom\n",
|
747 |
+
" python test.py --weights $x.pt --device $di # test official\n",
|
748 |
+
" python test.py --weights runs/exp0/weights/last.pt --device $di # test custom\n",
|
749 |
" done\n",
|
750 |
" python models/yolo.py --cfg $x.yaml # inspect\n",
|
751 |
" python models/export.py --weights $x.pt --img 640 --batch 1 # export\n",
|
utils/utils.py
CHANGED
@@ -1087,7 +1087,7 @@ def plot_targets_txt(): # from utils.utils import *; plot_targets_txt()
|
|
1087 |
|
1088 |
|
1089 |
def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_study_txt()
|
1090 |
-
# Plot study.txt generated by
|
1091 |
fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True)
|
1092 |
ax = ax.ravel()
|
1093 |
|
|
|
1087 |
|
1088 |
|
1089 |
def plot_study_txt(f='study.txt', x=None): # from utils.utils import *; plot_study_txt()
|
1090 |
+
# Plot study.txt generated by test.py
|
1091 |
fig, ax = plt.subplots(2, 4, figsize=(10, 6), tight_layout=True)
|
1092 |
ax = ax.ravel()
|
1093 |
|