yolov5训练一个epoch后报错

File "D:\yolov5-master\test.py", line 89, in test
img = img.half() if half else img.float() # uint8 to fp16/32
UnboundLocalError: local variable 'half' referenced before assignment

请问如何解决?谢谢!

没有定义变量half,内容太少无法看出问题

更新源码,可以解决。