Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the anchors in cfg file are not same as trained anchors? #153

Closed
PonyPC opened this issue Mar 12, 2022 · 11 comments
Closed

Why the anchors in cfg file are not same as trained anchors? #153

PonyPC opened this issue Mar 12, 2022 · 11 comments

Comments

@PonyPC
Copy link

PonyPC commented Mar 12, 2022

Why the anchors in cfg file are not same as trained anchors?

[yolo]
mask=0, 1, 2
anchors=18, 17, 12, 33, 26, 20, 44, 90, 85, 51, 58, 81, 100, 388, 381, 132, 139, 379

My data anchors:

  - [25,97, 95,33, 35,95]  # P3/8
  - [45,90, 86,52, 58,82]  # P4/16
  - [73,68, 52,135, 106,81]  # P5/32
@marcoslucianops
Copy link
Owner

The anchors are extracted from pt file during the conversion.

@PonyPC
Copy link
Author

PonyPC commented Mar 12, 2022

Got it. Thanks

@PonyPC PonyPC closed this as completed Mar 12, 2022
@PonyPC
Copy link
Author

PonyPC commented Mar 22, 2022

Yolov5 has fixed this issue.
#7058

@PonyPC
Copy link
Author

PonyPC commented Mar 24, 2022

The anchors are not same as slightly.

25,99, 36,86, 97,33, 50,75, 75,56, 38,118, 51,104, 111,51, 71,82, 59,119, 103,74, 83,105
Deepstream-Yolo output:
[25, 99, 35, 85, 97, 32, 50, 75, 75, 55, 38, 118, 50, 103, 111, 50, 70, 82, 59, 119, 102, 74, 83, 104]

Should I ignore this? Does it impact the precision?
@marcoslucianops

@marcoslucianops
Copy link
Owner

which anchors are in cfg file?

@PonyPC
Copy link
Author

PonyPC commented Mar 25, 2022

[25, 99, 35, 85, 97, 32, 50, 75, 75, 55, 38, 118, 50, 103, 111, 50, 70, 82, 59, 119, 102, 74, 83, 104]
second line.

@PonyPC
Copy link
Author

PonyPC commented Mar 25, 2022

Hi, I have sent to your email. Please resolve two issues together. Thanks

@PonyPC
Copy link
Author

PonyPC commented Mar 25, 2022

The anchors in model which I sent you are:

tensor([[[ 26.85938,  79.68750],
         [ 75.12500,  31.82812],
         [ 51.09375,  64.68750],
         [ 29.70312, 114.75000]],

        [[ 43.28125,  85.43750],
         [ 76.43750,  51.43750],
         [107.37500,  41.90625],
         [ 42.84375, 118.87500]],

        [[ 68.06250,  77.68750],
         [ 61.03125, 112.12500],
         [104.62500,  69.81250],
         [ 89.87500,  97.68750]]], dtype=torch.float16)

It seems about round or floor conversion from float to integer

@marcoslucianops
Copy link
Owner

Please check with updated utils/gen_wts_yolov5.py file.

@PonyPC
Copy link
Author

PonyPC commented Mar 25, 2022

Okay, I'll try again

@PonyPC
Copy link
Author

PonyPC commented Mar 25, 2022

It runs well, thanks.

@PonyPC PonyPC closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants