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

Anchor Number #29

Closed
Yuanye-F opened this issue Oct 13, 2021 · 1 comment
Closed

Anchor Number #29

Yuanye-F opened this issue Oct 13, 2021 · 1 comment

Comments

@Yuanye-F
Copy link

I reduce the anchor number from 3 to 2, and there is a problem during training (evaluation):

anchor_boxes[:, :, :, :2] = ((r[:, :, :, :2].sigmoid() * 2. - 0.5) + grid) * stride

RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 3

The model configure is:

[model-configure]
pre_weights=None
classes=7
width=320
height=320
anchor_num=2
anchors=10.54,9.51, 45.60,40.45, 119.62,95.06, 253.71,138.37

@Yuanye-F
Copy link
Author

Solve the problem.

In utils/utils.py:

line 300 :
from
return torch.stack((wv, hv), 2).repeat(1,1,3).reshape(h, w, cfg["anchor_num"], -1).to(device)
to
return torch.stack((wv, hv), 2).repeat(1,1,cfg["anchor_num"]).reshape(h, w, cfg["anchor_num"], -1).to(device)

line 326:
from
c = c.repeat(1, 1, 3, 1)
to
c = c.repeat(1, 1, cfg["anchor_num"], 1)

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

1 participant