Refactor argparser printing to print_args() (#4850)
* Refactor argparser printing to `print_args()` * Cleanup
This commit is contained in:
1 parent
84bfa89236
commit
3732f9ac8a
6 files changed
+23
-18
No files matched your search
@@ -24,7 +24,7 @@ from models.experimental import attempt_load
|
||||
from utils.datasets import create_dataloader
|
||||
from utils.general import coco80_to_coco91_class, check_dataset, check_img_size, check_requirements, \
|
||||
check_suffix, check_yaml, box_iou, non_max_suppression, scale_coords, xyxy2xywh, xywh2xyxy, set_logging, \
|
||||
increment_path, colorstr
|
||||
increment_path, colorstr, print_args
|
||||
from utils.metrics import ap_per_class, ConfusionMatrix
|
||||
from utils.plots import output_to_target, plot_images, plot_val_study
|
||||
from utils.torch_utils import select_device, time_sync
|
||||
@@ -295,7 +295,7 @@ def run(data,
|
||||
|
||||
|
||||
def parse_opt():
|
||||
parser = argparse.ArgumentParser(prog='val.py')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--data', type=str, default='data/coco128.yaml', help='dataset.yaml path')
|
||||
parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
|
||||
parser.add_argument('--batch-size', type=int, default=32, help='batch size')
|
||||
@@ -319,12 +319,12 @@ def parse_opt():
|
||||
opt.save_json |= opt.data.endswith('coco.yaml')
|
||||
opt.save_txt |= opt.save_hybrid
|
||||
opt.data = check_yaml(opt.data) # check YAML
|
||||
print_args(FILE.stem, opt)
|
||||
return opt
|
||||
|
||||
|
||||
def main(opt):
|
||||
set_logging()
|
||||
print(colorstr('val: ') + ', '.join(f'{k}={v}' for k, v in vars(opt).items()))
|
||||
check_requirements(requirements=FILE.parent / 'requirements.txt', exclude=('tensorboard', 'thop'))
|
||||
|
||||
if opt.task in ('train', 'val', 'test'): # run normally
|
||||
|
||||
Reference in new issue
Block a user