I just come across this issue recently. It just appeared to be happening after the changes in the test.pt. It was working well before the last changes.
Traceback (most recent call last):
File "/home/Yolov5_github/yolov5-master/train.py", line 400, in
train(hyp)
File "/home/Yolov5_github/yolov5-master/train.py", line 306, in train
fast=ni < n_burn)
File "/home/Yolov5_github/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
I was just running the below code to train:
python3 train.py \
--img-size 1280\
--batch 4 \
--epochs 2000 \
--data ./data/custom/test_81.yaml \
--cfg ./models/custom/yolov5l.yaml \
--weights '' \
--name test_81_yolov5l \
--cache \
--rect
```
Hello @yasindagasan, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
@yasindagasan thanks for the bug report. Yes, we recently pushed a commit to default testing to FP16. I will try to reproduce your error in colab.
@yasindagasan ok, yes I am able to reproduce. I will push a fix for this shortly.
@yasindagasan you're welcome, you should be all set now!
I suppose I should do a better job of running tests before commits...
@yasindagasan ok, yes I am able to reproduce. I will push a fix for this shortly.
thanks very much!
@yasindagasan you're welcome, you should be all set now!
I suppose I should do a better job of running tests before commits...
It's all good mate, cheers!
do you solve this,I have same problem
Most helpful comment
@yasindagasan ok, yes I am able to reproduce. I will push a fix for this shortly.