mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
add option to disable half precision in test.py (#2507)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
7cdc5165a1
commit
fd1679975b
3
test.py
3
test.py
@ -37,6 +37,7 @@ def test(data,
|
|||||||
plots=True,
|
plots=True,
|
||||||
wandb_logger=None,
|
wandb_logger=None,
|
||||||
compute_loss=None,
|
compute_loss=None,
|
||||||
|
half_precision=True,
|
||||||
is_coco=False):
|
is_coco=False):
|
||||||
# Initialize/load model and set device
|
# Initialize/load model and set device
|
||||||
training = model is not None
|
training = model is not None
|
||||||
@ -61,7 +62,7 @@ def test(data,
|
|||||||
# model = nn.DataParallel(model)
|
# model = nn.DataParallel(model)
|
||||||
|
|
||||||
# Half
|
# Half
|
||||||
half = device.type != 'cpu' # half precision only supported on CUDA
|
half = device.type != 'cpu' and half_precision # half precision only supported on CUDA
|
||||||
if half:
|
if half:
|
||||||
model.half()
|
model.half()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user