Skip to content

The autoanchor result is not same as anchors in model? #6966

@PonyPC

Description

@PonyPC

Search before asking

Question

v6.1
The autoanchor result is not same as anchors in model.
I trained my data with autoanchor, and get this:

�[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

After training, I print anchor from model but get:

YOLOv5  2022-2-22 torch 1.8.1+cu111 CPU

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]]])

Only P4 same.

Additional

I got the log from models\hub\anchors.yaml but P3/P4/P5/P6 are same:

# P6-640:  thr=0.25: 0.9964 BPR, 5.54 anchors past thr, n=12, img_size=640, metric_all=0.281/0.716-mean/best, past_thr=0.469-mean: 9,11,  21,19,  17,41,  43,32,  39,70,  86,64,  65,131,  134,130,  120,265,  282,180,  247,354,  512,387
anchors_p6_640:
  - [9,11,  21,19,  17,41]  # P3/8
  - [43,32,  39,70,  86,64]  # P4/16
  - [65,131,  134,130,  120,265]  # P5/32
  - [282,180,  247,354,  512,387]  # P6/64

I also print the offical release model yolov5n.pt, both anchors in model and trainning autoanchor prints are same.

Is it normal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions