-
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Search before asking
- I have searched the YOLOv5 issues and found no similar bug report.
YOLOv5 Component
Training
Bug
The autoanchor result is not same as anchors in model
The console log is:
�[34m�[1mAutoAnchor: �[0mthr=0.25: 1.0000 best possible recall, 8.71 anchors past thr
�[34m�[1mAutoAnchor: �[0mn=9, img_size=640, metric_all=0.571/0.910-mean/best, past_thr=0.583-mean: 25,97, 95,33, 35,95, 45,90, 86,52, 58,82, 73,68, 52,135, 106,81
�[34m�[1mAutoAnchor: �[0mReversing anchor order
�[34m�[1mAutoAnchor: �[0mDone (optional: update model *.yaml to use these anchors in the future)
But get this from model:
tensor([[[ 18.29688, 17.03125],
[ 12.88281, 33.62500],
[ 26.46875, 20.29688]],
[[ 44.90625, 90.37500],
[ 85.81250, 51.71875],
[ 58.37500, 81.87500]],
[[100.62500, 388.50000],
[381.25000, 132.25000],
[139.75000, 379.50000]]], dtype=torch.float16)
Note: only P4 layer same, P3/P5 not.
Environment
- YOLO: YOLOv5 2022-3-15 torch 1.8.1+cu111 CUDA:0 (NVIDIA GeForce GTX 1080 Ti, 11264MiB)
- OS: Win10
- Python:3.8.5
Minimal Reproducible Example
python train.py --device 0 --img 640 --data mydata.yaml --cfg yolov5n.yaml --hyp hyp.scratch-low.yaml --weights '' --batch-size 64 --workers 8 --epochs 300
All is default value except class count equals 1.
yolov5n.yaml
# Parameters
nc: 1
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.25 # layer channel multiple
anchors: 3
You can valid quickly by set epochs to 1.
Additional
I know autoanchor, and what I means the autoanchor result is not same as the model anchor.
Just the follow picture, two circled anchors should be same from P3 to P5 in trains. But in my case they are not.

Are you willing to submit a PR?
- Yes I'd like to help by submitting a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working