ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.54k stars 16.29k forks source link

evolve throws an error #3481

Closed OrjwanZaafarani closed 3 years ago

OrjwanZaafarani commented 3 years ago

❔Question

Why is this command throwing an error? python train.py --img 640 --batch 32 --epochs 100 --data QMUL.yaml --weights yolov5m6.pt --cache --evolve

The error message:

Traceback (most recent call last):
  File "train.py", line 610, in <module>
    hyp[k] = max(hyp[k], v[1])  # lower limit
KeyError: 'anchors'
OrjwanZaafarani commented 3 years ago

I just solved the issue by following https://docs.ultralytics.com/yolov5/tutorials/hyperparameter_evolution#issuecomment-692599379

However, I still don't understand the effect of removing the anchors.

glenn-jocher commented 3 years ago

@OrjwanZaafarani for evolution you should uncomment the anchor field in your hyp file. This will allow the anchor count to evolve.

glenn-jocher commented 3 years ago

@OrjwanZaafarani good news 😃! Your original issue may now be fixed ✅ in PR #3887. This PR adds hyp['anchors']=3 if the anchors key is missing/commented in your hyperparameter file, fixing a long-running problem when starting hyp evolution using the default command:

python train.py --evolve

To receive this update:

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!