Explicit opt function arguments (#2817)

* more explicit function arguments

* fix typo in detect.py

* revert import order

* revert import order

* remove default value
This commit is contained in:
fcakyon authored and GitHub committed 2021-04-22 18:17:30 +02:00
1 parent 264d860f8d
commit b40dd99167
2 files changed
+8 -6

No files matched your search

+3 -3
View File
@@ -15,7 +15,7 @@ from utils.plots import plot_one_box
from utils.torch_utils import select_device, load_classifier, time_synchronized
def detect():
def detect(opt):
source, weights, view_img, save_txt, imgsz = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
save_img = not opt.nosave and not source.endswith('.txt') # save inference images
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
@@ -176,7 +176,7 @@ if __name__ == '__main__':
with torch.no_grad():
if opt.update: # update all models (to fix SourceChangeWarning)
for opt.weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt']:
detect()
detect(opt=opt)
strip_optimizer(opt.weights)
else:
detect()
detect(opt=opt)