From be348cc33925738825ab40dd6eacdfe4afd4e215 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 21 Nov 2022 16:54:36 +0100 Subject: [PATCH] Validate --task speed CPU fix (#10244) --- segment/val.py | 2 +- val.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/segment/val.py b/segment/val.py index 9bb8f9e4cf54..48bf28d4bf4f 100644 --- a/segment/val.py +++ b/segment/val.py @@ -444,7 +444,7 @@ def main(opt): else: weights = opt.weights if isinstance(opt.weights, list) else [opt.weights] - opt.half = True # FP16 for fastest results + opt.half = torch.cuda.is_available() and opt.device != 'cpu' # FP16 for fastest results if opt.task == 'speed': # speed benchmarks # python val.py --task speed --data coco.yaml --batch 1 --weights yolov5n.pt yolov5s.pt... opt.conf_thres, opt.iou_thres, opt.save_json = 0.25, 0.45, False diff --git a/val.py b/val.py index ef282e37bdc1..7c610e83a856 100644 --- a/val.py +++ b/val.py @@ -380,7 +380,7 @@ def main(opt): else: weights = opt.weights if isinstance(opt.weights, list) else [opt.weights] - opt.half = True # FP16 for fastest results + opt.half = torch.cuda.is_available() and opt.device != 'cpu' # FP16 for fastest results if opt.task == 'speed': # speed benchmarks # python val.py --task speed --data coco.yaml --batch 1 --weights yolov5n.pt yolov5s.pt... opt.conf_thres, opt.iou_thres, opt.save_json = 0.25, 0.45, False